Development Notes Thread

Archive of old Custom Edition threads.

Moderators: th15, Moderators

Locked
User avatar
Arcalane
Pseudofeline Overlord
Posts: 4034
Joined: Thu Sep 13, 2007 10:37 am
Location: UK

Development Notes Thread

Post by Arcalane »

This is where the dev team can store relevant notes for sharing, because sharing is caring or some hippy bullshit like that.

When adding new bullets, several changes have to be made;

Update lowquality and highquality scripts with visibility toggles.

Update GameTitle with interceptable bullets.

Recreate (clone and delete original), in the following order (or so god help you it'll fuck up);

ctr_PartDrawer
GUI_LowPartDrawer
GUI_HighPartDrawer
ctr_GUI
ctr_GUILow

NB: the two GUI part drawers and ctr_GUILow need reparenting. Do not forget this or things will go wonky. Real wonky. The PartDrawers control the GUI unsurprisingly, so if you don't recreate and reparent them, shots start going on top of the GUI. Fun!

Log of convo;
15:27 - th15 -V- Co.: uhh no
15:28 - [FOR] Arcalane: bugger. I've been having some problems with custom bullets and the surfaces mode. :/
15:28 - th15 -V- Co.: oh hey you'rein my junk folder
15:28 - [FOR] Arcalane is flattered. :v
15:29 - th15 -V- Co.: you need to clone and recreate the part controller object
15:29 - th15 -V- Co.: its got to do with event execution order
15:29 - th15 -V- Co.: and this is why the BSF codebase is so fucked.
15:29 - [FOR] Arcalane: ahhh
15:29 - th15 -V- Co.: things like this happen
15:29 - [FOR] Arcalane: what file's that again? partdrawer?
15:30 - th15 -V- Co.: i dunno
15:30 - th15 -V- Co.: the thing that draws stuff to the surface
15:30 - th15 -V- Co.: Recreate Partdrawers then recreate ctr_GUIs when adding new bullets
15:30 - th15 -V- Co.: this is the note i wrote to myself.
15:31 - [FOR] Arcalane: anything special to know about recreating, or is it just clone, nuke and rename?
15:31 - th15 -V- Co.: Update Bullets list in GameTitle when adding bullets

Update loquality and highquality scripts too
15:31 - [FOR] Arcalane: done loqual and hiqual
15:31 - th15 -V- Co.: yea thats the idea
15:31 - [FOR] Arcalane: alright, cool
15:31 - th15 -V- Co.: you have to reset the parent for one of them though
15:32 - [FOR] Arcalane: mmkay
15:34 - [FOR] Arcalane: to be honest I'm surprised I even got them working in the first place
15:34 - th15 -V- Co.: hell, im surprised i did.
15:34 - [FOR] Arcalane: hahaha. The dual turrets are cheap hacks as well. I'm just making the game draw a single shot that looks like two.
15:38 - [FOR] Arcalane: fingers crossed this should work
15:41 - [FOR] Arcalane: recreate the GUI partdrawers too?
15:41 - th15 -V- Co.: yea
15:41 - th15 -V- Co.: otherwise the bullets appear above the gui i tihnk
15:41 - [FOR] Arcalane: haha
15:42 - [FOR] Arcalane: and apparently the esc button stops working if you don't, too.
15:42 - th15 -V- Co.: heh :)
15:43 - [FOR] Arcalane: ah well, getting it down pat will help in the long run
15:44 - [FOR] Arcalane: they have to be recreated in a specific order, right?
15:44 - th15 -V- Co.: yea
15:50 - [FOR] Arcalane: well, so far so good, although the escape menu is still bugging out :/
15:50 - th15 -V- Co.: that's probably because some parent isnt set
15:50 - th15 -V- Co.: the partdrawers need to be parented to ctrpartdrawer or something like that
15:50 - [FOR] Arcalane: that might explain it
15:51 - th15 -V- Co.: it has to :)
15:51 - th15 -V- Co.: othweise you're screwed
15:51 - [FOR] Arcalane: yeah, missed the parent. I really wish there was a faster way to scroll that list.
15:51 - [FOR] Arcalane: or manually input the friggin' parent name
15:52 - th15 -V- Co.: heh
15:52 - th15 -V- Co.: you should try expanding the entire resource trree
15:52 - th15 -V- Co.: and watch your ocmputer die
15:52 - th15 -V- Co.: all those icons...
15:52 - [FOR] Arcalane: hahaha, yeah, it takes a few seconds to cache all the sprites
15:56 - [FOR] Arcalane: there we go! \o/ thanks muchly
  /l、
