Work in Progress

Race v0.7


nathanielbabiak 2021-08-12 00:53 (Edited)

I have a forum post on collaboration here.

race.nx | Open in app
2021-08-30 02:54
race.nx | Open in app
2021-08-26 04:00
race.nx | Open in app
2021-08-24 04:01
race.nx | Open in app
2021-08-24 03:56
race.nx | Open in app
2021-08-20 03:57
race.nx | Open in app
2021-08-19 05:29
race.nx | Open in app
2021-08-12 00:53

G-9 2021-08-12 08:41 (Edited)

Wow so great idea !! I agree so much !
And if I have the time I will make some GFX and sounds (I’m new to sounds but it should be ok)
The car looks like 3d but it’s 6 different sprites… good job 👍

G-9 2021-08-12 08:45

Wait, the purple thing in your screenshot doesn’t appear.:. Did you edited screenshot yourself or is it a bug ?

nathanielbabiak 2021-08-12 11:28 (Edited)

The screenshot is from a different version that includes 3d polygons already, sorry. (I'm not proud of the code for it yet, so it's stripped from this upload.)

I'm kinda bummed about it actually... I have all of the graphics stuff done (it's commented in the source file), it just really should be part of a level data format (rather than hard coded). And, the first step in creating a level data format is figuring out turns (since any peculiarity associated with turning will cause changes in the level data format).

CubicleHead 2021-08-13 12:06

This Look Super Awesome!!!
I Have No Clue How You Would Program 3D Turns...

nathanielbabiak 2021-08-20 03:59 (Edited)

Individual turns are almost done! (They're a little buggy still.) Combination 's' curves and left-right movement are next on the list.

Unfortunately, this will be slow-going since I have to derive everything myself. (There's no sources I can find that use true-3D for this stuff. And in this language, there's no performance penalty for 3D math, so I really want to keep everything in true-3D.)

was8bit 2021-08-20 05:41

Its looking nice :)

I like 1) how it cheats for me ;) and 2) going backwards is kinda fun :)

nathanielbabiak 2021-08-20 11:40 (Edited)

Haha - it won't cheat for much longer! Although, it's pretty obvious the turns are way too sharp right now - it'd be completely impossible without the cheating at the moment.

And for now, the turns of the circuit are like Mario (once you pass a turn it's gone forever). So, you can't reverse through a turn if you're a little bit past it. That's going to change too - I really want reversing through turns to be a feature.

The true-3D is super important to me too. My goal is actually an '80s styled raster racer *with* true-3d, since I always felt like raster racer car movement was way too restricted in contemporary games.

was8bit 2021-08-20 14:19

It's looking great so far :D

nathanielbabiak 2021-08-24 04:00 (Edited)

Turns work! It's still super preliminary, but I just wanted to upload this and see what y'all think.

It's all in true-3D too... Kind'a... I set the field of view of the skybox (far-away background) pretty wide (112.5 degrees!) to exactly match the 512 pixel-wide background. The lawn/road looks better with a narrow field of view (it provides farther draw-distance), it's set at 90 degrees currently. I factored the difference to make them match each other at the pseudo-horizon-line (i.e., draw distance).

Otherwise, the units of position are "pixels" and the speed shown is actually "pixels" per frame (presuming a 90 degree field of view). Since the tires are 26 pixels wide, I figure each pixel is nearly a decimieter, which means the 3D levels can actually have real-world scale to them. And, in this upload, you can change the status bar units in SUB STATUS.

Unfortunately, in the 's' curves there's a weird quantization effect. You can see it around position 3065 in this upload. I'll fix it later (maybe). I'll probably delay fixing it until after I import the mipmaps and sprite polygons though - that'll make the whole circuit much prettier.

Regardless of all those technical details, everything's modeled with an (x,y,z) coordinate, so the mipmaps and polygons are going to be perfect!

More to come...!

Timo 2021-08-24 06:21

The curves look perfect now :)

was8bit 2021-08-24 06:42

