Log In  

Cart #ftest947284957820183847501c-0 | 2021-01-18 | Code ▽ | Embed ▽ | No License
12

More mode 7 posts I say!

I was wondering if pico 8 could be used for making a fast mode 7 multiplayer racing game with the new tline function.
Unfortunately pixels near to the camera look huge if you want to have a racetrack of a decent size.

This solution uses another tline to render a gravel and grit texture to break up the huge pixels. Is there a name for that? I guess it's close to mipmaping.

I think It looks pretty good at slow and medium speeds. At fast speeds it looks a bit repetitive. Perhaps a different effect could be used at high speeds.

This video helped me figure out the mode 7 equations: https://www.youtube.com/watch?v=ybLZyY655iY

I've been chaotically jumping between projects. I do not know if I will make this into a game or not.

P#86557 2021-01-18 16:59

1

interesting - this is called "detail texture" and indeed a good way to add details. Used extensively when rendering grounds, ex: https://www.shawnhargreaves.com/blog/detail-textures.html

P#86568 2021-01-18 19:55

Ah detail texture. Thanks freds72. I always thought x-box 360 era games that used that technique looked a bit better then the the rest.

P#86569 2021-01-18 23:27

for a racing track, I would have done it a bit differently :

  • first pass: track outline
  • second pass: details (as a standard texture, with an increased repeat factor) drawn up to a certain depth
  • third pass: road markings

(not sure to understand the complexity of your detail code - a couple of detail sprites randomized on a dedicated map part would look as good)

P#86570 2021-01-19 07:15

I think I need to study more on how 3d games work to fully grasp what you mean. Still greatly appreciated though.

Your meaning for track outline means using non-textured drawing functions, right?

Then for standard texture, you are saying use repeated tlines to project different textures onto different parts of the track?

Random detailed sprites on the track, is something I think I understand. How I use it now, it's drawing mostly transparent pixels for the grit. Drawing particular smudges here and there might be better.

P#86601 2021-01-20 02:25

I’ll try to craft a demo ;)

P#86606 2021-01-20 06:37
5

sorry if not clear - here is a variant with 3 layers using different resolutions:

  • track layer(optional, could be just a grey background)
  • details layer (high resolution)
  • draw sides (e.g. hides track details!)

Cart #bonuniwama-0 | 2021-01-20 | Code ▽ | Embed ▽ | No License
5

P#86610 2021-01-20 12:13 ( Edited 2021-01-20 12:14)

Hey, that looks really great! I didn't know you could poke those memory addresses to shrink the size of the drawn map and have it wrap. Now the term "texture" is much clearer to me. (would be cool if there was a way to set it to not wrap, so I don't have to do all that boundary checking stuff)

Covering up the details layer is a great idea, would work well for kart style racing games. I was hoping to have a track suspended mid air. So that extra code I use to selectively draw the gravel might still be of use. But I was thinking of keeping the background under the track black anyway to hit 60fps. hmm.

Thanks for taking the time to put that together!

P#86612 2021-01-20 15:49 ( Edited 2021-01-20 15:51)

Non wrapping is more convoluted - it basically means you project a 2d quad and rendering that using standard rasterization technique.

P#86616 2021-01-20 16:03

This is amazing!
Can you provide the full project?
(make it open-source)

Jesse

P#87339 2021-02-07 13:21 ( Edited 2021-02-07 13:35)

I'm a little new to this community, but I'm pretty sure no one minds if other people parts of their code for their own projects. Actually, my main goal for posting this was to play more more pico-8 racing games down the line. Feel free to use whatever you want.

If you didn't know, you can click you can click "code" under the cart to view the source code, or you can download the cart image by clicking "Cart" and load it into pico-8 and view all the source, sprites, and music in there.

P#87342 2021-02-07 14:58

Hi,

New to the "PICO-8" game engine too.
Right-click on cart worked to save project.
Very cool - thanks!

Jesse

P#87343 2021-02-07 15:07

Bwa upgrades. Check it out:

Cart #ftest_upgrade-1 | 2021-08-24 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Pretty seamless, huh?

The wrapping property of poking those memory addresses that freds72 demoed gave me an idea. What if you replace the tiles you just drove over with new ones when they come into view, like a treadmill, then draw a lower quality track in the distance? Looks like I got that to work. I generate a massive 256x256 global array of where to put each high quality tiles, it reads from there when they need to be replaced. Only takes up 1/4 of the lua memory.

An earlier version had it start drawing the higher quality map on a point on the screen, Now it calculates it based on how much it’s able to draw by measuring distance. Now it can do fancy stuff, like go up or down (hold down z and push up or down to change elevation), or have mode-7 hills kinda like Simpsons Road Rage for the gba!

The logic for replacing tiles is more complex than I thought, but perhaps I’m not approaching it in the best way. I think it could be about twice as fast if the while loops were replaced with for loops, but ugh, my brain. It works and is mostly glitch free now.

The detailed map in this demo uses 64x64 map tiles, which eats into the sprite sheets. Getting it to look good and run fast while also using the last 2 pages of sprite sheets could be challenging, because you would have to do boundary checking for the low quality map too.

Multiplayer would work well, just give each player their own 32x32 or 16x16 detailed map, and everyone could share the low quality map.

I put in another mode-7 thing for the ground. It’s kinda slow and only renders at 30fps. It looks fine, when you're not rotating. I guess, given the limitations, it would be ok to replace it with a pseudo 3d effect or some kind of grid? Why do I like elevated tracks so much? None of the old racing games I used to play had one lol. It does look pretty cool.

P#96425 2021-08-24 22:29

excellent results!
that said, not sure what is the purpose of this sprite seapping,
Is that to have less noisy sprites at distance?
unless you also change sampling resolution, there is no benefit switch sprites

P#96443 2021-08-25 13:57 ( Edited 2021-08-25 14:00)

By sprite swapping you mean switching doing tines from a low detail tiles to high detail ones?

At it's current detail level, the detailed map can only hold 4 track widths of track at once, so, the low detail one's purpose is to render a track to look at in the distance. You would only see about one turn in front of you without it, which is no good for super fast racing games. Maybe you have a cool idea of how to render the distance without tines?

P#96460 2021-08-26 01:36

ok - so you do change map scale at distance (missed that looking at code).
good idea!

P#96476 2021-08-26 05:55

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-16 15:40:57 | 0.027s | Q:38