゙(゚、 。 7
 l、゙ ~ヽ
 じしf_, )ノ
ChaosTheory
Vice Admiral
Vice Admiral
Posts: 1372
Joined: Tue Dec 11, 2007 1:31 pm
Location: Sunny California

Post by ChaosTheory »

For loading custom ships in PlatformDeployers, th15 already had some skeleton code lying around to load custom ships in PlatDeps. Unfortunately, it had a ton of bugs because file names use strings instead of numbers. I think this fixes all the little random bugs I found, tell me if you still run into problems:

-SB-

Under Objects -> obj_sidebar -> Event:E-key, replace line 75 with this:

Code: Select all

var spec1;
spec1 = nextword();
    if (string_letters(spec1) == "") {global.selected.l_special1 = real(spec1);}
    else {global.selected.l_special1 = spec1;}
-BSF-

Under Scripts -> nMod() replace the block about argument6 with this:

Code: Select all

if is_real(argument6) == true {
    if argument6 != -1 {
        l_weapon[j].l_special1 = argument6
        cus = true;
        }
    }
else if is_string(argument6) == true {
    l_weapon[j].l_special1 = argument6
    cus = true;
    }
Under Objects -> PlatformDeployer -> Event:UserDefined0, replace line 12 with this:

Code: Select all

obj = placeShip(l_special1,0,x,y,image_angle,0)
Under Objects -> EPlatformDeployer -> Event:Alarm2, replace line 10 with this:

Code: Select all

obj = placeShip(l_special1,1,x,y,image_angle,0)
Under Objects -> PlatformDeployerAI -> Event:Alarm2, replace line 10 with this:

Code: Select all

obj = placeShip(l_special1,2,x,y,image_angle,0)
Then to use it, press R and then E on a PlatDep in SB and insert the ship file you want in the following way:

module|PlatformDeployer|-1|-1|-1|-1|-1||'KKW.shp'|-1|-1|-1|-1|-1|-1|-1

You can use file paths, like 'ships/KKW.shp', but they must branch off the folder BSF is in, and they must be in the same folder on everyone's computer.
[img]http://i307.photobucket.com/albums/nn298/ChaosTheory100/Feather_Signature_Ice3.png[/img]
User avatar
Arcalane
Pseudofeline Overlord
Posts: 4034
Joined: Thu Sep 13, 2007 10:37 am
Location: UK

Post by Arcalane »

Just posting to confirm this works. I'll put it in the next version.

I've also figured out how to allow it to accept ship names (it wasn't rocket science, I adapted the Turret Name field and played around a bit) in the edit panel so people don't have to fiddle with strings. :)

ED: Actually, I think I'm going to try and make a new module and leave the existing platform deployer untouched. We can also add more aesthetically-pleasing (ie, not ridiculously huge) module sprites for the new deployer if we do that. It also means we don't break the existing platform deployer's campaign/etc. functionality.
  /l、
゙(゚、 。 7
 l、゙ ~ヽ
 じしf_, )ノ
ChaosTheory
Vice Admiral
Vice Admiral
Posts: 1372
Joined: Tue Dec 11, 2007 1:31 pm
Location: Sunny California

Post by ChaosTheory »

I've got something bordering on success with Teslas. They have this almost ethereal effect. Very fun, tons of customization possibilities.

Image

Image

Image

To build:

