CodeWalrus

Development => Calculators => Calc Projects, Programming & Tutorials => Topic started by: Ranman on March 06, 2017, 01:05:57 AM

Title: Jumpman Resurrected
Post by: Ranman on March 06, 2017, 01:05:57 AM
So... What ever happened to Jumpman for TI calcs?

Good question. 3 years ago, my hard drive crashed and the data was not recoverable. I had made a recent backup of all my TI projects on a USB thumb drive. Good idea right? Yes... but not if you lose that backup. I frantically searched for it a number of times over several years without success. Very depressing to think you've lost everything.

Well... a few weeks ago that USB stick turned up; and I have resurrected this project.

Here are some new screenshots of levels I have completed recently

(http://tifreakware.net/ranman/Jumpman/JM10002.gif)
Hot Foot

(http://tifreakware.net/ranman/Jumpman/JM10005.gif)
Dragon Slayer

(http://tifreakware.net/ranman/Jumpman/JM10004.gif)
Grand Puzzle II

(http://tifreakware.net/ranman/Jumpman/JM10009.gif)
Gun FIghter

(http://tifreakware.net/ranman/Jumpman/JM10010.gif)
Now You See It


I have 8 levels remaining to complete. Jumpman should be complete within 1 month. 8)
Title: Re: Jumpman Resurrected
Post by: p2 on March 06, 2017, 06:28:31 AM
Wow I'm glad you found your backup!! Also it looks really nice!   :thumbsup:
Is it for the 84+ or for a different family? :)
Title: Re: Jumpman Resurrected
Post by: aetios on March 06, 2017, 06:31:14 AM
Woah dude, glad to see you turn up again! Those levels look really cool and above all really fun, so I'm looking forward to a release :D
Title: Re: Jumpman Resurrected
Post by: Ranman on March 06, 2017, 07:20:48 AM
Quote from: p2 on March 06, 2017, 06:28:31 AM
Wow I'm glad you found your backup!! Also it looks really nice!   :thumbsup:
Is it for the 84+ or for a different family? :)
Thanks p2 for your kind comments. Jumpman is for the TI-89. It is coded in C using GCC4TI.

Quote from: aeTIos on March 06, 2017, 06:31:14 AM
Woah dude, glad to see you turn up again! Those levels look really cool and above all really fun, so I'm looking forward to a release :D
Thanks aeTIos!! Glad to be back. It's nice to see some old timers still hangin around. :)
Title: Re: Jumpman Resurrected
Post by: Dream of Omnimaga on March 07, 2017, 02:57:10 AM
I'm so glad to see this resurrected and that it was not completely lost. Nice work on this Ranman (https://img.codewalr.us/jumpii.gif)
Title: Re: Jumpman Resurrected
Post by: p2 on March 07, 2017, 08:56:10 AM
I really love the idea of the last level, even tho it looks pretty tricky xD
you don't maybe plan on making a clone for the CE or 84+ once you're done wit hthis...? 9_9
Title: Re: Jumpman Resurrected
Post by: Ranman on March 09, 2017, 01:23:53 PM
Thanks everybody.  :)

Here's a level called Ladder Challenge:

(http://tifreakware.net/ranman/Jumpman/JM10015.gif)

You have to move with the ladder a little bit or you will slowly slide up or down depending on the direction of the ladder. 
Title: Re: Jumpman Resurrected
Post by: p2 on March 09, 2017, 01:26:12 PM
xD it looks incredible hard to get off the ladder at the right moment xD
You should mke it possible to Jump off (actual jumping, not just falling) ^^

looks great  :thumbsup:
Title: Re: Jumpman Resurrected
Post by: Ranman on March 09, 2017, 01:36:37 PM
Quote from: p2 on March 09, 2017, 01:26:12 PM
xD it looks incredible hard to get off the ladder at the right moment xD
You should mke it possible to Jump off (actual jumping, not just falling) ^^

looks great  :thumbsup:

Thanks p2. The screenshot doesn't show everything. It's hard to get a small screenshot with all movements. You can jump on and off the ladder at will... You can even walk on to and off of the ladder from a girder.. You can also climb up and down while on the ladder.
Title: Re: Jumpman Resurrected
Post by: Dream of Omnimaga on March 09, 2017, 05:52:51 PM
That ladder looks hard to climb! O.O
Title: Re: Jumpman Resurrected
Post by: Ranman on March 10, 2017, 06:10:26 AM
Quote from: DJ Omnimaga on March 09, 2017, 05:52:51 PM
That ladder looks hard to climb! O.O

Thanks DJ!!  :)

Here's another level... Going Down?

(http://tifreakware.net/ranman/Jumpman/JM10018.gif)

12 of 12 Jumpman Jr levels completed.
24 of 30 Jumpman levels completed.

6 levels remaining. :D
Title: Re: Jumpman Resurrected
Post by: Dream of Omnimaga on March 10, 2017, 06:11:50 AM
That looks very good. Do the moving platforms there work yet? I heard they can be hard to get to work in games. Glad to see most levels finished :)
Title: Re: Jumpman Resurrected
Post by: Ranman on March 10, 2017, 06:17:29 AM
Quote from: DJ Omnimaga on March 10, 2017, 06:11:50 AM
That looks very good. Do the moving platforms there work yet? I heard they can be hard to get to work in games. Glad to see most levels finished :)
Thanks DJ. All of the moving platforms work... and yes... they were difficult to implement and to get working properly.
Title: Re: Jumpman Resurrected
Post by: Ranman on March 11, 2017, 01:26:17 PM
Another level... this one is called Roll Me Over.

Nothing too fancy... just two barrels rolling around.

(http://tifreakware.net/ranman/Jumpman/JM10019.gif)

5 levels to go. :thumbsup:
Title: Re: Jumpman Resurrected
Post by: Dream of Omnimaga on March 11, 2017, 06:51:20 PM
How can barrels move up ladders? O.O

Also this definitively reminds me of Donkey Kong :P
Title: Re: Jumpman Resurrected
Post by: p2 on March 11, 2017, 09:01:26 PM
looks weird and amazing at the same time xD
are their paths randomly chosen or predefined and looping? :)
Title: Re: Jumpman Resurrected
Post by: Ranman on March 11, 2017, 09:20:04 PM
Quote from: DJ Omnimaga on March 11, 2017, 06:51:20 PM
How can barrels move up ladders? O.O

Also this definitively reminds me of Donkey Kong :P

Thanks DJ.  :D  Yeah I agree... It is a little weird to see a barrel move up a ladder. Did you notice them move up chains too?

Donkey Kong has nothing on Jumpman.  8)

Quote from: p2 on March 11, 2017, 09:01:26 PM
looks weird and amazing at the same time xD
are their paths randomly chosen or predefined and looping? :)

Thanks p2.  :D

