Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => HP Prime => Topic started by: MacBernick on December 12, 2013, 03:36:39 pm

Title: [WIP] Trailblazer Prime
Post by: MacBernick on December 12, 2013, 03:36:39 pm
Hi guys !

I'm trying to remake on the Prime an old 8 bits game called Trailblazer (http://youtu.be/rbP7-SILzs0?t=37s).

D-Pad for controls (left, right, accelerate, slow down),
[Enter] to jump,
[Esc] to quit.



Blue Circle : reverse Right/Left control.
Yellow Arrow : accelerate.
Green arrow : slow down.
White ...thing : free jump.
Green and brown plain tiles cancel reversed controls.

When falling into a hole, you get stopped for 2 sec then restart.

/!\ IMPORTANT /!\
For some (unknown) reasons, the jump routine game is broken on Virtual Calc. Please play on the real hardware.
Because of a stupid bug, be sure to be in degree mode before playing. Will be fixed ASAP.

UPDATE :

v0.0.7 is out.

changelog :

 Game Menu
 Track selection
 Track editor (no loading)
 Lot of minor adjustments
 More bugs !


Spoiler For Spoiler:
v0.0.6 is out.

changelog :

 Better textures,
 New attempt at embossing tiles, still need more work,
 Welcome screen,
 Starting lights,
 Finish line,
 You can only jump 5 times per run.

v0.0.5 is out.

changelog :

 Better graphics (run at about 25 FPS).
 Jump is back (broken on simulator).
 All types of tiles work now (including holes).
 Some kind of dashboard placeholder displaying current speed for now.
 New test track. Goodbye Hello World, hello Goodbye World !
 Falling animation is sometimes weird and need some more work.


v0.0.4 is out.

changelog :

 Far distance fade out nicely with background.
 Angle mode is now set to degrees at start and back to whatever it was when exiting.
 New PNG texture set
 One big textures for the whole track.
 Some tiles are functionals.


v0.0.2 is out.

changelog :
Decreased graphic quality to boost framerate (thanks to DJ Omnimaga).
Added a ball and some controls. Left and Right on D-Pad to move the ball, Up and Down to accelerate / slow down.
Added a framerate counter, disable it by setting showFPS (the very first EXPORTed variable in source code) to 0.
Cleaned up the code a bit to remove useless things, and added some comments.
The W now looks more like a W ^^
I still forgot to set those #*$! angles to degrees, please be sure to be in degree mode and not radians !

The ball sprite is just an ugly placeholder for now, I will do something better hopefully some day.

check the attached file.
Title: Re: [WIP] Trailblazer Prime
Post by: JWinslow23 on December 12, 2013, 03:40:15 pm
Feel free, not fell.

And it looks good!
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on December 12, 2013, 03:47:05 pm
Feel free, not fell.

And it looks good!

Thank you. I typed this a little fast and my english is not so good ^^
Title: Re: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on December 12, 2013, 09:23:54 pm
This looks very good and I'm glad to see more HP Prime development here now, especially games and such programs. I might give this a try on my calc later. Hopefully if it isn't fast enough there are ways to make it run faster. :)
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on December 12, 2013, 09:44:21 pm
Thank you. Well I'm doing the rest of the game for now, hoping that some optimization ideas will come to my mind (or from this forum ^^).
If not, I guess I will have to forget about raycasting and textures, and try some projection with FILLPOLY. It will raise other problems but well.. I'll find out !
Title: Re: [WIP] Trailblazer Prime
Post by: fb39ca4 on December 12, 2013, 10:32:53 pm
Are you calculating a lookup table for each pixel of the screen?
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on December 12, 2013, 10:36:01 pm
Wow I just tried this on calc and it's pretty impressive. What I notice is that in certain occasions it runs at a relatively good frame rate per calculator standards (being used to TI-84 Plus assembly games), but in other occasions, it suddenly slows down a lot. I would say that the frame rate varies between 4 and 10 FPS approximately. I didn't have time to check the code, but do you actually run through a tilemap then display each line at a different zoom to create some sort of mode 7 perspective? I was surprised to see the floor being textured with stuff other than plain squares.

Anyway good job so far. Hopefully there is a way to make the speed more consistent. :)

EDIT: For raycasters, at first it would be better IMHO to experiment with the RECT_P command or something, then maybe sprites.

Also I wonder if lowering the resolution would help? (for example, in my pseudo 3D program, I used a stretched up 160x120 GROB).

Also to distribute programs, you can go to C:\Users\<username>\AppData\Roaming\HP_Prime (or whatever HP Prime folder you currently use) then copy the .hpprgm from there into a zip file. :)
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on December 12, 2013, 11:29:24 pm
Are you calculating a lookup table for each pixel of the screen?

Not for each pixel. I use three tables :
rayTable stores the distance to the rendered plane for each screen line,
x1Table and x2Table are lists of lists of projected horizontal starts and ends of each square, for each screen line again.
Those are computed in init().


The track is stored in trackMatrix, it contains textures index for each square (0 for a hole).

Using rayTable and the camera position allows to find which row of trackMatrix is displayed at a given line. A modulo gives the texture line to display. x1Table and x2Table are then used in a BLIT_P to scale the texture line to achieve the projection.

Note that because the projection start from far to near (up to down, screenwise), the textures are actually reversed. I'll adress this later, if I'm to keep texturing anyway.

I hope it makes sense, it's not hard to understand, but not easy to explain ^^