Duplicate BulletLaser, rename it BulletTesla

Add the EndStep event and paste this code:

Code: Select all

if !instance_exists(l_owner) then 
    {
    instance_destroy()
    }
else
    {
    x = l_owner.x
    y = l_owner.y
    var ship,curposx,curposy,curangle,stepoffx,stepoffy,hit;//, oristepoffy ;
    _deviation += random(l_owner.l_deviation) * l_deviationdir
    curangle = l_owner.image_angle + l_deviation
    stepoffx = lengthdir_x(sprite_width,curangle)
    stepoffy = lengthdir_y(sprite_width,curangle)
    curposx = l_owner.x + stepoffx * 0.5
    curposy = l_owner.y + stepoffy * 0.5
    hit = -4
    draw_set_blend_mode(bm_add);
    repeat(2) draw_circle_color(x-l_width+random(l_width*2),y-l_width+random(l_width*2),random(l_width)+l_width,l_colour,l_colour2,floor(random(2)));
    curposx += stepoffx * freelength
    curposy += stepoffy * freelength
    repeat (checklength)
        {  
        hit = instance_position(curposx,curposy,l_owner.l_ptarget)
        if hit < 0 then hit = instance_position(curposx,curposy,instance_nearest(curposx,curposy,ctr_ShotObstructions))
        if hit < 0 then
            {
            curposx += stepoffx
            curposy += stepoffy
            }
        else 
            {
            var ran,ran3;
            ran = random(1)
            ran3 = random(360)
            if hit.l_hp <= l_damage then 
                {
                with (hit)
                    {
                    instance_destroy()
                    if !(object_is_ancestor(object_index,ctr_Ship) || object_is_ancestor(object_index,ctr_EShip)) && object_is_ancestor(object_index,ctr_Actors) then
                        {
                        l_owner.l_syshp -= l_hp
                        }
                    }
                }
            else
                {
                with (hit)
                    {
                    l_hp -= other.l_damage
                    if !(object_is_ancestor(object_index,ctr_Ship) || object_is_ancestor(object_index,ctr_EShip)) && object_is_ancestor(object_index,ctr_Actors) then
                        {
                        l_owner.l_syshp -= other.l_damage
                        }
                    }
                }   
            gfKX_Tesla_Width = l_width;
            gfKX_Tesla_Amplitude = l_amplitude;
            gfKX_Tesla_Frequency = l_frequency;
            scpKX_Tesla_Draw(x,y,curposx,curposy,l_colour,l_colour2,l_alpha1,l_alpha2);
            draw_circle_color(curposx,curposy,random(l_width)+l_width,l_colour,l_colour2,floor(random(2)));
            break;
            }
        }  
    if hit < 0 then
        {
        gfKX_Tesla_Width = l_misswidth;
        gfKX_Tesla_Amplitude = l_missamp;
        gfKX_Tesla_Frequency = l_missfreq;
        scpKX_Tesla_Draw(x,y,curposx+lengthdir_x(random(l_deviation*10),random(360)),curposy+lengthdir_y(random(l_deviation*10),random(360)),l_colour,l_colour2,l_alpha1*0.5,l_alpha2*0.5);
        }
    l_duration -= 1
    if l_duration <= 0 then 
        {
        instance_destroy()
        }
    }
draw_set_blend_mode(bm_normal)
Now paste this over the Create event.

Code: Select all

event_inherited()
   //Properties
   //SFX Values
l_sparknum = 1
l_bighit = true
l_colour = $FFFFFF
l_colour2 = $6666BB
l_width = 3
l_amplitude = 10
l_frequency = 8
l_alpha1 = 1
l_alpha2 = 0.25
l_misswidth = 1
l_missamp = 30
l_missfreq = 8

sound_play(snd_BeamLoop)
Now duplicate the Laser object, and rename it Tesla.

Add the Step event, paste this code:

Code: Select all

//Reduce firing timer
if l_firingtimer < -l_firingreload then l_firecount = 0
else l_firingtimer -= 1

