July 20, 2017, 05:36:39 AM

Author Topic: Khazad - An opensource Dwarf Fortress like game  (Read 17311 times)

Impaler

  • Full Member
  • ***
  • Posts: 145
    • View Profile
Re: Khazad - An opensource Dwarf Fortress like game
« Reply #45 on: December 15, 2015, 02:50:56 PM »
Please understand how obsolete my processor is, a comparable chip can be purchased for $30 today which is practically the bottom of the market.  At the high end of the market such as Intel i7 are 4-5 times faster then my CPU in a multi-threaded benchmark.

I only activated my defective 3rd and 4th core for brief testing to confirm the sequential bottleneck and it's elimination, I do all the rest of my development and testing on 2 cores and extrapolate what the quad core performance would be.  I expect my own system to be the lowest machine spec the game needs to be tested on and my testers will have access to higher end machines which can show what the performance curve is on better machines.  I set the ultimate performance goal for a quad core (only twice my systems normal performance) because the goal is SO high, each game second is actually 12 logical slices within-which things can happen, so running at 4,000 times real time is actually 48,000 logical slices per second. 

Such levels of performance are astronomically high and what's been achieved so far already blows everything else in the genre out of the water.  The iteration by a simple loop over all objects would never have gotten this far, I've been using a Heap sorted by the future tick on which an object needs an update, and even that wasn't fast enough so added a circular queue based on tick modulus for the fastest updates.

I intend to squeeze as much performance as possible out of the code in the long run (as I really like the development of path-finding code) and if this exceeds my goals then all the better, but the current speed is adequate for building the basic game-play around, once the game content gets high enough that a real late-game emerges then it would be time to attack performance again.

Impaler

  • Full Member
  • ***
  • Posts: 145
    • View Profile
Re: Khazad - An opensource Dwarf Fortress like game
« Reply #46 on: December 16, 2015, 05:30:43 PM »
Good news, the new Khazad forum is up and running at www.Khazad.net

I encourage everyone following the thread to register and post here or PM me with with the user-name so I can activate the account.  I'll be moving all my development discussions their and making more of them as well, I'll likely only post here when releases are made or to provide a link to a dev diary.

Impaler

  • Full Member
  • ***
  • Posts: 145
    • View Profile
Re: Khazad - An opensource Dwarf Fortress like game
« Reply #47 on: December 30, 2015, 12:27:04 AM »
I've decided to rename some of my map structures to better match the lingo common in Minecraft,  henceforth the smallest 1 m^3 bits of the map are 'Blocks', the 32x32x32 groups of Blocks are 'Chunks', a 512x512x512 area of Chunks will be a 'Sector', a 32x32 group of Sectors is a 'Region' and a world map the size of Earth would be about 48x48 Regions.  Note that the world will be only 1 sector thick, but this is a depth of ~16 km and provides all the depth necessary to go from the tops of mountains all the way to the bottom of the ocean and then some down to some kind of magma sea.


The noticeably large number of Chunks in a Sector is possible because chunks will actually vary in size and will contain lower resolution Blocks when they do, at the largest sizes it will only take 32x32x32 chunks to fill a sector.  Note that only a fraction of these would ever even be created as the surface of the ground will generally stay within a narrow band allowing all the above and below volume to be omitted until needed.  The area of the players settlement would be at the highest resolution with a gradual falloff at distance.


In other news path-finding performance has climbed to 1800x (on 2 cores) after the elimination of an unnecessary memory allocation during node expansion.   Also the rendering thread has been given highest priority which is greatly reducing, but not eliminating, lag when the simulation it maxing out all cores.

Impaler

  • Full Member
  • ***
  • Posts: 145
    • View Profile
Re: Khazad - An opensource Dwarf Fortress like game
« Reply #48 on: December 31, 2015, 10:31:21 PM »
Another major pathing improvement that's speed up simulation speed by a factor of 3x, I had to start testing under higher populations of 200 and my 2 cores max out at 2400x speed now.  This puts me just a factor of 8 from the ultimate goal.