Wow I just tried this on calc and it's pretty impressive. What I notice is that in certain occasions it runs at a relatively good frame rate per calculator standards (being used to TI-84 Plus assembly games), but in other occasions, it suddenly slows down a lot. I would say that the frame rate varies between 4 and 10 FPS approximately. I didn't have time to check the code, but do you actually run through a tilemap then display each line at a different zoom to create some sort of mode 7 perspective? I was surprised to see the floor being textured with stuff other than plain squares.

Anyway good job so far. Hopefully there is a way to make the speed more consistent. :)

EDIT: For raycasters, at first it would be better IMHO to experiment with the RECT_P command or something, then maybe sprites.

Also I wonder if lowering the resolution would help? (for example, in my pseudo 3D program, I used a stretched up 160x120 GROB).

Also to distribute programs, you can go to C:\Users\<username>\AppData\Roaming\HP_Prime (or whatever HP Prime folder you currently use) then copy the .hpprgm from there into a zip file. :)

Thanks for your feedback. I noticed framerate variations in sim also, I was hoping it wouldn't be the case on the real machine. I don't know from where it comes. Maybe some garbage collection. Note that the more holes (black squares) you have on screen, the less loops are done. May be an explanation too.

I first used lines to draw. If you uncomment the LINE_P call at line 63, and comment out the BLIT_P from line 64 to 73, you'll get the same with plain squares instead of textures. But with very little framerate improvement unfortunately. At least on the sim.

I know I can distribute the .hpprgm file, but I have nowhere to upload it ^^ Maybe I will try on my webserver for next release, it has very limited bandwidth but this is not a big file, I guess it should be OK.
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on December 12, 2013, 11:48:02 pm
If you click the Reply or quote button, below the text form you can upload files actually. Of course, at 40 posts you can also upload a link to the file in Omnimaga downloads section as well. Else, there is Cemetech, TI-Planet and Hpcalc.org, but Hpcalc.org can take about 6 months before approving your files.

EDIT: I modified your code so that instead of
Code: [Select]
FOR ray FROM 1 TO 119 DO
Code: [Select]
BLIT_P(G1, IP(x1Table(ray, col)), ray + 10, IP(x2Table(ray, col)), ray + 11, G2, texX1, texOffset, texX2, texOffset + 1);
I have the following:
Code: [Select]
FOR ray FROM 1 TO 119 STEP 4 DO
Code: [Select]
BLIT_P(G1, IP(x1Table(ray, col)), ray + 10, IP(x2Table(ray, col)), ray + 14, G2, texX1, texOffset, texX2, texOffset + 1);
Although the graphics don't look as great, it's a lot smoother and the frame rate seems consistent now.

At STEP 2, the framerate is pretty good as well and graphics aren't affected much, but you notice a slight drop in performance when there aren't any holes on the screen.


EDIT: This is how it looks like at 4 pixels intervals by the way:

(http://img.ourl.ca//trail.gif)

(Although I don't recall seeing all those weird single horizontal lines before on the real calc, so this must be the emulator's refresh rate. The white/gray tiles don't look great under such low resolution even on calc, though)
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on December 13, 2013, 03:46:25 am
Oh I thought the 40 posts limit applied to attached files too. I'll use it next time then, great !

You are basically dividing the vertical resolution by 4 here. Which is better than dividing it by 2 in both direction I think, because there is far more iterations in the vertical way than in horizontal. That's the kinds of thing I didn't want to do in the first place, because I wanted very readable symbols on the tiles. But I changed my mind about that. First, maybe instead of stretching a single texture line to 4 pixels high, actually blitting 4 lines of texture at once would maybe give a better visual result (but not sure about that though, have to test). Second... why readable symbols anyway ? Contrasted but fine 16 bits textures would be even nicer, and would not impact performance at all. Yes I think I will retain this solution. Need to clean up init() now because it is doing 4x more work it should do ^^

I've implemented your fix as is for the moment, plus some other features, updating the first post right now.
Title: Re: [WIP] Trailblazer Prime
Post by: Han on December 13, 2013, 09:41:05 am
If you click the Reply or quote button, below the text form you can upload files actually. Of course, at 40 posts you can also upload a link to the file in Omnimaga downloads section as well. Else, there is Cemetech, TI-Planet and Hpcalc.org, but Hpcalc.org can take about 6 months before approving your files.

You may also find the new forums at http://hpmuseum.org/forum a nice place to upload programs. And yes, hpcalc.org takes forever to do updates.

Nice programming, Omni!
Title: Re: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on December 13, 2013, 11:55:10 am
Actually Trailblazer isn't by me, but by MacBernick ;)

As for Hpmuseum I'm glad they're switching to a new forum. Hopefully this solves the weird registration problem that disallowed freemail. However, keep in mind that most people there are against calculator games (or any other kind of non-educational calculator program), so getting feedback that isn't directly related to the source code or regular calculator usage might be hard.


EDIT: Btw I tried the new version and nice improvements. I also like the shadow effect below the ball. :) You should probably move the level track to the bottom part of the screen and add some sky, though. :P

By the way, is it me or that game reminds me of Plain Jump for the 83+? It was a 3D-looking game where you jumped from platform to platform with a ball.
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on December 14, 2013, 01:54:53 pm
Thanks for your comments :)

I fixed some mistakes I made that cause heavy flickering and scrambled textures. I draw a new set of textures too, now they are 32x8 PNGs. The program is now about a quarter of its original size ;)

I'm going to implement jump and tile type look up before uploading new version. I attach a screenshot to show graphical improvements though. Oh and look at that framerate (on sim) !

See you !
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on December 14, 2013, 05:55:56 pm
Ooh that looks quite cool actually. :D Do you plan to add some animation or shadow for the ball?

