More game engine grunt work
April 20, 2019, at 01:53 PM (0 comments)
Title: More game engine grunt work Author: mgarcia Date: 2019-04-20 13:53 +1000 Tags: 2019, Blog, 3DS, GameDev, Industry, NetYaroze Comments: Open
Well continuing from the last post , new engine, new (optimized) formats.. kinda go hand in hand.
For the old engine I used Silo 3D and while it's easy to use, doing retro 3D (using tiles) isn't it's strength!
I was hoping an old 3D modeler could do it, like anim8or, which is a simple 3D modeler that also does animation and it's pretty simple to use, it also exports to a C language file, but alas that too relied on UV maps.
Then I came across crocotile3d.com and sprytile.
I looked at both.. but I found I was fighting with crocotile more and sprytile was more easier for me to pick up and output assets... even with my limited blender skills!
And Blender lock tool (locks to integer coordinates) is great, which is what my world uses (0-255).
The world is based on Quads not triangles (1 unsigned char (1 Byte) for each vert) calculating and storing the facing normals (3 floats (12 Bytes)).
The UV's in engine uses a single image for everything, it was originally 512x512 using 32x32 tiles (full image displayed at the bottom screen)
UV's not stored as float's (4Bytes each) but instead all 4 verts x 2 UV's stored as 6bit each , which is 6 Bytes (compared to 64 Bytes per quad using floats), from my last blog post, I'm more memory concerned then CPU usage.
Moving the camera
Next need to see the quads rendering correctly, that means moving the camera... the forward vector is used to move the camera.. simple stuff. Here the UV's aren't used, instead just using 100% of the texture on all quads.
I fixed the UV's to use the actual UV's from the OBJ file. Storing the UV's as unsigned numbers is pretty hacky but works well, to compress them just multiply it by the texture width/height, when rendering, a quick divide of the same texture width/height gets the normalized UV coordinates back.
New asset pipeline
The UV was changed to unsigned shorts for a larger 1024x1024 texture file, now tiles are 64x64 tiles, tilable ("repeating textures") images from https://renderman.pixar.com/pixar-one-twenty-eight.
The tiles I liked are resized to 64x64 and put into a non-alpha folder.
The font is created using Codehead's Bitmap Font Generator.
The tile map is then assembled via a bash script.
Images are split into alpha (transparent) and non alpha (not transparent).
Yeah, my script is hacky but works well:
64x64 tile map, 32x32 font:
Bigger UV and better face culling
Fixed issues with face normals, because it's all quads and using a single face normal. I made it calculate a face average (also called smoothing) using each vertex (normal for each vert, then divided by 4).
It works well, not so much on really badly non planar quads, where the two triangles don't point in roughly the same directions, ie one is up and the other to a side, shown in the video below at 1:10 minute mark.
These video's are unlisted.. it's mostly for my blog and don't want to spam my youtube followers with small incremental stuff.
The whole playlist is here . The private videos showed the Nintendo test unit, which Nintendo prohibits.... I think? nobody knows 100%.
Since my old server died last year, the netyaroze-europe.com hasn't received much love. The idea was to set it up again as a wiki.
That's the reason why I use pmwiki as my flat file, blog CMS... which is really overkill and its kind of clunky, but it was to see how it would go, and it goes great!
I've started setting it up and I'm putting more time into it, still trying to get the layout how I want it, and slowly porting content across to it.
But so far so good :)