GamebuinoClassic archive

Archive of the Gamebuino Classic forum (2014-2018), rebuilt from the pages kept by the Wayback Machine: only part of the topics and pages were captured. Read-only. Removal on request: hi@gamebuino.com.

Forum › Games Gallery

3D rendering demo

Skyrunner65 Fri Apr 18, 2014 5:45 pm
How many lines of code went into this?
Also, this opens new ideas.
I should have put that statement first. :lol:
erico Fri Apr 18, 2014 8:11 pm
Well, next time I come around here Myndale has a minecraft clone going... :D
Myndale Fri Apr 18, 2014 9:24 pm
@Rodot: Oops, thanks! Sorry about the bad URL, it was late and I was tired. All fixed now. And yeah, I made a few simple optimizations after I made the video which sped it up significantly.

@Skyrunner: Source code is on the wiki....550 lines all up.
Skyrunner65 Sat Apr 19, 2014 2:42 am
Thank you!
Also, how much RAM and what-not does it use?
Myndale Sat Apr 19, 2014 3:04 am
Skyrunner65 wrote:Thank you!
Also, how much RAM and what-not does it use?


I'm using 336 bytes for the w-buffer, 64 bytes for the sprite data and 504 bytes for the back-buffer. But the scene is rendered one column at a time, and the LCD can be switched into a mode that also draws one column at a time, so with a little bit of work you could in fact eliminate the back-buffer altogether and just render directly to the LCD. The w-buffer could also be reduced to a single byte, so you'd probably wind up using only a few hundred bytes in total.
rodot Sat Apr 19, 2014 7:04 am
When I see your programming skills and the drawing skills of people like Adekto, I think that really, really cool stuff is going to appear on Gamebuino. Also, I wonder why am I the guy who created Gamebuino as I'm neither a good artist nor a good programmer :lol:
Drakker Sat Apr 19, 2014 1:52 pm
You can solder those small connections and design a PCB from scratch. ;)
DFX2KX Mon Apr 21, 2014 6:42 pm
That's some impressive work there, Myndale! It looked like you where getting about 20fps (which you seem to have verified) I'm curious, though, where did you look up/learn the math formulas from? I had a book with the formulas and theory, but I lost it some years back.

Now I cant wait to get my unit, it'll be fun trying to learn a bit of C and make something interesting with this. add that to the streaming sound trick you did earlier, and the new bootloader. It'd now be possible to build a pretty sizable 3D game... powered by a micro-controller.
Myndale Mon Apr 21, 2014 10:30 pm
DFX2KX wrote:That's some impressive work there, Myndale! It looked like you where getting about 20fps (which you seem to have verified) I'm curious, though, where did you look up/learn the math formulas from?


Thanks DFX2KX! Actually to be honest I derived them from first principles. I spent 16 years as a professional game developer, much of which was spent as a 3D graphics/engine programmer, so I've done this stuff a hundred times before. Sometime around 1994 (I think) when the internet was still in its infancy I collected a series of articles written by myself and others (with their permission) and released them all as "The PC Games Programmers Encycopedia" aka "PCGPE"; it's still archived in various places around the net and covers some of the more basic 3D algorithms. Not sure where the best place for 3D resources is these days I'm afraid, my very first book on 3D programming was called "Advanced Graphics for the Acorn Electron" and was an extremely good introduction despite the fact I didn't actually own an electron. I still own my copy but it was published exactly 30 years ago, it'd probably be very hard to find a PDF anyway.
ghostdancer Sat Apr 26, 2014 11:13 pm
Impressive , maybe i'm too old but the first thing that came to my mind was this : ZX81 3D Monster Maze but better.
DFX2KX Wed Apr 30, 2014 12:45 am
Myndale wrote:I spent 16 years as a professional game developer, much of which was spent as a 3D graphics/engine programmer, so I've done this stuff a hundred times before.


That... That explains a LOT. I'll have to look around for that PDF or the PCGPE, then. I imagine it'll be informative. I'll be as excited as Rodot to see what you get this thing to do next.

(Also, this preforms pretty well for unoptimized code.)
allan175 Thu May 01, 2014 12:40 pm
Myndale wrote:Sometime around 1994 (I think) when the internet was still in its infancy I collected a series of articles written by myself and others (with their permission) and released them all as "The PC Games Programmers Encycopedia" aka "PCGPE"; it's still archived in various places around the net and covers some of the more basic 3D algorithms.

I remember that! Migth even have a copy on a disk somewhere at home!
Sot0 Thu May 01, 2014 1:01 pm
Myndale Thu May 01, 2014 1:21 pm
Yep, that was it. Seems like a lifetime ago now.

I also cringe at the terrible writing style I had in my youth! :)
DFX2KX Tue May 06, 2014 11:34 am
Sot0 wrote:This?

http://www.gamers.org/dEngine/rsc/pcgpe-1.0/


Nice find!