The barrels' paths are predefined using waypoints. When the end of the waypoint list is reached, it starts over -- loops indefinitely.
Title: Re: Jumpman Resurrected
Post by: p2 on March 12, 2017, 07:03:35 AM
you should think about letting new barrels enter the map on a high level on the left or right side of the screen, so they then roll around, eventually fall down the ladders, and finally leave the screen on the bottom of the map through the sides again :) (so they go downwards only)
that would look more natural ^^
Title: Re: Jumpman Resurrected
Post by: Ranman on March 13, 2017, 12:40:01 AM
Quote from: p2 on March 12, 2017, 07:03:35 AM
you should think about letting new barrels enter the map on a high level on the left or right side of the screen, so they then roll around, eventually fall down the ladders, and finally leave the screen on the bottom of the map through the sides again :) (so they go downwards only)
that would look more natural ^^

Thanks for your comments p2!! :D

Currently I'm attempting a faithful recreation of Jumpman from the C64 version. I agree that barrels should not climb up ladders and ropes... it is kind of weird, but that is what the original did.

Once I finish, I can always make additional levels and include your good idea.  :thumbsup:

I'm also considering making a level editor or at the very least write some instructions with some BAT scripts for users to create their own level sets.   8)
Title: Re: Jumpman Resurrected
Post by: Ranman on March 13, 2017, 06:36:55 AM
Here is another level... it is called Freeze.

The enemies chase you down. They cannot kill you. But if they touch you, you are frozen for a short period of time. You only have to worry about bullets being fired at you.  :banghead:

(http://tifreakware.net/ranman/Jumpman/JM10020.gif)

Only 4 levels remaining.... of which there is 2 more enemies and one special feature to implement. Almost there... 8)
Title: Re: Jumpman Resurrected
Post by: p2 on March 13, 2017, 08:37:22 AM
That makes me wonder... (sorry to sound stupid) but what's the target? What do you have to do to clear a level... ??? reaching a special point on the mp or something? ^^
Title: Re: Jumpman Resurrected
Post by: Ranman on March 13, 2017, 01:42:11 PM
Quote from: p2 on March 13, 2017, 08:37:22 AM
That makes me wonder... (sorry to sound stupid) but what's the target? What do you have to do to clear a level... ??? reaching a special point on the mp or something? ^^

That is a good question. Once you collect all of the required number of bombs (the little white circles) for a particular level, then the level is complete and you move to the next. Grand Puzzle 2 has collectable jewels... they count toward the number of bombs collected.

Levels can have anywhere between 1 and 16 bombs. Some levels have more bombs than are necessary to complete the level.

Some levels like Runaway have bombs that move around. Some levels have bombs that have bonus points tied to them.

Here is a screenshot of Robots III:

(http://tifreakware.net/ranman/Jumpman/JM0099.gif)

It shows Jumpman completing a level as well as completing the game (note: this is not actually the final level of the game). You'll notice there are 2 high score lists... One for highest score and one for highest bonus. So... completing a level fast is rewarded with bonus points.

Edit... At the bottom of the screen you'll see:

JUMPEN:06 - this is the number of your players remaining
L:01 = this is the level number you are playing
S:5 = this is the current speed of the game. This will be from 1 to 5, 1 being the fastest.
B:1500 = this is the current bonus points. This number decrements periodically. Finish the level and you get these points added to your score.
SCORE: this is your current score.
Title: Re: Jumpman Resurrected
Post by: Dream of Omnimaga on March 13, 2017, 03:33:21 PM
Looks good, as always. :) Also the level editor would be a nice addition to extend this game life. :)
Title: Re: Jumpman Resurrected
Post by: Ranman on March 16, 2017, 01:48:39 PM
Another level completed. This one is called Figurit, and is a puzzle level with lots of disappearing pieces. Don't get trapped by an inadvertent bomb collection.  :banghead: :blah:

Figurit was in included in the original Jumpman; and Figurit's Revenge was included in Jumpman Jr.

(http://tifreakware.net/ranman/Jumpman/JM10022.gif)

3 levels remaining. :w00t:
Title: Re: Jumpman Resurrected
Post by: p2 on March 16, 2017, 02:15:23 PM
dow long does it take // how much work is it for you to complete each level? :)
I'm curious especially as u have to add new units and mechanics for almost every level, but yet push them on a daily basis xD
Title: Re: Jumpman Resurrected
Post by: Ranman on March 16, 2017, 02:52:15 PM
Quote from: p2 on March 16, 2017, 02:15:23 PM
dow long does it take // how much work is it for you to complete each level? :)
I'm curious especially as u have to add new units and mechanics for almost every level, but yet push them on a daily basis xD

Good questions p2 and thanks for your interest in my project. :)

Figurit took me about 4 hours to write. I already had bullets, scriptable bombs, and disappearing/appearing platforms working. So I only had to put all the pieces together. For me... the easy thing to do is watch youtube videos of someone playing Jumpman... and lots of pausing and rewinding the video.  :ninja:

For a level like Freeze... it required about 4 hours to put the platform pieces together. But then I had to implement a new enemy and a new special feature for that enemy which required a few days of thought and a few days to write/modify the code.

Title: Re: Jumpman Resurrected
Post by: Ranman on March 17, 2017, 03:02:19 AM
And another level... This one is called Jump--n-Run.

No enemies on this level; just simply finish as fast as you can. Watch out for those disappearing platforms. Plan your routes accordingly.   ;)

