Jump to content
IGNORED

Gosub


atari2600land

Recommended Posts

Optimization: Attempt #1

195 bytes left in bank 1

792 bytes left in bank 2

 

I bet this could be cleaned up even more. Variables g, e and u are also free to use!

I tried to clean up and optimize the code, and there are now 294 (bank 1) and 1258 (bank 2) bytes free, but the title screen starts with difficulty 2 instead of difficulty 1, and I'm not sure why yet. You might not like what I did to the code-- I'm trying to take out all line numbers that aren't needed, and replace the referenced line numbers with more meaningful line labels, plus I'm trying to replace the 1-letter variable names with more descriptive dimmed variable names, and replace variables like x, y, w, and z with player0x, player0y, ballx, and bally (or whatever else they're being used for) as appropriate. The big savings in bank 2 are primarily from defining arrays or data tables that contain the starting player0x, player0y, ballx, and bally coordinates, so they can be set for each level by going to a common routine after the playfield is drawn for each level. There is a lot more I can do of this nature-- I just barely got started, but it's slow going since I'm trying to be careful not to break anything-- but I don't know if you'll be happy with the coding style. :? I'm trying to make it easier for me to understand, but I may be making it harder for you to understand, since you're already familiar with the line numbers and variables that you were using.

 

Michael

gosub010407a.bas

gosub010407a.bas.bin

Link to comment
Share on other sites

the title screen starts with difficulty 2 instead of difficulty 1, and I'm not sure why yet.

 

start_game

 

f=0 : j=0 : k=0 : r=0 : t=0 : missile1x=0 : missile1y=0 : timer=0 : c=0

a=1 : c{3}=0 : rem changed c{3}=1 to 0

 

As for the coding style, I don't know what half of it means. I'm surprised I wrote all that, I just put it into different terms. I think I can get used to it, though. You still have more to do on this?

Link to comment
Share on other sites

the title screen starts with difficulty 2 instead of difficulty 1, and I'm not sure why yet.

 

start_game

 

f=0 : j=0 : k=0 : r=0 : t=0 : missile1x=0 : missile1y=0 : timer=0 : c=0

a=1 : c{3}=0 : rem changed c{3}=1 to 0

 

As for the coding style, I don't know what half of it means. I'm surprised I wrote all that, I just put it into different terms. I think I can get used to it, though. You still have more to do on this?

Yes, if I'm going to optimize it, and make the code more self-explanatory by replacing the 1-letter variable names with more descriptive names, and by replacing the line numbers with descriptive routine names, etc., then it will probably take me at least another night (i.e., tonight after I get home-- I'm at my parents' right now, so I can't work on it right now), and maybe into tomorrow night.

 

If there's anything in particular that you don't understand, let me know what it is so I can try to explain it to you. :)

 

Michael

Link to comment
Share on other sites

How's the cleaning of my coding going? Thanks to you, I can add some more mazes. I've got a couple I've made (along with some Walter designed for me). And while you're working on the code, make it so the octopus stops once it touches the sub. You really need a free copy of the game or something since you're helping me out so much. I can't thank you enough.

Link to comment
Share on other sites

How's the cleaning of my coding going? Thanks to you, I can add some more mazes. I've got a couple I've made (along with some Walter designed for me). And while you're working on the code, make it so the octopus stops once it touches the sub. You really need a free copy of the game or something since you're helping me out so much. I can't thank you enough.

I changed something that screwed up the program, so rather than try to figure out what I needed to do to fix it, I just went back to the previous version that I posted, and made a couple of changes to it.

 

The octopus doesn't stop when it catches you-- it still chases you-- but it becomes visible when it's within 32 y pixels or 19 x pixels of the sub, and doesn't actually chase the sub until it's within 16 y pixels (as before) or 9 x pixels (which is a little less than before), so that sort of gives you a chance to dodge it as soon as it becomes visible. The reason I made the x and y pixel differences different than each other is because the pixels are wider than they are tall, so the x difference needs to be reduced to get more of an equal distance in the vertical and horizontal directions.

 

I didn't change the pixels of the octopus, as I'd suggested doing, because I actually like the way the octopus can be seen crossing the walls of the maze-- it sort of looks like a shadow, and helps you to avoid the octopus before getting too close.

 

By the way, I think you're probably going to want to change the sub to be player1, and change the octopus to be player0, because player0 can be on top of player1, but not vice versa-- so using player0 for the octopus, and player1 for the sub, will make it look more like the octopus is wrapped around the sub when they're colliding. You don't have to worry about making that change, I can do it for you. In the meantime, do whatever you want with this code, and I'll modify your updated code.

 

You might want to see if you can slow the octopus down just a little more, so the sub has a better chance of outrunning the octopus whenever it starts to chase the sub. Once the sub gets far enough away from it, the octopus loses interest and goes back to random swimming.

 

Michael

gosub010807.bas

gosub010807.bas.bin

Edited by SeaGtGruff
Link to comment
Share on other sites

the octopus moves a little slower and stops once it touches your sub. Tell me what you all think.

I haven't been able to try it yet, but one thing I'm a little leery of about having the octopus stop once it touches your sub is that it might be too easy for the sub to get away-- i.e., the octopus might become more of an annoyance than an actual potentially-deadly threat. I think a better solution might be as follows:

 