Also, I like the gradient effect at the top. O.O Did it impact speed when adding it?
Title: Re: [WIP] Trailblazer Prime
Post by: Sorunome on December 14, 2013, 06:45:22 pm
Wha, this is looking pretty awesome, keep up the great work! :D
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on December 14, 2013, 08:37:59 pm
By the way, just a suggestion to complete my other post on the other page: Would it impact performance if under each floor tile just in front of holes, you added a small wall to give the effect of depth to each floor tile? That said, there would be the issue about diagonal walls, though >.<

EDIT: I got an idea: Just BLIT_P two copies of the race track (with 4 and 8 pixels offset vertically respectively) then apply a black polygon over it with 70% opacity, then display a 3rd copy of the race track on top of everything, with the ball and other stuff. Make sure to set empty spaces as the transparent color. This would be enough to give a depth effect:

(http://img.ourl.ca//tbsc.png)

Or you can display them at a slightly smaller zoom, but this would slow the game down.

EDIT 2: I just tried it on calc with your older program and I still get 16 FPS most of the time. However, keep in mind that that program wasn't full screen and I did not try with zooming.
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on December 14, 2013, 10:03:47 pm
You should probably move the level track to the bottom part of the screen and add some sky, though. :P
My first idea was to lower it a bit and add a starfield at the top, and the dashboard at the bottom. There's only two values to be modified in doRender() to do that (ray + 10 and ray +14). But a sky, as tiles now look (a bit) like mud and grass, why not...

Actually Trailblazer isn't by me, but by MacBernick ;)
By the way, is it me or that game reminds me of Plain Jump for the 83+? It was a 3D-looking game where you jumped from platform to platform with a ball.
I don't know the 83+ scene at all, but I wouldn't be surprised. This game is a 8 bits classic and there have been a lot of clones running on many plateforms.

Ooh that looks quite cool actually. :D Do you plan to add some animation or shadow for the ball?

Also, I like the gradient effect at the top. O.O Did it impact speed when adding it?
Yep I have plans to animate the ball, most likely rendering something quick in a few steps with Blender.

The code for the gradient is quite straightforward :

Code: [Select]
  FOR r FROM 10 to 20 DO
      FILLPOLY_P(G1, {{0, r}, {319, r}, {0, r + 1}, {319, r + 1}}, 0, (20 - r) * 255 / 10);
   END;

This FILLPOLY fuction seems to be really fast even with alpha blending, and only 10 iterations does not impact that much on performances. I can barely tell the difference on the virtual calc.

Wha, this is looking pretty awesome, keep up the great work! :D

Thank you :)

By the way, just a suggestion to complete my other post on the other page: Would it impact performance if under each floor tile just in front of holes, you added a small wall to give the effect of depth to each floor tile? That said, there would be the issue about diagonal walls, though >.<

EDIT: I got an idea: Just BLIT_P two copies of the race track (with 4 and 8 pixels offset vertically respectively) then apply a black polygon over it with 70% opacity, then display a 3rd copy of the race track on top of everything, with the ball and other stuff. Make sure to set empty spaces as the transparent color. This would be enough to give a depth effect:

(http://img.ourl.ca//tbsc.png)

Or you can display them at a slightly smaller zoom, but this would slow the game down.

EDIT 2: I just tried it on calc with your older program and I still get 16 FPS most of the time. However, keep in mind that that program wasn't full screen and I did not try with zooming.

I thought about some sort of gradient to give some deepness to the holes, but this is even better, you have great ideas for the game :) . Not sure if there is not something more efficient than drawing multiple copies of the track though. Maybe yet another precomputed table could easily store for which tiles  the last line of texture should be blended beneath.

I attach an intemrediate version here, since I was doing jump function when some friends suddenly came with beers so well... at least I started it ^^'
I'd be glad to know how framerate is improved on the real Prime.
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on December 14, 2013, 10:11:11 pm
Thanks, I'm happy to help (of course I can't help much on optimizing though, since I'm still new to this calc :P), anyway I like your ideas as well. Gonna try the new version soon. :)

By the way, here's the TI-85 Plain Jump game from 1996: http://www.ticalc.org/archives/files/fileinfo/12/1252.html

It was ported to the more popular 83+ by Sam Heald around 1999-2001.

By the way, thank you for using the directional pad for movement. That one Tetris clone for the HP Prime used the number pad and it's quite hard to control. XD
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on December 14, 2013, 10:48:46 pm
Yes a similar game exists on HP48 too, can't find it on hpcalc strangely. I can remember you could create and edit tracks by drawing it on a 5 pixels wide GROB, or something like that.


Looks like the simulator runs faster when freshly started than after some time running. Can't go more than 200 FPS now and I didn't modify the code that much.
Title: Re: [WIP] Trailblazer Prime
Post by: fb39ca4 on December 15, 2013, 12:38:31 am
Are you calculating a lookup table for each pixel of the screen?

Not for each pixel. I use three tables :
rayTable stores the distance to the rendered plane for each screen line,
x1Table and x2Table are lists of lists of projected horizontal starts and ends of each square, for each screen line again.
Those are computed in init().
Good. I had originally done the naive per pixel look up table when writing my Nspire mode 7 engine, but I also came across a similar method. Instead of storing the start and end positions for each scanline, I stored the start position and a vector to increment the position by each pixel. I don't know the performance penalties for different calculations in HP-BASIC, but a vector addition per pixel should be cheaper than a vector linear interpolation (which involves multiple additions and multiplications) each pixel, so you may want to try it.
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on December 15, 2013, 06:45:54 am
I see what you mean. But here, as screen lines are always parallels to lines of texels, the BLIT_P function of PPL does this for me even faster. Nothing is computed at pixel level in fact : BLIT_P scales and copies on screen a whole line of a tile at once.