(http://tifreakware.net/ranman/Jumpman/JM10023.gif)

2 Levels remaining!   :w00t:

Btw... for those interested in what a Jumpman level looks like in C code:


{
"JUMP-N-RUN",
{
{  1, GAME_PIECE_Jumpman,     FLAG_VA,    19, 28,  SPECIAL_ABILITY_None},

{ 10, GAME_PIECE_Girder_Hor,  FLAG_VA,     0,  8,  6},
{ 11, GAME_PIECE_Girder_Down, FLAG_VA,     6,  9,  4},
{ 12, GAME_PIECE_Girder_Hor,  FLAG_VA,    10, 13,  2},
{ 13, GAME_PIECE_Girder_Up,   FLAG_VA,    12, 12,  4},
{ 14, GAME_PIECE_Girder_Hor,  FLAG_VA,    16,  8,  8},
{ 15, GAME_PIECE_Girder_Down, FLAG_VA,    24,  9,  4},
{ 16, GAME_PIECE_Girder_Hor,  FLAG_VA,    28, 13,  2},
{ 17, GAME_PIECE_Girder_Up,   FLAG_VA,    30, 12,  4},
{ 18, GAME_PIECE_Girder_Hor,  FLAG_VA,    34,  8,  6},

{ 20, GAME_PIECE_Girder_Hor,  FLAG_VA,     0, 28,  6},
{ 21, GAME_PIECE_Girder_Down, FLAG_VA,     6, 29,  4},
{ 22, GAME_PIECE_Girder_Hor,  FLAG_VA,    10, 33,  4},
{ 23, GAME_PIECE_Girder_Hor,  FLAG_VA,    17, 36,  6},
{ 24, GAME_PIECE_Girder_Hor,  FLAG_VA,    26, 33,  4},
{ 25, GAME_PIECE_Girder_Up,   FLAG_VA,    30, 32,  4},
{ 26, GAME_PIECE_Girder_Hor,  FLAG_VA,    34, 28,  6},

{ 30, GAME_PIECE_Girder_Hor,  FLAG_VA,     0, 52,  8},
{ 31, GAME_PIECE_Girder_Hor,  FLAG_VA,    32, 52,  8},

{ 40, GAME_PIECE_Girder_Hor,  FLAG_VA,     0, 70,  5},
{ 41, GAME_PIECE_Girder_Hor,  FLAG_VA,    10, 70, 20},
{ 42, GAME_PIECE_Girder_Hor,  FLAG_VA,    35, 70,  5},

{ 50, GAME_PIECE_Girder_Hor,  FLAG_VA,     0, 88, 40},

{ 60, GAME_PIECE_Rope_Down,   FLAG_VA,    10, 28, 12},
{ 61, GAME_PIECE_Rope_Down,   FLAG_VA,    28, 28, 12},

{ 70, GAME_PIECE_Rope_Up,     FLAG_VA,     0, 30,  5},
{ 71, GAME_PIECE_Rope_Up,     FLAG_VA,    12, 36,  8},
{ 72, GAME_PIECE_Rope_Up,     FLAG_VA,    26, 36,  8},
{ 73, GAME_PIECE_Rope_Up,     FLAG_VA,    38, 30,  5},

{ 80, GAME_PIECE_Ladder,      FLAG_VA,     0,  4,  6},
{ 81, GAME_PIECE_Ladder,      FLAG_VA,    38,  4,  6},

{ 82, GAME_PIECE_Ladder,      FLAG_VA,     0, 68,  5},
{ 83, GAME_PIECE_Ladder,      FLAG_VA,    38, 68,  5},

{ 84, GAME_PIECE_Ladder,      FLAG_VA,    19,  6,  4},
{ 85, GAME_PIECE_Ladder,      FLAG_VA,    19, 22,  1},
{ 86, GAME_PIECE_Ladder,      FLAG_VA,    19, 26,  1},
{ 87, GAME_PIECE_Ladder,      FLAG_VA,    19, 30,  5},
{ 88, GAME_PIECE_Ladder,      FLAG_VA,    19, 50,  2},
{ 89, GAME_PIECE_Ladder,      FLAG_VA,    19, 58,  3},

{ 90, GAME_PIECE_Ladder,      FLAG_VA,    16, 68,  5},
{ 91, GAME_PIECE_Ladder,      FLAG_VA,    22, 68,  5},

{100, GAME_PIECE_Bomb,        FLAG_VAS,   10,  9,120}, // execute script 120
{101, GAME_PIECE_Bomb,        FLAG_VAS,   28,  9,121}, // execute script 121

{102, GAME_PIECE_Bomb,        FLAG_VA,     3, 24,  0}, //
{103, GAME_PIECE_Bomb,        FLAG_VAS,   10, 20,122}, // execute script 122
{104, GAME_PIECE_Bomb,        FLAG_VAS,   28, 20,123}, // execute script 123
{105, GAME_PIECE_Bomb,        FLAG_VA,    35, 24,  0}, //

{106, GAME_PIECE_Bomb,        FLAG_VAS,    2, 42,124}, // execute script 124
{107, GAME_PIECE_Bomb,        FLAG_VAS,   36, 42,125}, // execute script 125

{108, GAME_PIECE_Bomb,        FLAG_VA,     3, 74,  0}, //
{109, GAME_PIECE_Bomb,        FLAG_VAS,   10, 84,126}, // execute script 126
{110, GAME_PIECE_Bomb,        FLAG_VAS,   19, 84,127}, // execute script 127
{111, GAME_PIECE_Bomb,        FLAG_VAS,   28, 84,128}, // execute script 128
{112, GAME_PIECE_Bomb,        FLAG_VA,    35, 74,  0}, //

{120, GAME_PIECE_Script, FLAG_NONE, FLAG_NONE,  13,  0}, // make object 13 invisible
{121, GAME_PIECE_Script, FLAG_NONE, FLAG_NONE,  15,  0}, // make object 15 invisible
{122, GAME_PIECE_Script, FLAG_NONE, FLAG_NONE,  85,  0}, // make object 85 invisible
{123, GAME_PIECE_Script, FLAG_NONE, FLAG_NONE,  86,  0}, // make object 86 invisible
{124, GAME_PIECE_Script, FLAG_NONE, FLAG_NONE,  21,  0}, // make object 21 invisible
{125, GAME_PIECE_Script, FLAG_NONE, FLAG_NONE,  25,  0}, // make object 25 invisible
{126, GAME_PIECE_Script, FLAG_NONE, FLAG_NONE,  90,  0}, // make object 90 invisible
{127, GAME_PIECE_Script, FLAG_NONE, FLAG_NONE,  88,  0}, // make object 88 invisible
{128, GAME_PIECE_Script, FLAG_NONE, FLAG_NONE,  91,  0}, // make object 91 invisible

{140, GAME_PIECE_Bullet, FLAG_VA, 0, 0, BULLET_ACTION_HorzAndVert},
{141, GAME_PIECE_Bullet, FLAG_VA, 0, 0, BULLET_ACTION_HorzAndVert},
{142, GAME_PIECE_Bullet, FLAG_VA, 0, 0, BULLET_ACTION_HorzAndVert},
{143, GAME_PIECE_Bullet, FLAG_VA, 0, 0, BULLET_ACTION_HorzAndVert},

{ 0, 0, 0, 0, 0, 0}, // end of level marker
},
1500,13,0, // bonus start value = 1500, bombs required = 13
0,0,0,0,
false,
false,
},
Title: Re: Jumpman Resurrected
Post by: Dream of Omnimaga on March 17, 2017, 03:35:51 AM
Nice. Is there some sort of hidden timer that forces you to finish the level fast or is it due to enemy pattern or do platforms disappear automatically without stepping on them?
Title: Re: Jumpman Resurrected
Post by: Ranman on March 17, 2017, 03:54:59 AM
Quote from: DJ Omnimaga on March 17, 2017, 03:35:51 AM
Nice. Is there some sort of hidden timer that forces you to finish the level fast or is it due to enemy pattern or do platforms disappear automatically without stepping on them?
Every level has a (hidden) timer for the bonus point decrementer. You are not required to finish a level quickly unless you want bonus points.

You can add a GAME_PIECE_Timer to a level, and when it decrements to zero it can execute a script.

You can also (see the code in my previous post) make GAME_PIECE_Bomb scriptable by setting the 'S' flag and providing the GAME_PIECE_Script object number. When Jumpman picks up a bomb it will execute the script. Right now only collectable objects and timers can have scripts attached to them. So... currently stepping on a platform all by itself will not execute a script... this could change in the future if this feature is desired.

Most of the platform pieces you'll see above have the FLAG_VA... this the 'V' and 'A' flags ORed together. V = visible. A = active. If those flags are both set to '0' (or FLAG_NONE) then the platform piece is no longer visible nor active. Each one of the scripts in the code above clear both V & A flags of the objects they point to -- thereby making them disappear.
Title: Re: Jumpman Resurrected
Post by: Dream of Omnimaga on March 17, 2017, 04:21:27 PM
You should have a level where after 10 seconds, one block disappears every second like the Super Mario World rhinoceros mini bosses
Title: Re: Jumpman Resurrected
Post by: Ranman on March 17, 2017, 04:56:37 PM
Quote from: DJ Omnimaga on March 17, 2017, 04:21:27 PM
You should have a level where after 10 seconds, one block disappears every second like the Super Mario World rhinoceros mini bosses

That is a good idea. And it could be accomplished with the currently implemented code.   :thumbsup:
Title: Re: Jumpman Resurrected
Post by: Ranman on March 17, 2017, 10:03:41 PM
The Roost...

(http://tifreakware.net/ranman/Jumpman/JM10024.gif)

1 level remaining. :crazy:
Title: Re: Jumpman Resurrected
Post by: Dream of Omnimaga on March 17, 2017, 10:06:23 PM
Will the final level be beatable? :trollface:
Title: Re: Jumpman Resurrected
Post by: Ranman on March 17, 2017, 10:09:05 PM
Quote from: DJ Omnimaga on March 17, 2017, 10:06:23 PM
Will the final level be beatable? :trollface:

Of course... it will also have a level within a level that can only be reached safely at a certain time.  :-X
Title: Re: Jumpman Resurrected
Post by: p2 on March 19, 2017, 09:46:13 PM
that's actually an awesome idea:
making the last level unbeatable so noone realizes there are no levels after that :trollface:

Will you continue with userlevels after ur done or will this next one be the last piece of work u do for this projet? :/
Title: Re: Jumpman Resurrected
Post by: Ranman on March 19, 2017, 10:01:20 PM
Quote from: p2 on March 19, 2017, 09:46:13 PM
that's actually an awesome idea:
making the last level unbeatable so noone realizes there are no levels after that :trollface:

Will you continue with userlevels after ur done or will this next one be the last piece of work u do for this projet? :/

The last level called Grand Puzzle III is actually one of the easier levels to finish... Unless you're trying to find the bonus point bombs; then you'll have to find some way to make it to that level within the level.  :-X

I am planning on creating some type of level editor.
Title: Re: Jumpman Resurrected
Post by: Ranman on March 21, 2017, 04:27:40 AM
The final level called Grand Puzzle III is complete.

Sorry... no screenies of this one.  *.*   :ninja: :blah:
Title: Re: Jumpman Resurrected
Post by: p2 on March 21, 2017, 06:57:13 PM
Why no screenie? D: D:
Also nice job!!  :thumbsup:

doing the level editor next? :)
Title: Re: Jumpman Resurrected
Post by: Dream of Omnimaga on April 06, 2017, 05:24:10 AM
Glad to hear the level is done. I can't wait to give the game a try, even though I probably won't be able to reach high levels :P
Title: Re: Jumpman Resurrected
Post by: Lionel Debroux on May 15, 2017, 08:30:36 PM
Glad to read, belatedly, that you've finished making all levels :)
Title: Re: Jumpman Resurrected
Post by: Dream of Omnimaga on May 17, 2017, 10:25:18 PM
I think Ranman is doing a lot of work-related traveling, which explains his recent absence, but I saw him recently on IRC. Hopefully he has time to get back in action soon :)
Title: Re: Jumpman Resurrected
Post by: Ranman on September 08, 2017, 02:04:53 AM
Oh boy... lotsa real life things going on in my life. DJ is right... a lot of work related travel, work on the Town Car, work on the apartment, and a new position at work.