//FIRING MODES LEGEND
//0 = Normal, 1 = Hold Fire, 2 = Interception
var target,targetdir;
target = noone
if l_mode <1> sqr(x - l_target.x) + sqr(y - l_target.y) then
        target = l_target
        targetdir = point_direction(x,y,target.x,target.y)
        l_target = target //Target was found, so save it and keep shooting at it
        var turndir,absturndir;
        turndir = ((targetdir - image_angle + 540) mod 360) - 180 //anglediff(image_angle,targetdir)
        absturndir = abs(turndir)
        if absturndir <l_turning> 0 then
            {
            if absturndir > l_deviation then target = -4    
            image_angle += l_turning
            }
        else
            {
            if absturndir > l_deviation then target = -4    
            image_angle  -= l_turning
            }
        if target > 0 then
            {
            //TRY TO FIRE
            if l_firingtimer <= 0 && l_mode != 1 then
                {
                repeat (l_special1)
                    {
                    sound_play(l_firesound) 
                    image_index = 0
                    image_speed = 0.5
                    var bullet;
                    bullet = instance_create(x,y,l_bullet)
                    bullet.l_range = l_range
                    bullet.l_owner = self.id
                    bullet.l_damage = l_damage
                    bullet.l_duration = l_duration
                    bullet.image_blend = l_bulletcol
                    bullet.image_yscale = image_yscale
                    bullet.l_deviation = random(l_special2) * -bullet.l_deviationdir
                    bullet.l_beamlength = l_beamlength
                    bullet.sprite_index = l_bulletsprite
                    bullet.l_colour2 = l_colour2
                    bullet.l_width = l_width
                    bullet.l_amplitude = l_amplitude
                    bullet.l_frequency = l_frequency
                    bullet.l_alpha1 = l_alpha1
                    bullet.l_alpha2 = l_alpha2
                    bullet.l_misswidth = l_misswidth
                    bullet.l_missamp = l_missamp
                    bullet.l_missfreq = l_missfreq
                    with (bullet)
                        {
                        event_perform(ev_alarm,0) //Call Beam's alarm to setup check length
                        }
                    }
                if l_firingcount = l_firingclip-1 then
                    {
                    l_firingtimer = l_firingreload
                    l_firingcount = 0
                    }
                else
                    {
                    l_firingcount +=1
                    l_firingtimer = l_firingrate
                    }
                }
                //End Try to Fire
            }
        }
    else    //If no target found, try to return to normal
        {
        var turndir;
        targetdir = l_owner.image_angle+l_arcoffset+ai_offset
        turndir = ((targetdir - image_angle + 540) mod 360) - 180 //anglediff(image_angle,targetdir)
        if abs(turndir) <l_turning> 0 then
            {
            image_angle += l_turning
            }
        else 
            {
            image_angle  -= l_turning
            }
        }
    //Turning Limit
    if l_arcrange <180> l_arcrange then   
            {   
            if offangle > 0 then
                {
                image_angle = l_owner.image_angle + l_arcoffset - l_arcrange
                }
            else
                {
                image_angle = l_owner.image_angle + l_arcoffset + l_arcrange
                }
            }
        }
    }
else
    {
    //Turning Limit
    if l_arcrange <180> l_arcrange then   
            {   
            if offangle > 0 then
                {
                image_angle = l_owner.image_angle + l_arcoffset - l_arcrange
                }
            else
                {
                image_angle = l_owner.image_angle + l_arcoffset + l_arcrange
                }
            }
        }
    }
Paste this at the end of the Create event:

Code: Select all

l_colour2 = $6666BB
l_width = 3
l_amplitude = 10
l_frequency = 8
l_alpha1 = 1
l_alpha2 = 0.25
l_misswidth = 1
l_missamp = 30
l_missfreq = 8
And change this line:

Code: Select all

l_bullet = BulletLaser //bullet object type
To this:

Code: Select all

