Jump to content
IGNORED

My 2k Game Experiment - Gate Racer


Atarius Maximus

Recommended Posts

Yep, it saved two bytes. Why? :)

When the variables of the same value are on one line it basically compiles to

store a register with zero and set variable a, b, c, d, e...

 

If it is on different lines it compiles to

store a register with zero, set variable a,

store a register with zero, set variable b,

store a register with zero, set variable c, etc.

 

Just a way to squeeze out bytes that can add up if you have a lot of the same values. (It doesn't have to be zero.)

It makes harder to read code, that's the trade off.

If a bunch of sprites start out at player0x = 40 : player1x = 40 : player2x = 40

That would save space, but then they are not next to their corresponding y values, player0y = 11

Sorry, I'm not too good a teacher explaining things. It always feels that I am confusing the point.

 

  • Like 1
Link to comment
Share on other sites

To nobody in particular... more techniques for squeezing rom in bB can be found here

 

There should be a companion topic on code optimization. Most of the time I don't run out of space - I run out of cycles. All I can think of right now:

 

* Only use GOSUBs on common but NOT time dependent code. Meaning things outside the main game loop.

* Learn to rely on things that reset automatically after drawscreen. For instance, REFPx resets after each DRAWSCREEN.

* Use boolean values wherever possible. If a value will always be either true or false you can use a single bit of a variable instead of the whole thing.

* it is OK to flip back to the beginning instead of processing every event (such as multiple collisions).

* Use a counter variable that increments once every game loop. You can use its bits for different alarms. Also, it can substitute an expensive rand call.

Link to comment
Share on other sites

There should be a companion topic on code optimization. Most of the time I don't run out of space - I run out of cycles. [...]

 

I like your points, especially using the counter as a frame-based scheduler... start a thread! I'm sure others will chime in with their tips, and you can update the first post with them.

Link to comment
Share on other sites

To nobody in particular... more techniques for squeezing rom in bB can be found here

That's a great thread. It should be pinned. :) I liked your coments too, loon. I've messed around with the code for Gate Racer a bit more, but I've decided to call the existing "final" version the actual final version. I liked Cybearg's idea about changing the oil slick to increasing velocity rather than jittering the car back and forth, but after much playtesting I've decided that I like the jittering back and forth better. The game is done. It will now be very hard to resist making a larger version with tons of customization options...
Link to comment
Share on other sites

  • 6 years later...
On 7/15/2019 at 1:12 PM, nooly said:

Very enjoyable little game. Maybe the engine sound could be less constant?

Last post before yours was in 2013 so he may have moved on to other projects.  The nice thing is he posted source so we all can play with the concept.  Feel free to get that better sounding er, sound effect in :)

 

The challenge here is not just finding a more appealing sound but also space as adding code to a 2k project usually means making room for it by reducing existing code.

Link to comment
Share on other sites

  • 2 weeks later...
On 7/23/2019 at 4:24 PM, Gemintronic said:

Last post before yours was in 2013 so he may have moved on to other projects.  The nice thing is he posted source so we all can play with the concept.  Feel free to get that better sounding er, sound effect in :)

 

The challenge here is not just finding a more appealing sound but also space as adding code to a 2k project usually means making room for it by reducing existing code.

Yep I noticed I'm a bit late with my comment... ;] He made it in ASM and that's a big no no as BB is challenging enough for me. Yeah it's pretty cool what he did in 2k, I have some trouble squeezing my little project in 4k.

Edited by nooly
  • Like 1
Link to comment
Share on other sites

@nooly:

 

I think most of the assembly he did was removing unused functions from bB to make that 2k.  Also, mini kernels for the display.  My hunch is that you could change this to 4k just fine.

 

But, looking at other peoples code often confuses me :)  I second just re-creating it yourself with your own improvements.

  • Like 2
Link to comment
Share on other sites

  • 2 months later...

I haven't been on the forums lately but noticed this just looking around.  Yeah, I made a few changes to bB to squeeze my changes into 2k, that was mostly the point of making this game and was the challenge that made it fun. :) The game itself was written completely in bB but the changes I made to bB to make it work were in assembly.  I also made a 4k version (Gate Racer 2) that added more options.  I haven't made a new bB game for years.  I need to come up with a new idea!

  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...