(1) The sub stops automatically moving whenever the octopus is touching it. The sub can still move, but the player must push the joystick to *make* the sub move, rather than the sub moving on its own as it normally does-- but it also moves more slowly than usual (if the player is pushing the joystick) while the octopus is touching any part of it.

 

(2) The octopus does *not* stop moving when it's touching the sub, but does move *much* more slowly than usual. If the sub is standing still (because the octopus has grabbed it, and the player hasn't started pushing the stick yet to try to move the sub away from the octopus), this should give the impression of the octopus slowly settling itself over and around the sub.

 

(3) The octopus doesn't crush the sub unless it is exactly overlapping the sub (i.e., has the same x and y coordinates as the sub), or is within only a couple of pixels either way of the sub. Also, if the sub doesn't move away, the octopus won't crush it as quickly as in the earlier versions of the game, because it's more realistic for the octopus to have to put great pressure on the sub for a while before the sub implodes. Since the octopus doesn't stop when it's touching the sub, but instead slows down a great deal, that should give the sub a chance to escape from the octopus's clutches, but without actually reducing the octopus to a mere annoyance.

 

(4) In fact, it might be good for the speed of the octopus to vary a bit based on how close it is to the sub, at least if it's within a certain number of pixels from the sub. Thus, the sub has a chance to maneuver away from the octopus, but the octopus should put up a pretty good chase while the sub is trying to get away.

 

Once I get home and can try your latest code, I'll see if I can get any of the above suggestions working, so you can see whether or not they function well. :)

 

Michael

Link to comment
Share on other sites

Once I get home and can try your latest code, I'll see if I can get any of the above suggestions working, so you can see whether or not they function well. :)

Well, I'm home now, but I just realized that you didn't post the source, so I'll just tinker with the last version I posted.

 

Michael

Link to comment
Share on other sites

Here's a better version with changes Mike suggested and one of my own. Player0 and player1 were switched, the octopus moves a little slower and stops once it touches your sub. Tell me what you all think.

 

 

When does the octopus come in to play as I went thru about a dozen screens and never saw him.Does it have to do with the dificulty switches at all?

Link to comment
Share on other sites

Here's a better version with changes Mike suggested and one of my own. Player0 and player1 were switched, the octopus moves a little slower and stops once it touches your sub. Tell me what you all think.

 

 

When does the octopus come in to play as I went thru about a dozen screens and never saw him.Does it have to do with the dificulty switches at all?

On the title screen, press SELECT, and the rightmost number will change from a 1 to a 2. Then press RESET to start the game, and the octopus will be there-- although you won't see him if he's too far away from you, except if he swims across the maze walls and you see his silhouette. :)

 

Michael

Link to comment
Share on other sites

Here's a better version with changes Mike suggested and one of my own. Player0 and player1 were switched, the octopus moves a little slower and stops once it touches your sub. Tell me what you all think.

 

 

When does the octopus come in to play as I went thru about a dozen screens and never saw him.Does it have to do with the dificulty switches at all?

On the title screen, press SELECT, and the rightmost number will change from a 1 to a 2. Then press RESET to start the game, and the octopus will be there-- although you won't see him if he's too far away from you, except if he swims across the maze walls and you see his silhouette. :)

 

Michael

 

 

 

 

Cool works much better and Thanks!

 

 

 

 

Sure hope to see this one make it to official cart release~

Link to comment
Share on other sites

Looks Great! One of hte problems i had was i coudnt escape from the octopus so i had to pray it woudnt come near me and avoid it. Perhaps im using a older build?

The 010907.bin version has the octopus stop once it reaches your sub so you have a chance to get away. Play that version and tell me if it's too easy, just right, or too hard.

Link to comment
Share on other sites

tell me if it's too easy, just right, or too hard.

 

Its a bit easy you can pass right through the octopus with out it killing you! Perhaps as the player progresses through the levels you can speed up the octopus and, over the course of many levels, get it to home in on the player improving its homing skills each level that passes. that would pose a greater threat

Link to comment
Share on other sites

Once I get home and can try your latest code, I'll see if I can get any of the above suggestions working, so you can see whether or not they function well. :)

Well, I'm home now, but I just realized that you didn't post the source, so I'll just tinker with the last version I posted.

 

Michael

I posted the latest source. How's the tinkering been going?

Link to comment
Share on other sites

Octopus: Maybe make it home in on the player when the player is close by and when the player escapes or dies have it wander off again and speed up it movment per level or naybe make it so you can touch the octopus a certain amount of times before you die.(healthbar for the ship?) these are just ideas im throwing around here

Edited by rheffera
Link to comment
Share on other sites

BUG: Unlimited Lives.. while playing normally in the current build in game mode 2 about the 3rd mase i kept crashing but never got the game over screen. the lives counter was stuck at 3. i tried to get some video footage of it but accidentaly closed stella in the process. :(. i have been unable to reproduce it since.

Link to comment
Share on other sites

BUG: Unlimited Lives.. while playing normally in the current build in game mode 2 about the 3rd mase i kept crashing but never got the game over screen. the lives counter was stuck at 3. i tried to get some video footage of it but accidentaly closed stella in the process. :(. i have been unable to reproduce it since.

Aw man, there is a secret code that gets you unlimited lives, maybe you discovered it by accident? At the title screen, press right and fire at the same time. I was debating whether to keep it there or remove it at the last second and have it be there just for testing purposes.

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...