l_bullet = BulletTesla //bullet object type
And then, in SB, create a Tesla weapon and give it properties for the following variables:

l_colour2
l_width
l_amplitude
l_frequency
l_alpha1
l_alpha2
l_misswidth
l_missamp
l_missfreq

And the requisite loading stuff for BSF.

That should be everything. Any problems?
[img]http://i307.photobucket.com/albums/nn298/ChaosTheory100/Feather_Signature_Ice3.png[/img]
User avatar
Normandy
Vice Admiral
Vice Admiral
Posts: 1214
Joined: Thu Sep 27, 2007 2:34 am

Post by Normandy »

With the Teslas, are they bent by Roscharchs, being based off beam weapons? Just kind of curious, but too lazy to find out myself.
[url=http://www.fallingsandgame.com/][img]http://www.gaussianstudios.co.cc/hosting/fsgbanneram3.png[/img][/url]

tl;dr-ers will be shot on sight.
[size=75][url=http://bsf.wikidot.com/]BSF Wiki[/url]
"I have measured your 'fun', and science has quantitatively rated it a three." ~Lord Tim (Data Realms Fan Forums)[/size]
Kanosint
Commander
Commander
Posts: 187
Joined: Mon Feb 25, 2008 9:04 am

Post by Kanosint »

The sooner those are in, the better <3 Thunderbolt! >:3
T-002
Rear Admiral
Rear Admiral
Posts: 865
Joined: Mon Dec 03, 2007 9:51 pm
Location: Trying to get into someone's panties...

Post by T-002 »

Normandy, I love you.

Now there shall be no stopping our Soviet comrades.

It's like Red Alert all over :'D
[THIS SPACE FOR RENT]
User avatar
Arcalane
Pseudofeline Overlord
Posts: 4034
Joined: Thu Sep 13, 2007 10:37 am
Location: UK

Post by Arcalane »

Get your natter out of the dev notes thread, noobs. :roll:

CT: I'm having compile problems for the Step event in the Tesla. It hiccups at the bracket on line 74 position 10.
  /l、
゙(゚、 。 7
 l、゙ ~ヽ
 じしf_, )ノ
ChaosTheory
Vice Admiral
Vice Admiral
Posts: 1372
Joined: Tue Dec 11, 2007 1:31 pm
Location: Sunny California

Post by ChaosTheory »

Hmm. It appears the code tags still screw with the code when I use '<' and '>'.

Therefore, we try again:

http://docs.google.com/View?docID=dgf7t ... test&hgd=1

Just C/P the entire thing into the Step event. Success?

[Edit:] No, Norm, teslas are not bent by Rorshachs. A) that would look really weird, B) I have no idea how to code curving lightning.

Furthermore, when using this code, remember to have the KX Tesla plugin installed from here:

http://gmc.yoyogames.com/index.php?showtopic=287011
[img]http://i307.photobucket.com/albums/nn298/ChaosTheory100/Feather_Signature_Ice3.png[/img]
User avatar
Arcalane
Pseudofeline Overlord
Posts: 4034
Joined: Thu Sep 13, 2007 10:37 am
Location: UK

Post by Arcalane »

No, that's a private document, and I can't access it. I'd suggest putting it in a text file and emailing it to my MSN Messenger address, which is also my main email. I assume you can find the address on my profile page.

Ed: And I should remove the beam sprite from the tesla bullet, yes?
  /l、
゙(゚、 。 7
 l、゙ ~ヽ
 じしf_, )ノ
User avatar
Arcalane
Pseudofeline Overlord
Posts: 4034
Joined: Thu Sep 13, 2007 10:37 am
Location: UK

Post by Arcalane »

Okay, better... only one bug now;

Code: Select all

___________________________________________
ERROR in
action number 1
of End Step Event
for object BulletTesla:

Error in code at line 10:
       _deviation += random(l_owner.l_deviation) * l_deviationdir

at position 6: Unknown variable _deviation
  /l、
゙(゚、 。 7
 l、゙ ~ヽ
 じしf_, )ノ
