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

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - MPower

#1
Hi Everyone,

Just wanted to introduce myself. I see some of you have come across my HP Prime 3D Racer game. It's my fourth serious Prime project after a solitaire card game, a Chip-8 emulator and Turing machine emulator. You can find those at the HPCC web site that I'm the web master for. Click on the Prime on the front page and scroll down to the bottom for the programs and club magazine articles.

I've been playing with programmable calculators since around 1978. I've progressed through the Commodore P50, TI-57, Casio fx-502p, Casio fx-702p, HP-41CV, HP-41CX, HP-71B, HP-48SX, HP-48GX and now I'm onto the HP Prime. My wife has a HP-32SII (she's a programmer and RPN girl). My eldest daughter has a HP-39gII. My youngest daughter has yet to be converted from her iPad mini and Galaxy S5, but I'm sure as Maths gets more fun for her she'll be twisting my arm.

I've recently found my old Casio MG-880, still working, still with its original batteries in my bedroom at my Mum and Dad's house. Brilliant game! I must write one of those for the HP-41 when I get some time.

If anyone is in London on the second Saturday of the month do come along to Imperial College and meet the HPCC crew. Details on our web site. Better still join up and get the club magazine posted to you - how old school is that!

Have fun.
#2
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  :)
Powered by EzPortal