One quick question : on the virtual calc, when you press two or more keys at the same time, only the last pressed key is actually active. Is it the case on the real calc too ? It could be a problem here since three keys could be pressed together if you want to accelerate, jump and move at the same time.
Title: Re: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on December 15, 2013, 12:06:45 pm
From what I remember, diagonal arrow keypresses work on the real calc, but I'm unsure if multiple keypresses where one or more of the keys isn't an arrow will work. The 84+ BASIC add-in xLIB had the same problem, where the only multiple keypresses supported were with arrows.

Btw I tried the last version on-calc and it ran at 14-16 fps. However I can't figure out what's the jump key. D:
Title: Re: [WIP] Trailblazer Prime
Post by: fb39ca4 on December 16, 2013, 12:24:52 am
I see what you mean. But here, as screen lines are always parallels to lines of texels, the BLIT_P function of PPL does this for me even faster. Nothing is computed at pixel level in fact : BLIT_P scales and copies on screen a whole line of a tile at once.
Ah, so it will scale the textels automatically for you? That's even better.
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on December 16, 2013, 10:39:16 am
From what I remember, diagonal arrow keypresses work on the real calc, but I'm unsure if multiple keypresses where one or more of the keys isn't an arrow will work. The 84+ BASIC add-in xLIB had the same problem, where the only multiple keypresses supported were with arrows.

Btw I tried the last version on-calc and it ran at 14-16 fps. However I can't figure out what's the jump key. D:

Mmm I was expecting a better framerate. PPL is cool because it has efficient native graphic functions, but I have this strange feeling that loops, tests and all this stuff are quite an overhead. There is still room for improvements in my program but I wonder if it will be enough... Going on anyway.

Jump was only partially implemented thus commented out. Now it's working, [Enter] is the key.

Ah, so it will scale the textels automatically for you? That's even better.

Yep, BLIT_P takes x1Table and x2Table values directly and do the job quite efficiently.

New version with jump attached on this post. Working on tile type detection at ball position for a new "major" release soon.
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on December 16, 2013, 11:21:29 am
Actually it seems like the version you posted now is 14 FPS only at the beginning of the track where there's no hole at all in the floor. I notice right now that in certain parts, such as the Hello World part, I get up to 23 FPS (I even peaked at 27 once). But yeah, when I made my HP 39gII Tunnel game, it seemed like for loops and some maths slowed my game down more than any complex graphics. That said, on the HP Prime, sprite scaling/zooming isn't very fast either. You can display like 10 BLIT commands that are 320x240 pixels large and barely see any speed difference, but the minute they are stretched up by one pixel, it gets much slower.

For 3D games I personally prefer just working on a 160x120 GROB then once I am done drawing everything there, I use BLIT_P(G0,0,0,320,240,G1,0,0,160,120). I wouldn't even mind doing using 96x64 stretched up to 288x192 with a frame around the screen for particularly complex 3D scenes with textures, since most people are used to old calculators with screens this small anyway.

