Author Topic: [WIP] Trailblazer Prime  (Read 21225 times)

0 Members and 1 Guest are viewing this topic.

MacBernick

• LV3 Member (Next: 100)
• Posts: 93
• Rating: +3/-0
[WIP] Trailblazer Prime
« 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.

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 :

Track selection
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.
« Last Edit: January 30, 2014, 09:13:30 pm by MacBernick »

JWinslow23

• Coder Of Tomorrow
• LV7 Elite (Next: 700)
• Posts: 556
• Rating: +43/-6
• I make quality calculator games...when I have time
Re: [WIP] Trailblazer Prime
« Reply #1 on: December 12, 2013, 03:40:15 pm »
Feel free, not fell.

And it looks good!
Did you know that "Ammonia Gas" rearranged is "As Omnimaga"?
= ?

MacBernick

• LV3 Member (Next: 100)
• Posts: 93
• Rating: +3/-0
Re: [WIP] Trailblazer Prime
« Reply #2 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 ^^

DJ Omnimaga

• Former TI programmer
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55863
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
Re: Re: [WIP] Trailblazer Prime
« Reply #3 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.
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF

MacBernick

• LV3 Member (Next: 100)
• Posts: 93
• Rating: +3/-0
Re: [WIP] Trailblazer Prime
« Reply #4 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 !
« Last Edit: December 12, 2013, 09:44:45 pm by MacBernick »

fb39ca4

• LV10 31337 u53r (Next: 2000)
• Posts: 1749
• Rating: +60/-3
Re: [WIP] Trailblazer Prime
« Reply #5 on: December 12, 2013, 10:32:53 pm »
Are you calculating a lookup table for each pixel of the screen?

DJ Omnimaga

• Former TI programmer
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55863
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
Re: [WIP] Trailblazer Prime
« Reply #6 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.
« Last Edit: December 12, 2013, 10:39:47 pm by DJ Omnimaga »
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF

MacBernick

• LV3 Member (Next: 100)
• Posts: 93
• Rating: +3/-0
Re: [WIP] Trailblazer Prime
« Reply #7 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.
« Last Edit: December 12, 2013, 11:30:06 pm by MacBernick »

DJ Omnimaga

• Former TI programmer
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55863
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
Re: [WIP] Trailblazer Prime
« Reply #8 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.

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:

(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)
« Last Edit: December 13, 2013, 12:29:27 am by DJ Omnimaga »
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF

MacBernick

• LV3 Member (Next: 100)
• Posts: 93
• Rating: +3/-0
Re: [WIP] Trailblazer Prime
« Reply #9 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.

Han

• LV3 Member (Next: 100)
• Posts: 62
• Rating: +7/-0
Re: [WIP] Trailblazer Prime
« Reply #10 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!

DJ Omnimaga

• Former TI programmer
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55863
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
Re: Re: [WIP] Trailblazer Prime
« Reply #11 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.

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.
« Last Edit: December 13, 2013, 06:01:16 pm by DJ Omnimaga »
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF

MacBernick

• LV3 Member (Next: 100)
• Posts: 93
• Rating: +3/-0
Re: [WIP] Trailblazer Prime
« Reply #12 on: December 14, 2013, 01:54:53 pm »

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 !

DJ Omnimaga

• Former TI programmer
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55863
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
Re: [WIP] Trailblazer Prime
« Reply #13 on: December 14, 2013, 05:55:56 pm »
Ooh that looks quite cool actually. Do you plan to add some animation or shadow for the ball?

Also, I like the gradient effect at the top. Did it impact speed when adding it?
In case you are wondering where I went, I left Omni back in 2015 to form CodeWalrus due to various reasons explained back then, but I stopped calc dev in 2016 and am now mostly active on the CW Discord server at https://discord.gg/cuZcfcF