Jump to content
IGNORED

cycle saving tips?


ultima

Recommended Posts

I worked a little more on it. This version has SIO2's fixes (except a couple). I was going to leave the pause feature out, but it works and SIO2 fixed it up better. So this version:

- ieposta's eliminate goto's where needed

- SIO2's new fixes

- my fixes (mostly killing more redundancy) added a vblank to _Timer

- I moved alot of code around to make space in bank2 for more music and also moved similar code together (like missile1)(collision code)

- Fixed a minor mechanic in firing the bow, if you release the fire button the shot will continue to travel to its normal max distance.

- The Maelstrom code was expanded so the enemy isn't spinning out of control (I do need to work on it more to tighten it up, but looks better now)

Edited by ultima
Link to comment
Share on other sites

Looking good there.

 

I am just imagining out loud here about what could be so just keep that in mind. It is your game Ultima so you decide what it will be.

 

My first thought is that the boss is awesome but could be harder to defeat. Also, the bat is kind of easy. Maybe the bat could dodge the arrow often but randomly not dodge it? Shooting a bat would be like swatting a fly - takes a bit of luck.

 

Second, a larger adventure could be created by having each level on a separate cartridge. Maybe each cart should have a victory code that the player can collect toward achieving some greater goal (like rescue a princess).

 

BTW, What is the purpose of the cake?

Edited by SIO2
Link to comment
Share on other sites

Looking good there.

Thanks the cycle counts are looking pretty good now with everyone's help.

 

I am just imagining out loud here about what could be so just keep that in mind. It is your game Ultima so you decide what it will be.

 

My first thought is that the boss is awesome but could be harder to defeat. Also, the bat is kind of easy. Maybe the bat could dodge the arrow often but randomly not dodge it? Shooting a bat would be like swatting a fly - takes a bit of luck.

I was working on the boss yesterday trying to get him to throw the ball at the player but couldn't get it right. The hope is once I get it working I can make it so the player has to dodge the fire until he goes into a certain animation frame where he can take damage, but that's what this game was about a platform to learn types of enemy AI. The bat was fixed in the latest version with a diagonal random variation of the maelstrom code(although I am still interested in how nintendo got the bat to slow down to a stop). I probably need to change something in how the enemies are assigned a type of AI but be able to switch to another behavior on a timer possibly, and certain enemies should be limited to only certain behaviors.

 

Second, a larger adventure could be created by having each level on a separate cartridge. Maybe each cart should have a victory code that the player can collect toward achieving some greater goal (like rescue a princess).

Neat idea, I had a thought to add 2 more dungeons and a overworld map to this game. I could use a password screen like the old Gameboy Castlevania games used with 4 icon boxes to enter the passcode in to start the next game with perks earned or to restore a current game.

 

BTW, What is the purpose of the cake?

I was thinking of this old joke until a functional item replaces itpost-36052-0-66623400-1471364480_thumb.png Maybe it will be the main goal to assemble the cake then defeat it?

 

I added the trick door on this version, I also pulled the zelda theme out (it sounded terrible)

 

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

I love optimizing code!

Since you've posted your .bas source, now you have a chance to learn some of my tricks :)

I've commented with rem in the source a lot and tried to tag them with ".iesposta"

 

This was just a quick first-pass, mostly removing "then goto" to just "then (__label)".

You must not have understood what I was talking about because these are the savings:

Bank 1 has 168 bytes ROM saved.

Bank 2 has 99 bytes saves. With "set optimization noinlinedata" the savings is 117. Easy to use, just make sure your data (like for music and room) only gets run over ONCE, you already had it correct, put at the end of a bank, or stick it between two gosub routines so it is called only once.

Bank 3 has 12 bytes of ROM saved. I didn't begin to optimize the sound, music...

 

There's a trick in: ; Clears all normal variables and the extras (fastest way). iesposta

It saves a tiny bit because that's the way it ends up in the .asm only more broken up and wasting ROM space.
I never had to do this in my programs, batari Basic starts off zeroing everything, but some programs rely on setting things back to zero.
There's a sneaky way to save ROM trick at: 1137 __SaveROM2 Using the routine above and below. You can put a label in a routine above (costs nothing) and then the next routine can use "then __SaveROM2" dropping the "goto" which all ends up in the end at the same "goto", but saves 2 bytes per dropped goto.
I was surprised this saved 13 bytes! I'm still learning things!
if _Room=3 && _Enemy=6 || _Enemy=15 then _Enemy=14
rem Moved above and combined. if _Enemy=6 && _Room=3 then _Enemy=14: if _Enemy=15 && _Room=3 then _Enemy=14
rem 13 byte savings.
post-29575-0-95538300-1472163479_thumb.jpg post-29575-0-31271500-1472163503_thumb.jpg

Teh_Legend_Fritz_18.bas

  • Like 3
Link to comment
Share on other sites

- added some fire to first boss

- added ieposta's optimized code (not all of it, some things in the game were not working correctly)

- removed 8-directional movement (the biggest hog of cycles was moving diagonally)

- arrows that hit walls stop

- adjusted enemy movement

- moved more code around (at a loss of cycles, still analyzing a clean pass from bank 1 through bank 8 with the least amount of redundancy)

 

469 bytes of ROM space left in bank 1

1253 bytes of ROM space left in bank 2
1721 bytes of ROM space left in bank 3
2770 bytes of ROM space left in bank 4
2246 bytes of ROM space left in bank 5
2139 bytes of ROM space left in bank 6
2932 bytes of ROM space left in bank 7
1205 bytes of ROM space left in bank 8
Edited by ultima
  • Like 1
Link to comment
Share on other sites

quick update still need to fix sound priority

moved code into more or less a straight line through the banks with little or no repetition saved 56 cycles

also added 8 directional movement back and the ability to shoot through walls, I'm thinking of using a constant to check if missiles go past borders instead

 

 

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

I updated this

-added a set of traps

-can collect the cake slices (work in progress)

-started work on the final cake boss (may be too large?)

-missiles stop at playfield borders

 

9/4/16 update

-reworked some parts of the enemys move, seems more stable and less blurry

Teh_Legend_of_Fritz 28.binTeh_Legend_of_Fritz 28.bas

Edited by ultima
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...