Adventure Update

Posted by Gordy on Oct. 1, 2014, 7:10 a.m.

so i've been working on my engine, and i felt a bit overwhelmed when i realized i needed to rework a major engine component (region rendering).

initially, the engine rendered a single ground plane (the grass), and then details like dirt, cobblestone, and the water were rendered above it.

this lead to a ton of draw calls in areas like the town shown above.

performance was also suffering, in some cases, my fps dropped below 30 (it’s supposed to run at 60)

i wanted to solve this without having to precompute textures in an external editor and import them into the game, so I came up with a simple chunk based solution.

when a chunk (a 128x128 region) is loaded the engine precomputes all the layers of details and merges them to a single texture.

this alone increased the rendering performance by over 300%, and i was able to get ~60 in the same area i was getting only ~25 before.

however, since these textures are being created on the fly, memory has to be allocated for these new textures, as no two regions share the exact same texture (previously, textures were just reused between regions, keeping the overhead at a minimum, but requiring a separate draw call for each).

the solution for this was to simply free the textures once the player was a certain distance away, and recompute them when needed.

while doing this might cause some potential slowdown during the game, it’s far better than dealing with the memory overhead (20mb as opposed to 3mb x every region (when there could be potentially hundreds of regions) )

the final thing is that now (as seen in 1 of the frames) heightmaps can be applied to each region, and the texture will conform properly. this was not previously possible by rendering each face of detail.

oh, one more thing, since i’m precomputing the textures, i can dynamically set the texture resolution of the region, for slower computers the engine will set the texture size anywhere from 128x128 to 512x512, which gives me a lot of flexibility in performance!

i've also implemented a "build mode" into the game, which allows you to take and place various items.

doing this spawned a whole slew of bugs and made me realize how much i need to refactor some of my code. (don't worry, i promise not to do an engine rewrite!)

now, as the engine becomes more and more feature complete, i can begin the content and gameplay phase of development!

also, not game related, some other things i've been working on

i've never really been that big into js, ( i do backend stuff like php, but never spent too much time on frontend junk ) so i took it upon myself to learn some javascript and implement some game dev knowledge. so far i've built a basic game engine using the html canvas, i'll be releasing it soon. also, off topic: is any here on the new social media site Ello? its cool and stuff but there's not much of a gamedev community yet.

my ello profile

also, if you want to learn about Making your first game you should check out gamebin.tv. It has everything you need to know!

that's all for now!

Comments

Alert Games 10 years, 2 months ago

Those unrelated graphics look amazing and I would play a game like that right away.

Interesting site, reminds me a bit of the ol' phrot layout… but sorta confusing at the same time…

Phoebii 5 years, 6 months ago

Nice.