Monday, February 7, 2011

pre-alpha-1 – 2 – I can has update?

Yes!
Back from a break and I sure have updates.
But first let us talk a little bit about the evolution of DwarvesH and the idea behind it. Long story short, I wanted to see if I can take the formula of such an involved city builder and make more accessible without taking away the depth. I have been getting quite a few negative comments on YouTube. People seem to be split up relatively evenly between people who like the new interface and graphical perspective and people who are calling this a Dwarf Fortress clone. I don’t want to debate that right now, but DF’s take on the city builder is severely underrepresented. Maybe we need more there.
But I am getting side tracked. In order to make everything more accessible, I went from top down 2D engine to isometric engine. But isometric has a few disadvantages.
-          Walls and other high tiles tend to obstruct your view. There are numerous workarounds, like making tiles transparent if the cover something, making walls half-height, drawing extra borders,  allowing 90 degrees rotate on map and others. But the end result is the same: you will have some level of obstruction that is unavoidable.
-          Isometric graphics are hard to produce. Because of that angles you have in such an engine, getting smooth transitions between tiles is harder. Not a problem for an experienced graphical artist (which I am not).
-          Modern graphic cards are not that good at old-fashioned 2D bliting. So you need to be careful with the number of draw operations that you make. You can’t just say “Hey, this card pushes out 100000 polygons, I’m sure it can handle 1000 blits”. The numbers are arbitrary, but the truths is that you need a lot of precomposed tiles, by either composing them on the fly and caching the results, or just have them precomposed on disk and load them as such.
-          And others that I forget.
I’m sure you know where this is leading, especially since I talked about my prototype 3D engine. So after finishing a few important tweaks, I started working on the 3D engine and preparing it for full time service.
At first I had a lot of difficulty, but then remembering my future plans, I greatly simplified the math and made the camera less flexible. You can tilt, rotate and zoom, but there are constrains on these operations. I am aiming for a Warcraft III type engine, with a good default camera angle for overview and some rotation capabilities, but no absolutely freeform camera where you can zoom in and see one of your dwarves’ toes from underneath.
This is not the best time to introduce a new engine. You know, the alpha consolidation and polish phase. But I can’t really delay it, since further efforts in isometric engine are going to be wasted effort. I do not have the resources to keep both engines running.
This also raises some accessibility concerns. Event thought the engine offers better view point, with almost top-down default perspective, but 3D aspect ratio and camera management, it does mean that I am cutting away people without 3D capabilities. I’ll do my best to make the engine as scalable as possible. And I feel bad for retiring the isometric engine, which was extremely polished. Oh well…
So let us review the changes.

New 3D engine

Read the rant above to find out what this is about. The new engine is in no way optimized, but as the weeks pass and I learn more, it should even be faster that the old one. The problem is that I am lacking the assets right now. All the 2D tiles are represented as cubes with the tile applied as texture. I am working on inserting real meshes here, but it is going to take a period of time. Also, a lot of things are not textured yet; they just have a bland color. These two elements combined make the new engine look uglier than the old one, and this is the reason why I won’t post a screenshot yet. Maybe next time!

Optimized A*

It is very hard to benchmark the A* algorithm, because it depend a lot on the start and end position, map structure and obstacle distribution. But while keeping these parameters as constant as possible on a random map, I managed to get a good test bed for various implementations. The new A* is between 5 and 9.75 faster than the old one, depending on scenario.

Other stability tweaks

There are tons of small fixes that just go under the good-old bug-fixing umbrella-ella-ella-ella-ella.


And with that, I’ll declare pre-alpha-1 done. The period got cut short a little, but I am wary of making very specific niche case optimizations now with the new engine in fear of them becoming obsolete. I’ll continue according to plan, adding the wood and stone products with their respective industries. I’ll also patch up the new engine as time goes by, but not as a concentrated effort. As soon as I have enough assets for one of the biomes I’ll start posting visual again.
There are a lot of questions that 3D raises that have no correct answer. What should be the default view angle? How far is the camera placed? What FOV should it have? How big should the landscape chunks be? What format to export the 3D graphics? I’m hoping these answers will come to me slowly.

1 comment:

  1. nice!
    i was curious about the progress since the last post; this is impressive- i thought the pre-alpha 1 would take longer. congrats!


    looking forward to new screen shots (and videos, but i know that takes a lot more effort), and to the new wood and stone carving skills.

    ReplyDelete