The technique I used was to put a very small doubly linked list 'above' the priority queue heap structure that holds the A* fringe nodes, nodes are popped from the list if it is not empty (otherwise take from Heap) and are always inserted into it which sorts them in the same priority the heap uses, then before the next node pop the list is trimmed back to just 4 nodes from the bottom up (lowest priority) and these are sequentially added to the heap.

What this dose is keep the amount of heap reorganization down to a minimum because A* is always expanding nodes with priorities very close to the current heaps root which makes for a slow reorganization.  The list keeps at minimum saves 1 pop and one insert into the heap each node expansion cycle while also sending most nodes in a small sorted batch which are absorbed by the heap at minimal cost.

Impaler

  • Full Member
  • ***
  • Posts: 145
    • View Profile
Re: Khazad - An opensource Dwarf Fortress like game
« Reply #49 on: January 03, 2016, 12:14:46 AM »
Now at 3,000 speed under 200 population after tweeking Heuristics and trimming the list down to a single element after each node expansion.  Just a factor of 6x from goal and around 30x faster then a month ago.  I'm currently working on getting low detail terrain meshes to generate properly and hunting a bug in the new terrain slicing system.

Impaler

  • Full Member
  • ***
  • Posts: 145
    • View Profile
Re: Khazad - An opensource Dwarf Fortress like game
« Reply #50 on: January 10, 2016, 11:15:28 AM »
I'm moving into final small features and long delayed fixes before freezing for release testing.  The terrain slicing that the side scroll bar provides can now be replicated by holding the scroll-wheel down and scrolling, this will cause the camera point of focus to move up and down which is indicated by the white 'eye-ball', the scroll-bar moves in sync with this scroll-wheel movement.  Scroll-wheel movement when not pressed down still zooms the camera.

I've also improved the map generation by making better (and in fact simpler) use of perlin-noise to create a landscape more like Minecraft or Gnomoria itself with a series of smoother hills covering large areas.  I'm now focusing on reducing the memory footprint of the map and speeding up generation so the long promised giant maps do not require annoying long generation times.  Below is a screenshot of the new map generation.

« Last Edit: January 10, 2016, 03:02:18 PM by Impaler »

admanter

  • Full Member
  • ***
  • Posts: 123
    • View Profile
Re: Khazad - An opensource Dwarf Fortress like game
« Reply #51 on: January 11, 2016, 08:56:12 AM »
That looks really great. I'm excited to try it. I just need to put down my other games.

Lost gnome

  • Newbie
  • *
  • Posts: 26
    • View Profile
Re: Khazad - An opensource Dwarf Fortress like game
« Reply #52 on: January 27, 2016, 02:05:18 AM »
The potential for this game and the vision you have provided on your forum still leaves me in awe. You should seriously think of kick starting this. At the very least the rest of us me are mortals will be able to access the depth of DF in a modern up to date package some time in the next five years. Toady is a genius but also a fool at times.

Impaler

  • Full Member
  • ***
  • Posts: 145
    • View Profile
Re: Khazad - An opensource Dwarf Fortress like game
« Reply #53 on: January 27, 2016, 11:12:34 PM »
Thx gnome, my intent has always been to build an active ongoing open-source development team and have already gotten help from a number of people working in an volunteer manor and this is the way I'd like to continue. I feel that will make for a much better ultimate game then keeping the source closed.

While I have considered excepting donations at some point when a more playable state is reached but kick starter is a very definite commitment to deliver a product for sale and it would not be a volunteer effort anymore, Patreon is more the model I might use but it still presents difficulty in how developers would share in any funds as I expect developers to come and go over time, and I would certainly want a community that can carry on in my absence.  I generally find that money sours that kind of cooperation.

The best way to grow and accelerate the project right now is for developers to join and if your not a developer to tell other folks who might be interested in the game about it and encourage them to do likewise according to their skill sets.  When my upcoming release is ready (the code is feature frozen right now and I'm addressing bugs) that will be the time for a significant promotion push.  Anyone who thinks they can help should PM me and we can start planning.