That said, 15 FPS wouldn't be too bad per 3D standards IMHO, as long as it's not some sort of game where you move on ice and slip a lot, since it would then be very hard to control. For a plain jump game it would still be very enjoyable, plus some N64 games without the Expansion Pak sometimes ran at slower frame rate anyway (Mystical Ninja Starring Goemon, I'm looking at you).

By the way, to generate the floor, do you think that simply generating it in 2D with no stretching (with the textures displaying as 32x8 PNGs not stretched up) , then generating a 3D floor from it would be faster than calculating everything tile by tile?
I see what you mean. But here, as screen lines are always parallels to lines of texels, the BLIT_P function of PPL does this for me even faster. Nothing is computed at pixel level in fact : BLIT_P scales and copies on screen a whole line of a tile at once.
Ah, so it will scale the textels automatically for you? That's even better.
Yep, basically I'm pretty sure that anyone with the knowledge would be able to generate a raycaster from it and even with textures it would still run faster than the non-textured Lua one for the Nspire.

You can also do some interesting animations with BLIT_P scaling, like the fade in pixel effect and wavy text in http://img.ourl.ca//ssballfadein.gif , not to mention saving some space by displaying certain graphics larger than they really are.
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on December 16, 2013, 01:31:21 pm
Actually it seems like the version you posted now is 14 FPS only at the beginning of the track where there's no hole at all in the floor. I notice right now that in certain parts, such as the Hello World part, I get up to 23 FPS (I even peaked at 27 once). But yeah, when I made my HP 39gII Tunnel game, it seemed like for loops and some maths slowed my game down more than any complex graphics. That said, on the HP Prime, sprite scaling/zooming isn't very fast either. You can display like 10 BLIT commands that are 320x240 pixels large and barely see any speed difference, but the minute they are stretched up by one pixel, it gets much slower.

Let's call it Not Too Bad. Working on sim only is not ideal at all. Writing to Amazon right now to ask where the #@! my calc is stuck. Should have been here for one week at least now.

For 3D games I personally prefer just working on a 160x120 GROB then once I am done drawing everything there, I use BLIT_P(G0,0,0,320,240,G1,0,0,160,120). I wouldn't even mind doing using 96x64 stretched up to 288x192 with a frame around the screen for particularly complex 3D scenes with textures, since most people are used to old calculators with screens this small anyway.

That said, 15 FPS wouldn't be too bad per 3D standards IMHO, as long as it's not some sort of game where you move on ice and slip a lot, since it would then be very hard to control. For a plain jump game it would still be very enjoyable, plus some N64 games without the Expansion Pak sometimes ran at slower frame rate anyway (Mystical Ninja Starring Goemon, I'm looking at you).

What I'm thinking right now is that this machine would have enough horsepower to run the first Unreal full res @60fps... If only we could have access at least to some internal calls, a SysPPL just like we had SysRPL on the 48. Please HP, pretty pretty please ^^

Yep, basically I'm pretty sure that anyone with the knowledge would be able to generate a raycaster from it and even with textures it would still run faster than the non-textured Lua one for the Nspire.

You can also do some interesting animations with BLIT_P scaling, like the fade in pixel effect and wavy text in http://img.ourl.ca//ssballfadein.gif , not to mention saving some space by displaying certain graphics larger than they really are.

What I've done here is precalc raycasting for the vertical lookup already, and more traditional projection for the horizontal (no yaw control so no need for trigo here). The only knowledge to have is that, in a right rectangle(EDIT : triangle, obviously), TAN α = opposite / adjacent. And that's really it. Then it's a matter of playing with length and angles, and tedious optimization. I may write a how-to on the subject one day if people are interested. Be aware that a complete raycasting engine would not allow to precalc tables as much as here, so maybe don't expect more than 2 FPS ^^' (but lowering the resolution would have a better impact though).

By the way, to generate the floor, do you think that simply generating it in 2D with no stretching (with the textures displaying as 32x8 PNGs not stretched up) , then generating a 3D floor from it would be faster than calculating everything tile by tile?

Yes it would divide the number of iterations by 5. I'll definitely try it.


Other subject : I've just found out that TI has made some z80 based calc with machine language official support (yep, I didn't know... Maybe I'm too old for this stuff now ^^'). Are they still available ? As z80 ASM is the first I learned, and I was quite good at it well... more than 20 years ago, I'm pretty sure I could run this engine faster on the z80 than on the Prime ! I'm considering buying on maybe at the beginning of next year.
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on December 16, 2013, 01:47:51 pm
Well, if you don't live in United States, I sometimes noticed that Ebay and Amazon can take several weeks to ship. On Ebay it usually takes a month during holiday rushes. However, you better ask them in case. Did you buy it from a marketplace seller? Those aren't very trustable there.

I agree, however, that having to rely on a simulator isn't very reliable when testing for speed. Thankfully, the new HP Prime firmware improves transfers a lot so I can test new versions, but sometimes I get busy and can be several months without monitoring new threads (especially during summer) D:.

Regarding SysRPL, I suspect that someone could just take the OS files, modify them to add a new command then you could run assembly or C programs compiled using a computer. However, I don't know how hard it is and if anyone ever tampers with the exam mode, they'll feel HP's wrath in the form of anti-ASM/C patches like TI is doing with Ndless on the TI-Nspire. >.<


By the way a tutorial would definitively be nice. It could possibly be useful for people who code for different calc models as well. :)



As for TI calcs, the TI-83 Plus, TI-84 Plus and TI-84 Plus C Silver Editions are still available. They all natively supports ASM and there are ASM tools made to enhance TI-BASIC as well. The last one came out this year and has a color screen. They are 15 MHz (except the 83+ which is 6), but it seems like people can still do very good stuff on them. As for the 83+/84+ monochrome models, there is also Axe Parser available as a language, or Grammer.

And yeah I suspect that you could get some good speed from this engine on the monochrome models or in 160x240 mode on the color one, although some particularly complex stuff like fade-in/out might be much harder. Hopefully you don't stop making HP Prime programs in the future, though O.O
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on December 17, 2013, 11:05:00 pm
Hi !

Lot of work, finding time is hard at the moment. I made quickly a "one big grob for the whole track" version. Framerate seems more stable and higher. What do you think ?

Thanks for the info on TI z80. No I won't stop Prime dev, I have ideas for a few more games. But I really need to receive mine now. If I can't see how the timing goes by my eyes, gameplay will be terrible.
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on December 17, 2013, 11:59:41 pm
Yeah I understand what you mean about work. I just worked 8 days in a row and was exhausted this weekend, so I hardly felt like doing anything. Thankfully I am off tomorrow and Saturday, but Saturday I'll most likely be very exhausted >.< (and I think I work Sunday).

I'm gonna try the new version now. By the way, we really need to find a way to ensure that games run at the frame rate we want, in both the emulator and the real calc. I was thinking about using two TICK commands combined with a WAIT command, where the elapsed time for rendering is calculated, then the WAIT command pauses execution until it reaches a specific amount of time (from which the rendering time is substracted). It could also solve the issue about inconsistent speed in some programs.

Also yeah I hope you get your prime soon too. To be honest, I had the emu for a while but I did not feel like developing as much for it because I had to get Critor to test my programs before release and it wasn't as entertaining. I hope you didn't get ripped or anything. If that's the case, you mighjt need to report the seller and try to get a refund from Amazon then buy the calc from Hpcalc.org or something. I got mine from Hpcalc.org, although you might want to check the calc page to make sure it isn't backordered.


EDIT: WOAH! The new version runs at 38 FPS on calc! O.O (31-34 when holding down a key).