But i have not forgotten about Jumpman.

I'll try to post a status update soon.
Title: Re: Jumpman Resurrected
Post by: Dream of Omnimaga on October 23, 2017, 12:53:07 PM
So how is it going now? :)
Title: Re: Jumpman Resurrected
Post by: Ranman on October 24, 2017, 10:57:55 AM
Thanks for asking xlibman.   :)

I've been playing each level and checking for bugs. So far... I have gone through 20 levels and found a couple of minor issues. No show stoppers yet.  :)


Edit...

Made it through all the levels... 4 minor issues noted. Hope to have them corrected this weekend.  :)

Time to get this puppy released :banghead:
Title: Re: Jumpman Resurrected
Post by: Ranman on October 29, 2017, 05:40:27 AM
My Jumpman project for the TI-89 is complete. I will be releasing within the next day or two.   :w00t:
Title: Re: Jumpman Resurrected
Post by: Lionel Debroux on October 29, 2017, 07:12:08 AM
Great :)
TI-68k programs are scarce nowadays, so it could arguably be featured wherever you post it. The ticalc.org POTY time is nearing ;)
Title: Re: Jumpman Resurrected
Post by: Dream of Omnimaga on October 29, 2017, 12:35:32 PM
Awesome to see this released. :3= I wonder if I got spare batteries to try it when it comes out...
Title: Re: Jumpman Resurrected
Post by: Ranman on October 31, 2017, 04:52:00 AM
Jumpman 89 v1.00 is complete and I have uploaded it to Ticalc.  :w00t:
Title: Re: Jumpman Resurrected
Post by: Lionel Debroux on October 31, 2017, 07:36:27 PM
I'm now looking at the project, and I have several optimization suggestions :)
* first and foremost: unless you experience issues with optimized compilation, which is very infrequent, you should compile with optimization (-Os compiler flag), which, besides speeding up the program, also saves a fantastic amount of space ;)
* on top of that, the -fomit-frame-pointer -mregparm=5 compiler flags save some more space;
* you really should dynamically allocate 5 huge variables: external_level_buffer (jm_levels.c) and the four LCD_SIZE'd variables from jm_graphics.c. You can allocate a single block and play with pointer arithmetic a bit. Currently, they get stored in BSS, but BSS suck for both size and speed efficiency - both directly, because of inefficient instructions + relocation information, and indirectly, because they can prevent from making other optimizations. Getting rid of BSS for most programs I worked on, not just TICT programs, was a major win.
* for now, using compressed relocations and compressed references for BSS saves some more space. When the above variables are dynamically allocated, the BSS becomes small enough to merge with the main executable, and compressed BSS references are moot.
* you used the old, large version of IsVTI(); the newest version can be found inline in e.g. https://github.com/debrouxl/gcc4ti/blob/next/trunk/tigcc/archive/gray.s or in https://github.com/debrouxl/gcc4ti/blob/next/trunk/tigcc/archive/hw_version.s ;
* in GraySetScreenColor_R(): 1) move.l #0xffffffff,%d0 / %d5 would be much better as moveq #-1,%d0 / % d5, 2) the andi.l instructions would be smaller and faster as moveq to an additional register followed by and.l, 3) the cmpi.b instructions might be redundant because the andi.l (with a single-bit mask) already sets the CCR flags, 4) you should use explicit short branches;
* in GraySingleSprite8_COLOR_R(): 1) cmpi.w #0,%d4 is better written as tst.w %d4 (and you could even avoid the tst.w %d4 if you load d6 before loading d4), 2a) given that you're not using the upper part of d5, you should use moveq # instead of move #, 2b) in fact you could replace everything between __GraySingleSprite8_R__Test_WHITE and __GraySingleSprite8_R__Test_Finish by a single lsr.w #3,%d4 instruction (and thereby avoid using d5 at all), 3) you should use an explicit .l on the adda, 4) you should use explicit short branches.