User avatar
Arcalane
Pseudofeline Overlord
Posts: 4034
Joined: Thu Sep 13, 2007 10:37 am
Location: UK

Post by Arcalane »

Tesla bolts persist in being pink. Are they BGR as every other bloody example in BSF and apparently GM, or actually RGB?
  /l、
゙(゚、 。 7
 l、゙ ~ヽ
 じしf_, )ノ
User avatar
Arcalane
Pseudofeline Overlord
Posts: 4034
Joined: Thu Sep 13, 2007 10:37 am
Location: UK

Post by Arcalane »

th15 dropped by the BSFCE channel earlier and handed me code that would make something interesting;

Image

Code: Select all

[Thursday 30th] [16:55:57] <th15> var bullet;
[Thursday 30th] [16:55:58] <th15>                     bullet = instance_create(x,y,l_bullet)
[Thursday 30th] [16:55:58] <th15>                     bullet.depth = depth
[Thursday 30th] [16:55:58] <th15>                     bullet.speed = l_bulletspeed
[Thursday 30th] [16:55:58] <th15>                     bullet.direction = image_angle  - l_deviation + random(l_deviation2)
[Thursday 30th] [16:55:59] <th15>                     bullet.image_angle = bullet.direction
[Thursday 30th] [16:55:59] <th15>                     bullet.l_damage = l_damage
[Thursday 30th] [16:56:01] <th15>                     bullet.l_intercept = l_special2;
[Thursday 30th] [16:56:01] <th15>                     bullet.l_hitdamage = l_special3;
[Thursday 30th] [16:56:03] <th15>                     bullet.alarm[0] = l_timer
[Thursday 30th] [16:56:03] <th15>                     bullet.image_blend = l_bulletcol
[Thursday 30th] [16:56:05] <th15>                     bullet.sprite_index = l_bulletsprite
[Thursday 30th] [16:56:05] <th15>                     bullet.image_yscale = image_yscale;
[Thursday 30th] [16:56:07] <th15> in the railgun turret
[Thursday 30th] [16:56:08] <th15> find this block of code
[Thursday 30th] [16:56:29] <cycerin> i'll go do something else until the magic's happened
[Thursday 30th] [16:56:49] <th15> bullet = instance_create(x+lengthdir_x(15,image_angle+30),y+lengthdir_y(15,image_angle+30),l_bullet)
[Thursday 30th] [16:56:58] <th15> modify the bulletcreation line to use this
[Thursday 30th] [16:57:06] <th15> then copy the whole block again
[Thursday 30th] [16:57:11] <th15> for the 2nd bullet
[Thursday 30th] [16:57:16] <th15> but use image_angle-30 instead
[Thursday 30th] [16:57:20] <Arcalane> heh
[Thursday 30th] [16:57:30] <Arcalane> I'll try that later then
[Thursday 30th] [16:57:56] <Arcalane> just copy the block, paste it after the existing one?
[Thursday 30th] [16:58:01] * Latooni (~Latooni@Rizon-DB5FD232.dsl.sndg02.pacbell.net) has joined #BSFCE
[Thursday 30th] [16:59:07] <th15> find that blok
[Thursday 30th] [16:59:11] <th15> replace the instance create line
[Thursday 30th] [16:59:17] <th15> then copy it out for the 2nd bullet
[Thursday 30th] [16:59:28] <th15> but change it to image_angle-30 in both lengthdir calls
[Thursday 30th] [16:59:42] <Arcalane> everything from instance_create to yscale?
[Thursday 30th] [16:59:42] <th15> lengthdir projects the point in a given dirction and distance
[Thursday 30th] [16:59:54] <th15> so it moves the bullet creation point to an offset
[Thursday 30th] [16:59:56] <th15> yea
[Thursday 30th] [17:00:01] <Arcalane> alright, just making sure
  /l、
゙(゚、 。 7
 l、゙ ~ヽ
 じしf_, )ノ
Locked