It looks fantatic :D

G-9 2021-08-24 08:11

Incredible wow 🤩

nathanielbabiak 2021-08-24 11:08 (Edited)


The quantization issue was easier to solve than I expected, I figured it out while my alarm was going off this morning. It's just a rounding error between one curve and the next, an INT( in the right location should take care of it. I'm not sure that's all it'll take. I'll figure it out later...

nathanielbabiak 2021-08-26 04:09 (Edited)

Unfortunately, I can't resolve the quantization issue when two consecutive sharp turns meet at the horizon. At the worst case, PY=48 is approx. 23% thicker (in depth) than PY=49 (the 'jumps' are less significant for higher PY), and I just can't figure out how to un-quantize the thickness. It seems Sega might have resolved this by super-sampling, but this system isn't fast enough for that, and I was really hopeful math would save me. I give up! At least I improved a few other curve-related items while I was investigating!

Also, the car works. It feels 'right' on straight-a-ways, but the turns feel horrible because of the fixed camera perspective. Also the math is probably wrong too! I'll figure it out soon.

nathanielbabiak 2021-08-26 04:25 (Edited)

You may notice the rendering feels like a jittery camera with a ~3000mm lens (a bit more than the common 35mm!)... The obvious solution is to limit the curves to gradual, sweeping ones rather than keeping them tight. So this may become a more traditional raster racer after all...

And, I've come to the sad realization that this game will never be 'true' 3D. It has 3D coordinates though, they just aren't converted using a rigorous projection. The system just doesn't have enough speed for the math it'd need. In the most CPU-intensive loop of SUB LAWNROAD, there's currently 5 instructions below the comment LAWN BG SCROLL outside the IF...THEN statement. I'd need closer to 20!

And I'm already way over the CPU budget, so even without 'true' 3D, I'm probably going to have to drop it to 30 FPS at some point. (The mipmaps use 5% CPU all by themselves, just for scaling. The polygons use around that much too, and I haven't even started on obstacle handling.)

was8bit 2021-08-26 05:21

Well, remember that this is a "low resolution device" virtually speaking... perhaps you can simulate 3D effect with standardized turns, and preload the animation for them... like say a soft turn, and a harder turn....

was8bit 2021-08-26 05:23

You can also lower your 3D rendering by limiting the portion of the ground that gets animated to the checkered edges, and don't to the entire ground as checkered... keep the distant animations though...

was8bit 2021-08-26 05:25

It isn't uncommon for roads to fall within standards or limits .... especially major roadways or even race tracks...

was8bit 2021-08-26 05:27

Backroad racing wouldn't have much 3D rendering... most everything is in your face constantly and only a portion of the road is visible at any time... these roads can have a lot of crazy ups downs twists etc... to watch out for...l

G-9 2021-08-26 08:19

Why do you don’t map the acceleration to a button instead of the d pad ?

G-9 2021-08-26 08:19

Why do you don’t map the acceleration to a button instead of the d pad ?

nathanielbabiak 2021-08-26 11:53

Was8bit, yep, that's pretty much the route it'll take - I'll probably just end up limiting the turns a bit based on what looks good.

G-9, there will eventually be both manual and automatic options for the car. I'm saving the buttons for shifting the manual. Do you think the buttons should be for gas/brake, and the up/down arrows for shifting instead?

nathanielbabiak 2021-08-26 11:58 (Edited)

I just had a thought about why you might have asked that: on a touchscreen device it's really hard to hit both the up arrow and left or right at the same time...

was8bit 2021-08-26 12:40

"Standard" or automatic would have (A) button as gas, and (B) button as brake... shifting or "stick" is more for professional racing.....

If you think about it, that matches a real car... it has a stearin wheel (LR) a gas and break pedals (AB) and a professional car adds a clutch and a stick shift... which would require more controls than we have... real game controllers can have ABCD + UDLR + 1234 + start + reset

nathanielbabiak 2021-08-26 12:45 (Edited)

Nope, there's plenty of controls available since there won't be a clutch:

If you think about it, that matches a real car... it has a stearin wheel (LR) a gas and break pedals (AB) and a professional car adds a clutch and a stick shift (UD)... which would require more controls than we have... real game controllers can have ABCD + UDLR + 1234 + start + reset"

Timo 2021-08-26 12:57

So the NES controller is not a real controller? ;)