This computer doesn't have GCC4TI binaries, I'll have to build them... or use the other computer's binaries.

On my side, the current build stats for jumpman are:
  Program Variable Size:                    45249 Bytes
  BSS Size:                                 47878 Bytes
  Absolute Relocs:                          712
  Natively Emitted Relocs:                  2
  Relocs Removed by Branch Optimization:    299
  Relocs Removed by Move Optimization:      211
  Relocs Removed by Test Optimization:      5
  Space Saved by Range-Cutting:             1110 Bytes
Title: Re: Jumpman Resurrected
Post by: Lionel Debroux on November 01, 2017, 08:59:42 AM
I proceeded with manual allocation of the 5 aforementioned large buffers, changing the declaration to pointers instead of arrays, adding the EXTERNAL_LEVEL_BUFFER_SIZE define, and adding -mno-bss to the compiler flags.

The current diff is as follows:
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_bullets.c Jumpman_89_v1.0/jm_bullets.c
--- Jumpman_89_v1.0_orig/jm_bullets.c 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_bullets.c 2017-11-01 08:58:48.421104022 +0100
@@ -110,10 +110,10 @@ void DrawBullets(void)

void UpdateBullets(void)
{
- static int1 spear_y_offset[18]      =  {-2,-2,-1,-1, 0,-1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 2, 2, 3}; //der may need to update this
- static int1 hailstone_x_offset[10]  =  { 0, 1, 1, 2, 2, 1, 1, 0, 0, 0};
- static int1 hailstone_y_offset[10]  =  {-2,-1,-1, 0, 0, 1, 1, 2, 1, 1};
- static int1 zig_zag_xy_offset[32]   =  { 1, 1,-1,-1,-1,-1, 1, 1};
+ static const int1 spear_y_offset[18]      =  {-2,-2,-1,-1, 0,-1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 2, 2, 3}; //der may need to update this
+ static const int1 hailstone_x_offset[10]  =  { 0, 1, 1, 2, 2, 1, 1, 0, 0, 0};
+ static const int1 hailstone_y_offset[10]  =  {-2,-1,-1, 0, 0, 1, 1, 2, 1, 1};
+ static const int1 zig_zag_xy_offset[32]   =  { 1, 1,-1,-1,-1,-1, 1, 1};
BULLET_OBJECT_Type* bullet = &bullet_list[0];
uint1 speed;
uint1 direction;
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_collectables.c Jumpman_89_v1.0/jm_collectables.c
--- Jumpman_89_v1.0_orig/jm_collectables.c 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_collectables.c 2017-11-01 08:59:06.213472323 +0100
@@ -734,4 +734,4 @@ void ModifyPlatformObject(OBJECT_Type* o
y += 4;
}
}
-}
\ Pas de fin de ligne à la fin du fichier
+}
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_enemies.c Jumpman_89_v1.0/jm_enemies.c
--- Jumpman_89_v1.0_orig/jm_enemies.c 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_enemies.c 2017-11-01 09:28:00.657375227 +0100
@@ -39,7 +39,7 @@ uint1 GetAIType3Move(ENEMY_OBJECT_Type*

ENEMY_OBJECT_Type enemy_list[ENEMY_COUNT_MAX];

-ENEMY_OBJECT_Type enemy_definition_list[] =
+const ENEMY_OBJECT_Type enemy_definition_list[] =
{
{
GAME_PIECE_Falling_Bomb,
@@ -2337,4 +2337,4 @@ uint1 GetAIType3Move(ENEMY_OBJECT_Type*


return temp_direction;
-}
\ Pas de fin de ligne à la fin du fichier
+}
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_enemies.h Jumpman_89_v1.0/jm_enemies.h
--- Jumpman_89_v1.0_orig/jm_enemies.h 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_enemies.h 2017-10-31 21:29:43.997428638 +0100
@@ -134,7 +134,7 @@ extern ENEMY_OBJECT_Type enemy_list[ENEM
extern int2 enemy_count;


-extern ENEMY_OBJECT_Type enemy_definition_list[];
+extern const ENEMY_OBJECT_Type enemy_definition_list[];


void DrawEnemies(void);
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_graphics.c Jumpman_89_v1.0/jm_graphics.c
--- Jumpman_89_v1.0_orig/jm_graphics.c 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_graphics.c 2017-11-01 08:48:41.604542948 +0100
@@ -25,19 +25,19 @@

#include "jm_graphics.h"

-#include "j3.h"
+#include "J3.H"
#include "j7.h"
-#include "j8.h"
+#include "J8.H"

uint1* plane_visible_0;
uint1* plane_visible_1;
uint1* plane_active_0;
uint1* plane_active_1;

-uint1 visible_plane_0[LCD_SIZE];
-uint1 visible_plane_1[LCD_SIZE];
-uint1 active_plane_0[LCD_SIZE];
-uint1 active_plane_1[LCD_SIZE];
+uint1 * visible_plane_0;
+uint1 * visible_plane_1;
+uint1 * active_plane_0;
+uint1 * active_plane_1;

uint1 jumpman_bkgd_0[12];
uint1 jumpman_bkgd_1[12];
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_graphics.h Jumpman_89_v1.0/jm_graphics.h
--- Jumpman_89_v1.0_orig/jm_graphics.h 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_graphics.h 2017-11-01 08:48:33.304371135 +0100
@@ -27,10 +27,10 @@ extern uint1* plane_visible_1;
extern uint1* plane_active_0;
extern uint1* plane_active_1;

-extern uint1 visible_plane_0[LCD_SIZE];  // *30+8
-extern uint1 visible_plane_1[LCD_SIZE];
-extern uint1 active_plane_0[LCD_SIZE];
-extern uint1 active_plane_1[LCD_SIZE];
+extern uint1 * visible_plane_0;  // *30+8
+extern uint1 * visible_plane_1;
+extern uint1 * active_plane_0;
+extern uint1 * active_plane_1;

extern uint1 jumpman_bkgd_0[12];
extern uint1 jumpman_bkgd_1[12];
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_jumpman.c Jumpman_89_v1.0/jm_jumpman.c
--- Jumpman_89_v1.0_orig/jm_jumpman.c 2017-10-30 20:03:20.000000000 +0100
+++ Jumpman_89_v1.0/jm_jumpman.c 2017-11-01 09:42:20.247168695 +0100
@@ -111,6 +111,16 @@ void _main(void)
pSprites1 = j3;
pSprites2 = j7;

+ external_level_buffer = malloc(EXTERNAL_LEVEL_BUFFER_SIZE + 4 * LCD_SIZE);
+ if (!external_level_buffer)
+ {
+ return;
+ }
+ visible_plane_0 = external_level_buffer + EXTERNAL_LEVEL_BUFFER_SIZE;
+ visible_plane_1 = visible_plane_0 + LCD_SIZE;
+ active_plane_0 = visible_plane_1 + LCD_SIZE;
+ active_plane_1 = active_plane_0 + LCD_SIZE;
+
plane_visible_0 = &visible_plane_0[0]; // 8*30
plane_visible_1 = &visible_plane_1[0]; // 8*30
plane_active_0  = &active_plane_0[0]; // 8*30
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_levels.c Jumpman_89_v1.0/jm_levels.c
--- Jumpman_89_v1.0_orig/jm_levels.c 2017-10-30 20:03:20.000000000 +0100
+++ Jumpman_89_v1.0/jm_levels.c 2017-11-01 09:16:06.862599710 +0100
@@ -167,7 +167,7 @@ LEVEL_Type current_level;
int2 level_number;
bool level_complete;
uint1 level_toggle_bits;
-uint1 external_level_buffer[30*1024 + 256];
+uint1 * external_level_buffer;



@@ -248,7 +248,7 @@ void DrawSelectScreen(void)
char* file_name;
char* name;
register uint4 file_address;
- char file_type[] = "jml";
+ static const char file_type[] = "jml";

GrayFillScreen(COLOR_Black);
SwapPlaneBuffers();
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_levels.h Jumpman_89_v1.0/jm_levels.h
--- Jumpman_89_v1.0_orig/jm_levels.h 2017-10-30 21:22:42.000000000 +0100
+++ Jumpman_89_v1.0/jm_levels.h 2017-11-01 09:21:13.856954478 +0100
@@ -175,6 +175,8 @@ extern bool level_complete;
extern int2 level_number;
extern LEVEL_Type current_level;
extern LEVEL_Type level[];
+#define EXTERNAL_LEVEL_BUFFER_SIZE (30*1024U + 256)
+extern uint1 * external_level_buffer;

extern uint1 level_toggle_bits;
extern uint4 level_toggle_girders_count;
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_objects.h Jumpman_89_v1.0/jm_objects.h
--- Jumpman_89_v1.0_orig/jm_objects.h 2017-10-30 21:22:54.000000000 +0100
+++ Jumpman_89_v1.0/jm_objects.h 2017-10-31 21:15:59.896355639 +0100
@@ -294,4 +294,5 @@ OBJECT_Type* GetNextObjectEntry(void);
void ResetIndexByType(void);


-#endif
\ Pas de fin de ligne à la fin du fichier
+#endif
+
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_platforms.c Jumpman_89_v1.0/jm_platforms.c
--- Jumpman_89_v1.0_orig/jm_platforms.c 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_platforms.c 2017-11-01 09:28:31.206007583 +0100
@@ -24,6 +24,7 @@
#include "FontUtils.h"

#include "jm_platforms.h"
+#include "jm_bullets.h"
#include "jm_moving_platforms.h"
#include "jm_objects.h"
#include "jm_graphics.h"
@@ -313,9 +314,9 @@ void DrawPlatformLevel(void)

bool girder_check_row[12];
bool ladder_check_row[12];
-bool ladder_check;
-bool chain_check;
-bool rope_check;
+bool ladder_check = 0;
+bool chain_check = 0;
+bool rope_check = 0;
int2 ladder_rung_index = 0;
int2 skip_rope_check = 0;
int2 skip_chain_check = 0;
@@ -528,22 +529,6 @@ bool CheckJumpmanGirderRow(int2 y1, int2
}


-bool CheckJumpmanLadder(void)
-{
- return CheckJumpmanLadderRow(2, 8);
-}
-
-bool CheckJumpmanChain(void)
-{
- return chain_check;
-}
-
-bool CheckJumpmanRope(void)
-{
- return rope_check;
-}
-
-
/*
void Illuminate()
{
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_platforms.h Jumpman_89_v1.0/jm_platforms.h
--- Jumpman_89_v1.0_orig/jm_platforms.h 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_platforms.h 2017-10-31 21:34:58.507944389 +0100
@@ -27,17 +27,31 @@

extern int2 skip_rope_check;
extern int2 skip_chain_check;
+extern bool ladder_check;
+extern bool chain_check;
+extern bool rope_check;


void ConstructPlatformLevel(void);
void DrawPlatformPiece(uint1 value, uint1 flags, int2 x, int2 y);
void ModifyPlatformPiece(uint1 value, uint1 new_flags, int2 x, int2 y);
void DrawPlatformLevel(void);
-bool CheckJumpmanLadder(void);
bool CheckJumpmanLadderRow(int2 y1, int2 y2);
+inline bool CheckJumpmanLadder(void)
+{
+ return CheckJumpmanLadderRow(2, 8);
+}
bool CheckJumpmanGirderRow(int2 y1, int2 y2);
-bool CheckJumpmanChain(void);
-bool CheckJumpmanRope(void);
+inline bool CheckJumpmanChain(void)
+{
+ return chain_check;
+}
+
+inline bool CheckJumpmanRope(void)
+{
+ return rope_check;
+}
+
void CheckPlatformInteractions(DIR_Type direction);
void Illuminate();
void Hotfoot();
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_scores.c Jumpman_89_v1.0/jm_scores.c
--- Jumpman_89_v1.0_orig/jm_scores.c 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_scores.c 2017-10-31 21:45:38.941212319 +0100
@@ -115,7 +115,7 @@ HIGH_SCORES_Type high_scores_list =

void ReadHighScores(void)
{
- char file_name[] = "jms";
+ static const char file_name[] = "jms";
uint4 file_address;

file_address = (uint4)OpenFile(file_name);
@@ -128,7 +128,7 @@ void ReadHighScores(void)

void SaveHighScores(void)
{
- char file_name[] = "jms";
+ static const char file_name[] = "jms";
uint4 file_address;

UnarchiveFile(file_name);
@@ -152,7 +152,7 @@ void SaveHighScores(void)
void DrawFinalScores(void)
{
char buffer[32];
- char line_12[] = "~~~~~~~~~~~~";
+ static const char line_12[] = "~~~~~~~~~~~~";

GrayUserDrawStr(80-(11*4/2),20, "TOTAL SCORE", COLOR_White, 0x00);
GrayUserDrawStr(80-(12*4/2),31, line_12, COLOR_White, 0x00);
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_scores.h Jumpman_89_v1.0/jm_scores.h
--- Jumpman_89_v1.0_orig/jm_scores.h 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_scores.h 2017-10-31 21:16:24.052856092 +0100
@@ -55,4 +55,5 @@ void ReadHighScores(void);
void SaveHighScores(void);


-#endif
\ Pas de fin de ligne à la fin du fichier
+#endif
+
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_titlescreen.c Jumpman_89_v1.0/jm_titlescreen.c
--- Jumpman_89_v1.0_orig/jm_titlescreen.c 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/jm_titlescreen.c 2017-10-31 21:46:35.106375900 +0100
@@ -36,7 +36,7 @@


// Titlescreen
-OBJECT_Type titlescreen_object_list[13] =
+static const OBJECT_Type titlescreen_object_list[13] =
{
{ 1, GAME_PIECE_Jumpman,    FLAG_VA, 19, 20,  SPECIAL_ABILITY_None},

@@ -58,7 +58,7 @@ OBJECT_Type titlescreen_object_list[13]
};


-LETTER_Type  letter_list_orig[7] =
+static const LETTER_Type  letter_list_orig[7] =
{
{156,18,1,1},
{156,18,2,2},
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jm_utilities.h Jumpman_89_v1.0/jm_utilities.h
--- Jumpman_89_v1.0_orig/jm_utilities.h 2017-10-30 21:23:04.000000000 +0100
+++ Jumpman_89_v1.0/jm_utilities.h 2017-10-31 21:15:56.312281387 +0100
@@ -107,4 +107,5 @@ void ResetAutoQuit(void);
uint2 CalculateVpc(uint2* address, int2 size);
bool IsVpcValid(uint2* address, int2 size, uint2 vpc);

-#endif
\ Pas de fin de ligne à la fin du fichier
+#endif
+
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/jumpman.tpr Jumpman_89_v1.0/jumpman.tpr
--- Jumpman_89_v1.0_orig/jumpman.tpr 2017-10-30 23:00:34.000000000 +0100
+++ Jumpman_89_v1.0/jumpman.tpr 2017-11-01 09:46:55.888874464 +0100
@@ -6,11 +6,11 @@ Use Data Variable=0
Data Variable=
Copy Data Variable=1
Copy Data Variable if Archived=1
-Pack=1
+Pack=0
Packed Variable=jumpman
Project Name=jm
-GCC Switches=-Wall -W -Wwrite-strings -ffunction-sections -fdata-sections
-GNU Assembler Switches=
+GCC Switches=-Os -fomit-frame-pointer -mregparm=5 -Wall -W -Wwrite-strings -ffunction-sections -fdata-sections -mno-bss -I. -Iutils -IExtGraph-b02b924/lib -Igfx
+GNU Assembler Switches=--all-relocs
Assembler Switches=-g -t
Debug Info=0
Standard Library=1
@@ -38,9 +38,9 @@ Use PreOS=0
Minimum AMS Version Defined=1
Minimum AMS Version=1.00
Unofficial OS Support=0
-Reloc Format=AMS
+Reloc Format=Compressed
ROM Call Format=Direct
-BSS Ref Format=Kernel
+BSS Ref Format=Compressed
Data Ref Format=Kernel
Use F-Line Jumps=0
Use 4-Byte F-Line Jumps=0
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/utils/BasicTypes.h Jumpman_89_v1.0/utils/BasicTypes.h
--- Jumpman_89_v1.0_orig/utils/BasicTypes.h 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/utils/BasicTypes.h 2017-10-31 21:15:25.495642956 +0100
@@ -83,4 +83,5 @@ typedef struct



-#endif // _BasicTypes
\ Pas de fin de ligne à la fin du fichier
+#endif // _BasicTypes
+
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/utils/BasicUtils.c Jumpman_89_v1.0/utils/BasicUtils.c
--- Jumpman_89_v1.0_orig/utils/BasicUtils.c 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/utils/BasicUtils.c 2017-10-31 21:48:17.676500857 +0100
@@ -15,9 +15,3 @@

#include "BasicUtils.h"

-
-int2 RandomNumber(int2 MaximumNumber)
-{
- // generate a random 16 bit integer between 0 and MaximumNumber
- return random(MaximumNumber);
-}
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/utils/BasicUtils.h Jumpman_89_v1.0/utils/BasicUtils.h
--- Jumpman_89_v1.0_orig/utils/BasicUtils.h 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/utils/BasicUtils.h 2017-11-01 09:00:12.306840452 +0100
@@ -16,7 +16,11 @@

#include "BasicTypes.h"

-int2 RandomNumber(int2 MaximumNumber);
+inline int2 RandomNumber(int2 MaximumNumber)
+{
+ // generate a random 16 bit integer between 0 and MaximumNumber
+ return random(MaximumNumber);
+}

extern short IsVTI(void);

@@ -24,4 +28,5 @@ extern short IsVTI(void);
#define BOUNDS_COLLIDE_UTIL(x0, y0, x1, y1, w0, w1, h0, h1) \
  ((x0 < (x1 + w1)) && ((x0 + w0) > x1) && (y0 < (y1 + h1)) && ((y0 + h0) > y1))

-#endif // _BasicUtils
\ Pas de fin de ligne à la fin du fichier
+#endif // _BasicUtils
+
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/utils/GrayUtils.h Jumpman_89_v1.0/utils/GrayUtils.h
--- Jumpman_89_v1.0_orig/utils/GrayUtils.h 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/utils/GrayUtils.h 2017-10-31 21:15:41.271969796 +0100
@@ -74,4 +74,5 @@ extern void GrayClipSingleSprite16_COLOR
     register void *dest1 asm("%a1"))
     __attribute__((__stkparm__));

-#endif // _GrayUtils
\ Pas de fin de ligne à la fin du fichier
+#endif // _GrayUtils
+
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/utils/KeyUtils.h Jumpman_89_v1.0/utils/KeyUtils.h
--- Jumpman_89_v1.0_orig/utils/KeyUtils.h 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/utils/KeyUtils.h 2017-10-31 21:16:42.997248566 +0100
@@ -89,4 +89,5 @@ int2 ConvertKeyPressToNumber(KeyboardInp



-#endif // _KeyboardUtils
\ Pas de fin de ligne à la fin du fichier
+#endif // _KeyboardUtils
+
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/utils/TimeUtils.c Jumpman_89_v1.0/utils/TimeUtils.c
--- Jumpman_89_v1.0_orig/utils/TimeUtils.c 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/utils/TimeUtils.c 2017-10-31 21:52:14.033397491 +0100
@@ -66,21 +66,3 @@ void InitTimer(uint2 timer, uint4 millis
KillTimer(USER_TIMER); // TIOS requires to free the timer prior to use
OSRegisterTimer (timer, timerValue); // Auto-Int 5 is triggered 20 times per second
}
-
-uint2 CheckTimer(uint2 timer)
-{
- if (OSTimerExpired (timer))
- return 1;
- else
- return 0;
-}
-
-void RestartTimer(uint2 timer)
-{
- OSTimerRestart (timer);
-}
-
-void KillTimer(uint2 timer)
-{
- OSFreeTimer (timer);
-}
\ Pas de fin de ligne à la fin du fichier
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/utils/TimeUtils.h Jumpman_89_v1.0/utils/TimeUtils.h
--- Jumpman_89_v1.0_orig/utils/TimeUtils.h 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/utils/TimeUtils.h 2017-10-31 21:52:10.033314620 +0100
@@ -21,9 +21,19 @@
void Sleep(uint4 milliseconds);

void InitTimer(uint2 timer, uint4 milliseconds);
-void KillTimer(uint2 timer);
-void RestartTimer(uint2 timer);
-uint2 CheckTimer(uint2 timer);
+inline void KillTimer(uint2 timer)
+{
+ OSFreeTimer (timer);
+}
+inline void RestartTimer(uint2 timer)
+{
+ OSTimerRestart (timer);
+}

+inline int2 CheckTimer(uint2 timer)
+{
+ return OSTimerExpired (timer);
+}
+
+#endif // _TimerUtils

-#endif // _TimerUtils
\ Pas de fin de ligne à la fin du fichier
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/utils/TrigUtils.c Jumpman_89_v1.0/utils/TrigUtils.c
--- Jumpman_89_v1.0_orig/utils/TrigUtils.c 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/utils/TrigUtils.c 2017-10-31 21:53:50.999406347 +0100
@@ -45,7 +45,7 @@ int1 iCos(int2 angle)

int1 iSin(int2 angle)
{
- float sinValue;
+ int1 sinValue;

if (angle < 0)
{
diff -Naurp '--exclude=*.89z' '--exclude=*.9xz' '--exclude=*.v2z' '--exclude=*.89y' '--exclude=*.a' '--exclude=extgraph.h' Jumpman_89_v1.0_orig/utils/TrigUtils.h Jumpman_89_v1.0/utils/TrigUtils.h
--- Jumpman_89_v1.0_orig/utils/TrigUtils.h 2017-10-30 19:58:34.000000000 +0100
+++ Jumpman_89_v1.0/utils/TrigUtils.h 2017-10-31 21:16:45.189293978 +0100
@@ -23,4 +23,5 @@ int1  iCos(int2 angle);
int1  iSin(int2 angle);


-#endif // #ifndef _TrigUtils
\ Pas de fin de ligne à la fin du fichier
+#endif // #ifndef _TrigUtils
+


Comments on this diff:
* the newlines at ends of files prevent noisy warnings;
* the -I GCC switches in jumpman.tpr are just a way to adapt to building with tprbuilder, which requires working around the "virtual folders" misfeature of the IDE. You can ignore them;
* the case changes in #include lines make it possible to build on platforms with case-sensitive filesystems (*nix), so you should take them;
* the Pack=0 in jumpman.tpr is just to avoid severe console spam by ttpack when using the compiler and linker in verbose mode, you should ignore that line;
* the functions inlined into the headers are a leftover from the point I was trying to haggle down on the size, before noticing that the build was performed without optimization. I left them because they slightly help;
* making "jml", "jms", line_12 strings constant shaves dozens of bytes per instance;
* the -l flag can be passed to GNU as, provided jm_levels.c (instead of jm_levels.h) is #include'd by jm_jumpman.c to influence section reordering by the linker in such a way that UnpackBuffer is close enough to DrawSelectScreen, but... it only shaves several dozen bytes overall, so I rolled back these changes.

The program stats have become:
  Program Variable Size:                    45907 Bytes
  Absolute Relocs:                          442
  Natively Emitted Relocs:                  0
  Relocs Removed by Branch Optimization:    298
  Relocs Removed by Move Optimization:      439
  Relocs Removed by Test Optimization:      34
  Relocs Removed by Calc Optimization:      12
  Space Saved by Range-Cutting:             1658 Bytes

Unsurprisingly, Jumpman is yet another instance of using BSS being a bad thing (remove -mno-bss from the compiler flags and compare the program variable size + bss size, as well as the number of relocations)... TIGCC 0.95 brought a wealth of useful capabilities, but that one, despite being one of the most requested features formerly provided only by "kernels", is just bad in most situations.
Title: Re: Jumpman Resurrected
Post by: Ranman on November 01, 2017, 11:20:57 AM
Thanks soooo much Lionel.

Let me ponder each very good point you made before I ask any questions.

I tried the -Os all by itself... it saved 10Kb all by itself AND made Jumpman about twice as fast.

I'll touch base with you again.
Title: Re: Jumpman Resurrected
Post by: Ranman on November 07, 2017, 03:58:15 AM
For Lionel...

I implemented your suggestions. The -Os switch did cause me some problems... specifically it made the DrawSelectScreen function very fragile. I had to add some defensive coding to get it working again; but still it seems like even minor change to the function would break it again. It is working now. The -Os switch also resulted in my Sleep function no longer delaying for the specified amount of milliseconds (it was getting optimized out)... this gave the appearance that Jumpman was 100% to 200% faster. I ended adding some asm("NOP") to ensure my delay loop would not get optimized.

I did not implement the inlines that you suggested. I did not realize the BSS section resulted in such unoptimized calls. Thanks for pointing that out.

Thank you for your suggestions to make Jumpman even better.

I also corrected a few minor bugs:
- enemy collision detection was intentionally disabled for testing purposes but was unintentionally included in the release.... whoops :-[
- tightened up the collision detection with bullets and collectables
- corrected the version string to v1.01

Update coming soon  ;D
Title: Re: Jumpman Resurrected
Post by: Lionel Debroux on November 07, 2017, 06:36:20 AM
Don't worry, few people realize how much BSS suck. Getting rid of BSS is one of the optimizations I performed most often on other authors' programs, so BSS removal ended up being more clearly featured in my TICT S1P9 optimization tutorial :)

Usually, when code doesn't work with optimization turned on, it's a bug, so you were right to fix DrawSelectScreen.

Inlining the functions saved a bit of space, but much less than compiling with -Os + getting rid of BSS, so yeah, it's not that important to do so.

I produced no less than two releases of TI-Chess where I had left in an asm("0: bra.s 0b") infinite debugging loop, forgetting to restore collision detection is less of a problem than that :)

Did you switch to GCC4TI for building ? GCC4TI's SAVE_SCREEN support is 16 bytes smaller.

Oh, and for adding 92+/V200 support, you should use fully separate builds. Compatible builds with optimized calc consts are usually a disaster for optimization, too.
Title: Re: Jumpman Resurrected
Post by: Ranman on November 11, 2017, 03:39:48 PM
Today I uploaded Jumpman 89 v1.01 to Ticalc. It contains a lot of optimizations suggested by LIonel Debroux and some minor corrections to the game engine.

Jumpman 89 v1.01
  - added optimizations suggested by Lionel Debroux (thank you Lionel)
  - corrected version string (V1.00 was released with the version string set to v0.95)
  - corrected enemy collision detection (v1.00 was released with enemy collision detection unintentionally disabled)
  - increased accuracy of bullet and collectable collision detection

I also uploaded the Jumpman Jr level pack that consists of 12 new levels.
Title: Re: Jumpman Resurrected
Post by: Ranman on November 17, 2017, 01:40:12 PM
A few in the community have requested a version of Jumpman for the 92+ and V200 calculators. I am officially announcing that a version of Jumpman for the TI-92+ and V200 is now under construction.

Jumpman 92+ will support the keyboard layout differences. The graphics will remain unchanged but the playable area will be centered on the larger screen.