Snapshot 1 went over pretty smoothly. Still I greatly overestimated its stability on random machines so crashes were a lot more frequent than I expected. Not a stellar start but what do you expect from the first version obtained from merging two tech demo candidates over the weekend and stripping out all unnecessary stuff in a hurry. I already fixed some of the bigger offenders and snapshot 2 should be uncrashable on machines with correct specs. Famous last words? Probably! Anyway, to slightly make up for it snapshot 2 will feature a more reasonable item density making it run on a wider area of PCs. But stress test season is not over yet, so still no LOD switching. The GPU needs to feel the sweat! Work it! and stay tuned for some troubleshooting guide at the end of the post.
So what now? To reiterate, my goals is to make the 3D as feature rich as the 2D has been in record time, while still providing a snapshot progression that makes some sense. That tells a story. I figured the best way for that is to implement creation mode, like in Minecraft.
In creation mode you are given free reigns to build without pesky concerns like time, resources or the welfare of you dwarves. Even better, I should be able to pump out a working creation mode in a short period of time. On top of the creation mode then I can layer the rest of the features one by one and have a workflow that allows me to develop and test features in isolation.
Creation mode will have multiple stages. Stage one will allow the creation or destruction of any item in a map with infinite resources. Stage two will allow for the inspection and changing of all properties for objects. And stage three will allow natural interaction with the world: no longer will you place and destroy items, you can do stuff like harvest plants, use workshops and nature will run its course.
Further stages are possible but this is as far as I am planning right now. So basically LEGO without LEGO blocks. Don't sue me owners of the LEGO brand!
The first thing that creation mode needs is a way to select and destroy objects. Selection works as normally and you use the key "x" to issue a delete command.
The next step is going to be to allow the manual placement of objects on the map. More on that the next time.
While developing this I spent 95% of the time fiddling with the mouse selection. While preparing snapshot 1 I realized that the selection mechanism is not prepared to deal with the pure strain of the stress test and would crash, so I disabled item selection. Meanwhile I fixed it, but it was far too slow with so many objects. After a quick mouse gesture it would take a second or two for it to update. So I went about optimizing the hell out of it:
- I greatly optimized item population algorithm. It is at least an order of magnitude faster. This will have a global positive effect influencing everything, including LOD switching and simulation. The bad part is that a new cache was introduced. I can't cache the entire map because it would take too long and eat up far too much memory so I limited the cache tot he current level. Anyway, you can't select things from a different level with the mouse so this is a non-issue.
- Mouse update is a lot smarter and able to determine the section borders so it only updates as much as it needs. This also means that performance is directly proportional with the size of the area you select. So don't zoom out really really far and select the whole map and expect it to be instant, but it should still work.
- Mouse update is now able to determine if your screen relative mouse movement coincides with a coordinate change in the 3D environment, and if not it does nothing.
- Even with these changes mouse cursor movement was not perfectly smooth. So I implemented shallow update that is only used by the mouse system and does the minimal amount of work necessary to highlight an area.
As can be seen in the video, the contrast of the selected area is not great. I have some plans to improve this but this is not a task of urgency.
There are still tons to talk about, but I'll skip that for troubleshooting. Because of the snapshot system, I won't give troubleshooting advice for older snapshots, only things that are relevant for the next snapshot. So once snapshot N comes out, snapshot N - 1 ceases to be relevant:
- Performance is poor and/or visual artifacts, black boxes and other strange things are visible: if you are running on DirectX try OpenGL. And vice-versa. Also make sure your drivers and DirectX is up to date.
- Engine is unstable or sometimes it runs fine, other times it crashes on launch: stress tests are meant to really push the boundaries and up the system requirements. The engine is very sensitive and has a lot of RAM needs, both system and video. Since maps are random it can be that one time it generates a map that it is fine, one time it generates a map that ends up needing more resources than you have and it crashes. Scrolling and zooming can also have this effect. If the current map needs more resources that you have but you have scrolled to a less busy area of the map, once you scroll/zoom again new chunks of memory can be pulled in and it can crash. This will be less of an issue once system requirements are more precisely determined, stress tests are done and general system stability increases.
- Black screen on start up: either bullet point 1 or point 2, probably both.
- Some keys like "s" or "d" make the game stop working/screen go blank/do some other weird stuff: the GUI has not been removed, it is only superficially hidden. You actually opened up the inventory browser/dwarf browser/other dialogs but they are not visible. I won't fix this because I want those dialogs back ASAP. As a quick fix for snapshot 2 I disabled keyboard message forwarding to prevent these dialogs from opening (I probably disabled some useful shortcuts by this that you don't know about).
- Some areas of the screen (near the edges) don't react to mouse movement. As said, the GUI is only superficially and temporarily hidden. There is a window/panel at that given position that eats up you mouse events.