May 28, 2020, 03:04:24 pm

The shoutbox is currently out of service. Join us on Discord instead.
You can help CodeWalrus stay online by donating here.

WARNING: DO NOT UPGRADE your TI-83 Premium CE or TI-84 Plus CE to OS 5.5.1 and higher. It removes all compatibility with most games and removes ASM programming!


HP Prime 3D Racer and Snake games

Started by DJ Omnimaga, March 07, 2016, 10:34:50 pm

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DJ Omnimaga

Mark Power has released Racer for the HP Prime, which once again shows the power of HP PPL language and this calculator hardware. Now at version 28, it features pseudo 3D graphics in the style of Outrun, multiple layers of parallax scrolling in the background, day and night mode and smooth gameplay.

There is currently only one course in the game, but if you can figure out how it was made, then you can probably make your own track in the ResetLoad() sub-routine.

Download link:

Also, while this is much more simple from a technical standpoint, the HP Prime lacked a Snake game for some reasons. Thanks to @nullweist, there is now one, which features difficulty and color options:

Download link:


These look cool! But I do not have an HP Prime, and neither do I feel like trying to figure out the emulator.
Does this qualify as a signature? 
The answer is "Sure."


Calc Wars is still alive (I hope)

DJ Omnimaga

Quote from: Dudeman313 on March 07, 2016, 10:53:05 pm
These look cool! But I do not have an HP Prime, and neither do I feel like trying to figure out the emulator.
It's not even close to hard to use. The issue is if you get caught since it seems like you cannot use your laptop for entertaimnent purposes. Otherwise you just install it for free and you don't even need a ROM.


Wow these look great! I need to get back to programming my prime <_<


Very nice. ;D

I've made a little video and added the Sega Out Run soundtrack (as there's already the Sega Out Run car sprite ;) ) :

DJ Omnimaga

Cool, I'll watch later. :)

I need to examine the code later to see how fast the game runs at lower resolution/quality.

Also @alexgt do you remember Trailblazer Prime? It was a 3D PlainJump clone with textured floor, but sadly it doesn't work on newer firmwares.


That racing game looks cool :) also snakes
Legends say if you spam more than DJ Omnimaga, you will become a walrus...

DJ Omnimaga

March 15, 2016, 07:08:18 pm #8 Last Edit: March 15, 2016, 07:11:07 pm by DJ Omnimaga

Someone now needs to make a mod of that HP Snake game and replace the snake blocks with :walrii: with the front one being pink. :P

Also I need to check the code of that racing game to see if those backgrounds and road graphics use pre-rendered PNGs or if they were generated with code. It seems like the sky, as well as the mountains, could easily be generated with some code to save space. The trees could probably be generated with a randomized graph curve, then a gradient applied. The clouds might be another story, but if they were made more simple, I bet it would be possible.


Hi Everyone,

I'm glad you like the 3D Racer. I'd like to answer some of your questions...

Regarding the roads: there are two - Easy and Hard. Easy shows off an undulating straight road. You don't need to steer on this section, but it makes the terrain tracking obvious as some people didn't think I'd implemented that. The Hard (original) track has hills but perhaps they are less obvious unless you look at the car and the scenery. The Hard track requires more aggressive steering.

To change the tracks just edit the ConfigureTrack() method. There are comments in there to explain what the parameters to AddRoad() are. Just don't make the curves too tight (otherwise you can't steer around them) or overrun the number of road segments. Also I wanted to keep the speed up so the parallax scrolling of the background uses a single BLIT_P for each layer. So when you make a curve one way, make sure you curve back by the same amount by the time you get to the end of the track otherwise you will run out of background!

Regarding the backgrounds: they are prebuilt PNG files with transparency. There are day backgrounds and night backgrounds. When the game starts the PNGs are loaded into GROBs so that I can use BLIT_P. I used very simple backgrounds with little texture and compressed the PNG files (using tinypng dot com) so that they occupy relatively little space. I did try a photorealistic night sky at one point but the Prime ran out of RAM.

It seems like the PNG files are held in flash until AFiles() loads them into a GROB. Then they occupy RAM. So you seem to be able to have lots of PNGs on the calc ready to use and as long as you don't have massive GROBs you are ok. You could generate the GROBs programatically as suggested, but I think you would still stress the RAM if they were too big.

I already use 6 of the 10 GROBs: G0 is the display; G1 is my frame buffer where I build the scene before BLITing it G0; G2 is the sky; G3 is hills/city; G4 is trees; G5 is a composite of all the cars. I'm thinking about adding road side trees so they would take up another GROB, but also slow the frame rate as they need to be scaled, clipped and the physics routine needs to detect collision of the objects.

If you want to have a look at the code and try to optimise it for me so that I can add roadside objects, look at the methods which have RT in the comments (for Real Time). The other methods are not time critical. I've done a fair bit of tuning already to gains are hard to come by.

I notice that critor has found a bug! The lap display on my Prime shows Lap 1/3 because I use Standard display mode. On his Prime he must have Fixed 4 decimal format as his Prime shows Lap 1.0000/3.0000. I'll fix that in v29.

If anyone has further suggestions I'd love to hear them. My colleagues and I were taking turns playing to get the best time a few days ago and it was suggested that I include an old school leaderboard so that people can put their initials against their times.

If only the Prime could play sounds, that would be the icing on the cake  :)

DJ Omnimaga

Hi MPower and welcome to the forums. :)

Regarding the roads, I was impressed that you managed to implement hills and especially the scrolling background. We have a pseudo 3D racing game on the TI-83+ from 1999 called Lotus Turbo Challenge and when you are in a curve, the background doesn't even scroll an inch. I once made an xLIB engine that did but it ran at 3 FPS. I'm impressed that the HP Prime can achieve such high frame rate for a racing game despite the 320x240 resolution. Good job :)

And I see about the BLIT'ed background. DO you think you could have made the background repeat, so that it uses two BLIT_P commands and its position gets reset once it reaches a certain point?

And yeah it's better to not use too many large GROB's at once, because then the calculator has issues. Also it's best to set all 10 GROB's to 1x1 pixel when exiting or entering the game, from what I heard. Memory problems are more noticeable when you use an application instead of program, because they simply won't run at all.

Highscores would definitively be a nice addition, as well as a title screen and perhaps multiple pre-generated tracks, even if not many. It would then be a full racing game :)

As for music, I wish as well. I remember that the HP 48g and a lower-end model (39gs I think?) could play beep sounds, but sadly the HP Prime lacks a sound buzzer.

Do you plan to make more games for the HP Prime in the future? I made one in the past, which is called HP Prime Tunnel and I plan to make more, but it has been a long while since I coded for it.

Powered by EzPortal