Also, Myndale, Don't we all? I write fiction for fun occasionally, I can't read stuff I've written a decade ago, without wincing at very best.
rotyler Sun May 25, 2014 11:32 pm
I want to use this to make a maze but first i need to know how to change the size of the map,
Should i just make it bigger or (as i'm guessing) i need to change some of the code?
DFX2KX Mon May 26, 2014 11:07 pm
rotyler wrote:I want to use this to make a maze but first i need to know how to change the size of the map,
Should i just make it bigger or (as i'm guessing) i need to change some of the code?


You'll have to change some of the code, for reasons rather unrelated to the map in particular. Mydale did say it needed optimized, and you'd want to do that to have a map of any real size. depending on how you wanted to make the maze, you could streamline it quite a bit, at the sacrifice of, say, only having four directions.
Myndale Tue May 27, 2014 2:19 pm
How big do you want your maze, rotyler? My demo assumes a square maze, so increasing the size should simply be a matter of changing the MAP_SIZE define to something larger than 16 and then changing the "theMap" array accordingly. Given the flash memory limitations of Arduino you'll probably run out of memory somewhere around 150x150 (rough guess), but you could extend that to somewhere around 400x400 by changing the code to use 1 bit per block instead of 1 byte. Employing simple compression tricks (e.g. using "palettes" like Ultima 6 did) could extend that even further.
rotyler Tue May 27, 2014 3:32 pm
I was thinking to make it around 100 x 100 in size. thanks for the help! I believe you start in top left, right?
phi Sat Jul 12, 2014 9:55 am
The 3D-Maze looks a bit weird on my Gamebuino. The view seems to be split in half.
About one third of the right side is shifted over to the left of the screen.
The demo runs fine apart from that.
Has anyone else encountered this problem?

Image
rodot Sat Jul 12, 2014 10:18 am
Yup I've seen that on several Gamebuino, it seems that screens are not all exactly the same, and Myndale's 3D demo is written in pretty low level without using the Gamebuino library. The 3D demo should be rewritten to use the Gamebuino library, as it works fine on every Gamebuino. I also noticed that contrast is not ajustable on some screens, it can probably be simply fixed with a software update.
DFX2KX Sat Jul 12, 2014 3:59 pm
rodot wrote:Yup I've seen that on several Gamebuino, it seems that screens are not all exactly the same, and Myndale's 3D demo is written in pretty low level without using the Gamebuino library. The 3D demo should be rewritten to use the Gamebuino library, as it works fine on every Gamebuino. I also noticed that contrast is not ajustable on some screens, it can probably be simply fixed with a software update.


Differant sub-versions of the 5110? That's a surprising amount of variation from screen to screen....

That just goes to show, If you're going to program a Gamebuino in low-level commands (I've looked at the 3d Code, Myndale is basically controlling the screen manually in this example) It might make sense to test it on a few different setups if possible, because little things like this.
deepsheet Fri Aug 01, 2014 6:22 pm Is this normal? (Screen issue)
Hello,
I recently got my Gamebuino and it seems something is wrong. Everything is fine, but the 3D demo is incorrect and doesn't display correctly. It seems that the left part is broken and placed on the right of the screen. Here is an example:

http://imgur.com/wKS6VBg
rodot Sat Aug 02, 2014 11:03 am
Hey deepsheet,
I merged your topic with this one as it only concerns Myndale's 3D demo.
This bug is due to the fact that Myndale desn't use the official Gameubino library but program directly at lower level, and the code he uses is incompatible with some Gamebuino. It shouldn't be too difficult to refactor his 3D demo for it to use the Gamebuino library.
deepsheet Sun Aug 03, 2014 10:48 am
Ah, ok! Thanks :D It makes sense, because everything else is fine :) (Except a "dirty" connector which fixed some other issues I had)
Myndale Thu Aug 07, 2014 12:55 pm
I've just uploaded a new version of the 3d demo that uses the official library, so this should fix many of the problems people have been having with it. I've also thrown a few little extras into this version including a second sprite type, some minor optimizations and collision detection so that you can't walk through walls anymore.

Latest version of the code is on the software/examples page, gimme another day or so and I'll put it on the games pages with a pre-compiled hex file and its own git repo.
Sot0 Thu Aug 07, 2014 2:14 pm
Myndale wrote:I've just uploaded a new version of the 3d demo that uses the official library, so this should fix many of the problems people have been having with it. I've also thrown a few little extras into this version including a second sprite type, some minor optimizations and collision detection so that you can't walk through walls anymore.

Latest version of the code is on the software/examples page, gimme another day or so and I'll put it on the games pages with a pre-compiled hex file and its own git repo.


Works great! Thank you, very impressive ;)
Attachments: 3DDemo.zip (not archived)
Marcus Thu Jun 18, 2015 8:07 am
Slightly off-topic, but have you seen this?

https://www.youtube.com/watch?v=9NtaxMUltUA

:shock:
erico Thu Jun 18, 2015 12:19 pm
Looks awesome!