iesposta Posted March 2, 2013 Share Posted March 2, 2013 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. 1 Quote Link to comment Share on other sites More sharing options...
RevEng Posted March 2, 2013 Share Posted March 2, 2013 To nobody in particular... more techniques for squeezing rom in bB can be found here Quote Link to comment Share on other sites More sharing options...
+Gemintronic Posted March 2, 2013 Share Posted March 2, 2013 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. Quote Link to comment Share on other sites More sharing options...
RevEng Posted March 2, 2013 Share Posted March 2, 2013 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. Quote Link to comment Share on other sites More sharing options...
+Atarius Maximus Posted March 5, 2013 Author Share Posted March 5, 2013 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... Quote Link to comment Share on other sites More sharing options...
ACrystal2011 Posted March 5, 2013 Share Posted March 5, 2013 Gate Racer Advanced 1 Quote Link to comment Share on other sites More sharing options...
+Atarius Maximus Posted March 9, 2013 Author Share Posted March 9, 2013 Played for a while this morning and beat my high score on the final version, but barely. 2:14.8 is the new score to beat! Quote Link to comment Share on other sites More sharing options...
nooly Posted July 15, 2019 Share Posted July 15, 2019 Very enjoyable little game. Maybe the engine sound could be less constant? Quote Link to comment Share on other sites More sharing options...
+Gemintronic Posted July 23, 2019 Share Posted July 23, 2019 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. Quote Link to comment Share on other sites More sharing options...
nooly Posted August 7, 2019 Share Posted August 7, 2019 (edited) 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 August 7, 2019 by nooly 1 Quote Link to comment Share on other sites More sharing options...
+Gemintronic Posted August 7, 2019 Share Posted August 7, 2019 @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. 2 Quote Link to comment Share on other sites More sharing options...
+Atarius Maximus Posted October 31, 2019 Author Share Posted October 31, 2019 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! 3 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.