GROG - Tech Demo

Creations

Alban

5 years ago

G.R.O.G.: Graphics Renderer Optimized for Gamebuino

I've had this project going on since the release of my previous game, Project88. This is a proof of concept for a Virtua Racing-like engine. 

Although I am very proud of the performance level I have reached, I don't feel like I will build a game on this. What eats up CPU cycles is mostly the rasterization part, which I've tried to optimize to the bone, but not leaving many cycles left. On the memory side, my implementation is fairly light. I believe one could do a game like a space shooter, where triangles don't cover the screen, but this feels limited.

I've documented as much as I estimated relevant: specifics to the implementation, API usage, tricks etc. For 3D rendering 101, which is a huge domain, I suggest you have a look on the web at how transformation and projection matrices work, and how vertex buffers are usually used. You'll find all these notions put to good use in my code.

The link to the documentation is here: http://htmlpreview.github.io/?https://github.com/alban-rochel/grog/blob/master/grog/doc/html/index.html


View full creation

jicehel

NEW 5 years ago

Nice potential, the render of the car is not perfect but enough good to try to make a game with it.

You could draw it on a 3D track to try interactivity. It's could be nice to try this type of game. If it's works fine, you could complete the creation of the game as it seems to be the project that you have in mind

Alban

5 years ago

I already have a version with a more detailed track, but it shows the current limitations, which is what I actually have to rework. I have to change the way the geometry stage works to better take into account clipping in the normalized device space (clip the triangles that are part in the screen, and part outside the view).

Alban

NEW 5 years ago

jicehel jicehel

I already have a version with a more detailed track, but it shows the current limitations, which is what I actually have to rework. I have to change the way the geometry stage works to better take into account clipping in the normalized device space (clip the triangles that are part in the screen, and part outside the view).

jicehel

NEW 5 years ago

OK, good luck and thanks for your works in this domain. When you'll complete it i hope you'll do again a tuto to explain us how it's works

Steph

NEW 5 years ago

Hi Alban,

Great little demo!

It's cool that you're starting to clear this area for the META... and as jicehel says, think about giving us a tutorial so we can get to GROG easily.

Come on, stay motivated! It's going to interest a lot of people around here :-)

We want to be able to code a Wipeout game soon!

Alban

5 years ago

This time, the design has been thought before coding, it should be easier to document ;-)

Alban

NEW 5 years ago

Steph Steph

This time, the design has been thought before coding, it should be easier to document ;-)

jicehel

NEW 5 years ago

Yes for a good game it's should always be like that (thought the design before starting to code) it 's good then you developp but it's a necessity when you make a team works on it to avoid the time lost.

Alban

5 years ago

Well, I work as a software architect for a living, so I couldn't agree more :-)

Alban

NEW 5 years ago

jicehel jicehel

Well, I work as a software architect for a living, so I couldn't agree more :-)

alxm

NEW 5 years ago

Awesome work, looking forward to checking out future updates! I love low-res 3D.

alxm

NEW 5 years ago

Nice speed boost in the 1.0 update!

By the way, I get a Hard Fault Error 2 when I flash the game, turn the Gamebuino off and then on, then press A at the title screen to start the game.

Alban

5 years ago

This is weird. When you say you flash the game, do you mean that you compile it by yourself?

For what it's worth, I haven't tried it with the standard arduino compiler but with gcc 7.3.1 + O3 compiler flag. This may explain a difference in behaviour. But this shouldn't crash anyway...

bfx

NEW 5 years ago

Well Done!

By the way as you published it on the 1st of April, I first thought it is an April fool!

The performance is incredible. It is another good example of huge performance gain with fixed-point arithmetic and pre-computed trigonometry functions.

You write that the rasterization is the most computing-intensive part. Here there is maybe something to do with DMA. I have absolutely no experience with DMA, but this may be a good starting point:

 https://github.com/adafruit/Adafruit_ZeroDMA/blob/master/examples/zerodma_memcpy/zerodma_memcpy.ino


Alban

5 years ago

This DMA stuff looks interesting, thanks!

Update: I'm not sure this would be really usable in the triangle rasterization case. If I understand correctly, I'd rasterize one line, transfer it through DMA, while I rasterize the next one etc. As triangle lines are only a few pixels bytes wide (40 at most, but usually 1 -> 4 ), I don't think the overhead would be worth it.

But there are lots of areas where I could use this. I might have used this at some point in my game Project88, to draw the background.

Alban

NEW 5 years ago

alxm alxm

This is weird. When you say you flash the game, do you mean that you compile it by yourself?

For what it's worth, I haven't tried it with the standard arduino compiler but with gcc 7.3.1 + O3 compiler flag. This may explain a difference in behaviour. But this shouldn't crash anyway...

alxm

5 years ago

Sorry for the confusion, by flash I meant launch from the menu. Here are the repro steps, it happens every time on my unit:

  • Launch Grog from the menu, it runs fine
  • Turn the Gamebuino off, then back on
  • Grog is currently installed, so you get its title screen
  • Press A on the title screen to start the game
  • Hard Fault Error 2

Alban

NEW 5 years ago

bfx bfx

This DMA stuff looks interesting, thanks!

Update: I'm not sure this would be really usable in the triangle rasterization case. If I understand correctly, I'd rasterize one line, transfer it through DMA, while I rasterize the next one etc. As triangle lines are only a few pixels bytes wide (40 at most, but usually 1 -> 4 ), I don't think the overhead would be worth it.

But there are lots of areas where I could use this. I might have used this at some point in my game Project88, to draw the background.

alxm

NEW 5 years ago

Alban Alban

Sorry for the confusion, by flash I meant launch from the menu. Here are the repro steps, it happens every time on my unit:

  • Launch Grog from the menu, it runs fine
  • Turn the Gamebuino off, then back on
  • Grog is currently installed, so you get its title screen
  • Press A on the title screen to start the game
  • Hard Fault Error 2

Alban

5 years ago

Hmmm... Thanks for the feedback, I have this issue too :-)

Alban

5 years ago

Fixed. I've tagged the version as 1.1, even though the rendering library itself is unchanged. The issue was in the demo code.

Thanks for the feedback!

Alban

NEW 5 years ago

alxm alxm

Hmmm... Thanks for the feedback, I have this issue too :-)

Alban

NEW 5 years ago

alxm alxm

Fixed. I've tagged the version as 1.1, even though the rendering library itself is unchanged. The issue was in the demo code.

Thanks for the feedback!