was8bit 2021-08-26 18:38

LR for steering , but adding UD for the shifter is like saying you move your stearing wheel up and down to shift...

Rather, U for gas and D for breaks would be abit easier to handle, leading AB to handle shifting... as UP alone would accelerate straight ahead, and DOWN alone would break straight ahead...

was8bit 2021-08-26 18:40 (Edited)

I dont recall nes having a racing game that shifted gears... i could be wrong... nowadays you can buy a steering wheel, pedals, a shifter, and a rumble seat, for the full experience....

... for me, the simplier the better... i know some like full realism, but at that level shouldnt you also add tire wear risking a blowout, gas running out, gears stripping, streering and excelerating incorrectly and flipping your car over, etc... ;)

was8bit 2021-08-26 18:43

Now, i DO like demolition derby games ;)

nathanielbabiak 2021-08-30 03:02 (Edited)

Mipmap code's in! They're at "full fidelity pixels" now, which limits the number on-screen simultaneously pretty severely. I'll increase the pixilation and we'll see more eventually. (And it'll always be limited to 3 color palettes and 1 grayscale palette, unfortunately.) If you download a copy (rather than playing online), the loading screen will be about one second faster. (There's eight mipmaps pre-loaded in the ROMs, and six more are created in RAM during the loading screen, but one of those is in persistent RAM and doesn't need recreated every time the program starts.)

The turns I generated for this upload also have a pretty nice consequence... I might be able to resolve the 'quantization' issue! You can see a super simplified turn segment (it isn't an "s" curve, and it's not sharp either) at position 10823... I should be able to figure it out since it's so simple!

Also, was8bit... F1 doesn't have clutch controls the way you're assuming. Here's two links with some background on the topic. (My car doesn't have a stick shift either - it has paddle shifters too.) Also, I don't plan to make standard/manual required - I don't like the realism either! I do plan to include gear shifting in the simulation though, since it'll make the sound a little bit richer to have road noise separate from engine noise. I figure if it's in the simulation, it might as well be available to control.

was8bit 2021-08-30 07:23

Wow...tnks :)

I remember atari game that was JUST about shifting... very fun :)

G-9 2021-08-31 08:05 (Edited)

I have two questions :
1 - Is the loading screen fake or real ?
2 - hoowwww how did you do that howw there is only 64 sprites I don’t understand how did you do sprite scaling with 3 sprites at once ?!

But your game starts to be so nice

nathanielbabiak 2021-08-31 12:31 (Edited)

The loading screen is real. Eventually, I'll make a few changes and it'll go away.

There's eight mipmaps pre-loaded in the ROMs, and five or six more are created in RAM during the loading screen.

When I write "mipmap", I mean this. Basically I wrote an algorithm that scales 8x8 sprites (bitmaps) up to 32x32, and also down to 1x1. The thing that makes the algorithm "good looking" is that it picks pixels consistently, so there's no jitter.

nathanielbabiak 2021-08-31 12:57 (Edited)

To begin answering your second question, I'm actually not using too many sprites yet. I've already planned all the sprites I'll be using, it's shown in the comments in the source code just above the ROM entries - do a search for "layer".

I'm not sure what else to tell you, I'm a magician I guess! Just kidding... are you asking about the lawn/road, the far-away-background, the scaling-sprites, or something else?

The lawn-road is on a BG, the far-away-background is on a BG, the scaling-sprites are (obviously) sprites. Does that answer your question?

G-9 2021-09-06 09:28

Yes, thanks :)

NoobMan3 2022-02-06 13:28

This looks like something i had in mind

Log in to reply.