Join us on Discord!
You can help CodeWalrus stay online by donating here.

HP Prime 3D Racer and Snake games

Started by Dream of Omnimaga, March 07, 2016, 10:34:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dream of 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: http://www.hpmuseum.org/forum/thread-5628.html


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: https://codewalr.us/index.php?topic=1173.msg33769#msg33769
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Dudeman313

These look cool! But I do not have an HP Prime, and neither do I feel like trying to figure out the emulator.
  • Calculators owned: TI-84 PCE
  • Consoles, mobile devices and vintage computers owned: Android O Phone
Does this qualify as a signature? 
The answer is "Sure."


ordelore

  • Calculators owned: TI-84+SE, TI_Nspire CX
Calc Wars is still alive (I hope)

Dream of 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.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

alexgt

Wow these look great! I need to get back to programming my prime <_<
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

critor

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 ;) ) :

Dream of 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.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Snektron

That racing game looks cool :) also snakes
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Dream of Omnimaga

#8
>Snakes

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.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

MPower

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  :)

Dream of 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.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Powered by EzPortal