(http://img.ourl.ca//trailblazer003c.gif)

EDIT 2: If graphic quality is set to 2 pixels height, 31 FPS and if it's set at max resolution like the original version, 22 FPS.
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on December 18, 2013, 10:42:08 pm
Hey it seems to work not bad at all. Thanks again for feedback.
Updating first post with new versions, some tiles are working, but jump is disabled for now.
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on December 19, 2013, 12:30:38 am
I like the tiles ideas. :D I am curious about how it will be when we can fall off the track and die. :P

By the way, since this seems like an official game project, do you think we should move this topic to the HP Prime projects sub-forum at http://www.omnimaga.org/index.php?board=212.0 ? (Other calc projects and ideas->HP Prime)
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on December 19, 2013, 08:21:18 am
Thank you. I still have important things to do at work so my progress on this is slower and my answers shorter, one week to go like this I guess.

I don't know what's the best place to put it, just do as you think it is best. I came here in the first place because a search engine drove me to the Prime Hack thread, as people in this forum seem to be cool I decided to post my project here, but I admit I didn't think about where exactly it would fit best.

I spam amazon twice a day about my lost-in-post Prime, with no success atm. If I have no news in a few day I'll go for a refund and order it somewhere else. Oh and I saw a ti84-plus CSE at quite a good price (those little things are really expensive here in France) on another www site, I ordered it today too ^^ Is there any good (and accurate :p ) emulator for this one yet ? I tried a 84-plus SE (not C) emulator (was Wabbit the name ? something like that) that seems good, those two machines are quite compatible I guess ?
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on December 19, 2013, 09:14:39 am
Both are 15 MHz and have similar hardware except the hidden RAM (unless the 84+ you get is from before April 2007, where the hidden RAM, 128 KB, is identical). As for emulators, the only emulators I know of for the color model is jsTIfied (although it requires an high end computer) and I think that some recent versions of TilEm have color 84+ support too there, but it's lost somewhere on Cemetech forums.
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on December 27, 2013, 08:47:18 am
Hiii guys !

I have more time now, and my Prime is on its way to my home, should be here tomorrow or so, at last ! This game will soon be finished !

Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on December 27, 2013, 11:33:10 am
Glad to hear! Also did Amazon tell you that? I hope so. Also I heard that UPS had many delays over here lately, which caused much backlash from customers, so I assume that USPS and others did too.

Just a suggestion, though: Try to continue coding on the computer then when ready to test speed on calc, close the connectivity kit then connect the calc then send the file with the emulator (it takes several seconds). Otherwise, it's a bit annoying on the calculator because some symbols are harder to access and the editor kinda lags when the code is large. At least the HP Prime makes this much easier compared to TI calcs, because with TI calcs, most emulators lack the support to send directly to the calculator, so there are many steps required to test on a real calculator for those who code on the computer.
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on December 27, 2013, 09:32:30 pm
I had a refund from the Amazon vendor and I ordered a new one somewhere else.

Yes I'm going finish dev on computer before testing on calc, except when I'm not at home.

Right now I'm working on some stuff that does not require accurate timings like loading/ending screens, credits and things like that.
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on December 27, 2013, 10:09:36 pm
Oh ok that's good. IMHO I don't plan on ever ordering from Amazon vendors again. I had too many bad experiences with them compared to Ebay sellers.

Regardless, though, backup often. Losing progress every 5 minute is annoying and I see your program is getting a bit large, so inevitably the emulator might crash more.

Also for the title screen and stuff, do you plan to use some special effects like fade in/out? (see other thread)
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on January 03, 2014, 07:44:58 pm
New update :)

Yes I think I'd like some cool transitions like the ones you do.
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on January 03, 2014, 08:53:36 pm
I like the new track and graphics. It looks very nice. I also like how the ball appears below the track, it looks good when falling down. Also lol it's quite hard actually. Hopefully the final version has multiple levels with different difficulties. :P

Just a few things:

-Do you ever plan to move the track at the bottom of the screen and add a sky at the top with an HUD? It might look more polished/professional that way, else people might think the game was rushed if it remains with the bottom half of the screen nearly empty.

-If BLIT_P(G1,  xEnds(ray, 1),  ray + 20,  xEnds(ray, 2),  ray + 24,  G4, 0, (rayTable(ray) + camPosition) / 8, 160, (rayTable(ray) + camPosition) / 8, #FF00FF) is changed to BLIT_P(G1,  xEnds(ray, 1),  ray + 20,  xEnds(ray, 2),  ray + 22,  G4, 0, (rayTable(ray) + camPosition) / 8, 160, (rayTable(ray) + camPosition) / 8, #FF00FF), it could slightly improve speed, but then you lose the 3D effect. I would show you an idea to do a 3D effect, but sadly the emulator doesn't like my code (Whitespace bug). That said, I think my idea would be slower anyway (although it allowed the walls to be shaded).

-I get error invalid input at the end of the track.
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on January 03, 2014, 09:35:48 pm
I like the new track and graphics. It looks very nice. I also like how the ball appears below the track, it looks good when falling down. Also lol it's quite hard actually. Hopefully the final version has multiple levels with different difficulties. :P

Thanks. Yes the game is hard and this track is not the easiest. I will make a couple of tracks with growing difficulty, and I have some ideas to allow to easily create and share users tracks too, without me actually making a track editor. I will also slow down the overall speed of gameplay a little bit (not too much though). Also jumps won't be infinite in final game, about 4 to 6 available per run only.

Just a few things:

-Do you ever plan to move the track at the bottom of the screen and add a sky at the top with an HUD? It might look more polished/professional that way, else people might think the game was rushed if it remains with the bottom half of the screen nearly empty.

Yes, there will be a sky background (maybe with slowly scrolling clouds if it doesn't kill frame rate), with time, speed, and jumps left on it.


-If BLIT_P(G1,  xEnds(ray, 1),  ray + 20,  xEnds(ray, 2),  ray + 24,  G4, 0, (rayTable(ray) + camPosition) / 8, 160, (rayTable(ray) + camPosition) / 8, #FF00FF) is changed to BLIT_P(G1,  xEnds(ray, 1),  ray + 20,  xEnds(ray, 2),  ray + 22,  G4, 0, (rayTable(ray) + camPosition) / 8, 160, (rayTable(ray) + camPosition) / 8, #FF00FF), it could slightly improve speed, but then you lose the 3D effect. I would show you an idea to do a 3D effect, but sadly the emulator doesn't like my code (Whitespace bug).

Hmmm that's no 3D effects, that's just me forgetting to adjust the blit parameters ^^'
Thank you for pointing out.
I don't know yet if this effect will be added in the big track grob or in a render pass.

-I get error invalid input at the end of the track.

Yep, that's because tracks have no end yet, and this one is too short to trigger the loop point, which I didn't bother to modify because it will be kicked out soon.
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on January 03, 2014, 09:42:49 pm
Scrolling clouds would be nice I guess, but yeah I think frame rate might be an issue if there are two mode-7-like layers. I wonder... would it be hard to make it so the camera always follows the ball and that it's the race track that moves around like in Rad Racer for the NES, for example? This would allow larger tracks, but of course might slow the game down since this would mean extra columns of tiles being shown on the left and right far away.

As for the unintentional 3D effect, since it was unintentional, do you think you could bring back the 3D-like wall tiles there was in the previous version? Although they were not perfect, they still gave some sense of depth to the track. :)
Title: Re: [WIP] Trailblazer Prime
Post by: Han on January 03, 2014, 10:03:51 pm
You may be able to improve the speed by a large amount by switching to MAKELIST or MAKEMAT commands rather than appending elements to an existing list, etc.
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on January 03, 2014, 10:16:33 pm
In fact I had a simple horizontal scrolling in mind for the clouds, the frame rate wouldn't survive another projected scrolling for sure ^^'
Something like 2 blits with offset from a tileable clouds texture would be far enough I guess.

What you saw in previous version was an attempt to use the big track grob to render the 3D effect, with two issues : perspective is screwed up and using actual texture looked very bad because of far distance flickering. It would make more sense now that the resolution is doubled though.

The graphics could be improved further without any performance cost by using 32x16 textures instead of 32x8. But I don't know what is the grob size limit and if the big track grob could be doubled without limiting track length too much.

You may be able to improve the speed by a large amount by switching to MAKELIST or MAKEMAT commands rather than appending elements to an existing list, etc.

I was wondering if append() was really an efficient way to create my tables. Thanks for the tip. It won't change the speed of the game but certainly make the wait period a bit shorter which is always good.
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on January 03, 2014, 11:11:37 pm
I once had a 3200x3000 GROB and had no problem. However, in my pseudo 3D program, after running Spaceinvaders or certain other programs, I notice that BLIT often fails to render properly. It's most likely a calc bug, so sometimes you need to hit ON+SYMB. I guess the best way is to give it a try, then if you get reports from me about missing chunks of the map or erratic behavior after a long period with no soft reset, then bring back 32x8. I think it should be fine, though. The calc has several MB of RAM, after all. :P
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on January 11, 2014, 10:28:00 pm
Last minor snapshot (0.0.6) before major update !

The game is now fully playable, first post updated.

Next things to do :
graphics improvements (including but not limited to landscape, game logo, friendly time format, HUD, animated ball and more),
menus,
track selection,
user tracks creation and loading,
moar tracks !
powerups ?

Edit : my best time so far for this version is 21159 18361 18241 18188 18057 17570. (To myself : stop playing and go to bed dude !)
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on January 11, 2014, 10:47:36 pm
Ooh I like the new version!

Also suggestion for the next version: Make it so it saves our user settings at the start (Radian/Degree) then change the game to degree. The only issue is if someone exits the game then he'll remain in that setting, causing problems with other 3D programs that use radian. :)
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on January 11, 2014, 10:49:58 pm
Thanks.

That's what it is supposed to do but I messed up something I guess. Launching it with radian mode is funny ^^
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on January 11, 2014, 10:52:26 pm
Yeah it looked kinda strange lol. Maybe it could be how certain tracks look like, though? O.O (eg some track that is like a trip to another dimension)

Btw I know that's a known issue, but any idea what's causing jumping and collision detection to not work in the emulator? (except at the very start of the game)
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on January 11, 2014, 11:26:19 pm
I don't really know why. My guess is that TICKS could be less accurate on sim than on real hardware but that's really just a guess.
Anyway, as multiple keystrokes is not possible on simulator, playing it would be a pain even if it worked fine...
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on January 11, 2014, 11:42:50 pm
Wait, is jumping based on ticks? I wonder if it could explain why sometimes the jump key isn't very responsive (eg if you don't press Enter long enough). And yeah the lack of multiple keypresses is annoying on the emulator. This might be a problem if I ever make a platform game with jumping/shooting.
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on January 12, 2014, 12:06:50 am
Everything that move is based upon last frame render time, thus intensive use of TICKS. So game speed is stable even in case of framerate variations.

I noticed that the virtual calc is very CPU intensive and works better on a freshly booted Windows. Then performances drop significantly over time.

Edit

I wonder if it could explain why sometimes the jump key isn't very responsive (eg if you don't press Enter long enough).

I didn't notice that. You mean on sim right ? Be aware that you are limited to 5 jumps per run now (forgot that in changelog, or was it previous version already ? nevermind).
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on January 12, 2014, 01:30:39 am
Ah ok thanks, and yeah I noticed that the game ran at the same speed regardless of the frame rate, which is a good thing. Some other games do as well, so we can now play them in the emulator too. I need to fix Tunnel eventually so that it won't go faster than 90 pts a second.


And yeah for the jump/collision I meant the simulator. Everything works fine on the real calc.
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on January 21, 2014, 01:44:43 am
Btw I don't know if that is still progressing right now, but I found a bug: When you use Enter during the game to jump, sometimes the Finish/Time screen doesn't appear. It skips directly to the title screen. It's more when jumping late into the game though, so I guess it's due to sensitive key detection or quick key repeat being enabled.
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on January 21, 2014, 06:57:49 am
Yes if you still have your finger on Enter key when finishing then it will skip. I'll fix that.

The game is soon to be finished. I've made a track editor, it's a separate program for now but I'll merge it with the game eventually. Some other bugs to fix, a few features to finish and release of final version in the next few days.

EDIT : screenshot of track editor.
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on January 21, 2014, 10:43:16 pm
Wow that looks quite nice actually. I wonder if adding some borders around sprites and the track sides would look better? :D
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on January 23, 2014, 12:39:31 pm
Thank you. I'm not sure I want to spend too much time on the editor. As long as it's easy to use I think i'ts ok. About time, I'm once again very busy at work, so even though I think it's a bit early, I attach the editor as it is here so you guys can play a bit with it. New, Save and Load track doesn't work at the moment, sorry.
This have been made 100% on calc, thus using a lot of home reals (A-E, K, R, S and T are used if I remember well).
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on January 23, 2014, 09:34:54 pm
Since saving/loading doesn't work, I assume this edits the current track, right?  Or is it just to show how it progressed so far?

Also, if we accidentally recompile the game code, will our custom tracks be deleted like highscores?

EDIT: Btw I just tried this now and when I restart the game after creating a new track, it says Invalid Input. Same thing with the editor. I have to reboot to fix them and then it brings back the original track.
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on January 24, 2014, 05:07:05 pm
As you might have found out already, nope, your creation is just /dev/nulled for now.

What you can do is fetch the TrackEdit.te_tck content in home (this var is EXPORTed), convert it into a list with mat2lst(), and copy/paste it in the game program (trackMatrix in init()). Or just wait that everything get well integrated but I don't really know when. As fast as I can !
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on January 24, 2014, 05:11:49 pm
AAah ok thanks for the tip.

On a side note, did you use some tutorial for the mode-7-like effect in the game? I am really curious how such effect can be achieved efficiently, since in the future, I might attempt games with a similar perspective, but 160x120 and larger than 5 squares wide (so that it fills the entire screen width) and with the camera following you rather than staying centered. One idea I had in mind was Hyperzone, some 3D-like clone of Supersonic Ball or maybe a racing game like Mario Kart/F-Zero, but with no rotation (unless it can be done at similar speed)
Title: Re: [WIP] Trailblazer Prime
Post by: nspireguy on January 24, 2014, 08:07:13 pm
looks good. i have to try this(once i get my hp prime)
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on January 30, 2014, 09:24:27 pm
Hi there !

No major update yet as I expected,  but some nice additions like working embedded track editor, track selection and a few things.

You can't load a track in the editor yet, but you can create a new one, save it to any Home list (L0..L9) and load it into the game.
I know there is a lot of bugs in this release, please report them, I did not have time to test it much yet.


@DJomnimaga : nope I did not use a tutorial, I've made my homework myself ^^
When I find some time I'll explain all the math and programming behind this engine, it's simple but it need some drawings to explain. What you want to do is possible I guess. scrolling left/right wouldn't cost much, just a matter of offsetting the drawing area between frames. The problem is that you will have a lot of data to compute and display at the farthest point. You'll have to cheat at some point I think.

@nspireguy : thanks ! Hope you'll be happy with your Prime, It's a wonderful machine, despite its... messy OS (for now). ^^
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on January 30, 2014, 09:37:11 pm
Nice update, loading this on my calc ASAP. :D

Also I see, thanks for the info about the 3D stuff. :)

EDIT: Bug report: If you go to Track select before saving a custom track, it causes Invalid input. It works fine after saving a custom track in the editor.

Otherwise, it's really great. This is definitively gonna make front page news soon with a few other programs. :)
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on January 30, 2014, 10:01:04 pm
This means the selection fail if there is no valid track at all. I expect some issues and crashes with valid track selection, until all possible cases are found.

I'm happy you like it, thank you.


I made a logo for the game by the way. What do you think ?
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on January 30, 2014, 10:21:54 pm
Seems quite good, although I wonder if it might clash with the old school look from the game? That said, the game is different in look from the original so maybe it won't matter, plus you kept a fire effect.
Title: Re: [WIP] Trailblazer Prime
Post by: MacBernick on January 31, 2014, 08:27:38 am
Yes you may be right. In fact I intend to display it on screen half the real size (half res actually), it might gives it back the overall "old school touch" of the game. Or else I'll make another one ^^
Also, the tileset used for textures is not the final one. I'm making a new one with a bit more details and a more futuristic look.
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on January 31, 2014, 06:25:33 pm
For even more old-schoolness, the trick is to lower the amount of colors (except for vertical gradients) and set everything to 160x240 stretched up to 320x240. :P A lot of old consoles and computers used similar resolutions where pixels were like 2x1 rectangles and even the TI-84 Plus Color model has such mode lol
Title: Re: [WIP] Trailblazer Prime
Post by: DJ Omnimaga on May 27, 2014, 05:16:45 pm
I'm unsure if this author is still around somewhat, but Trailblazer is not compatible with the new HP Prime firmware. It will launch, but the track will be black.
Title: Re: [WIP] Trailblazer Prime
Post by: Lady Eklipse on December 30, 2020, 04:59:21 pm
I have fixed the program by changing line 339:
from          (rayTable(R) + camPosition) / textureOffsetCoef,
to         (rayTable(R) + camPosition) / textureOffsetCoef+1,

This now works on HP Prime G2, the textures are now visible again. I did not fix any of the other bugs yet.