News for hackers. Stuff that matters.
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by simaldeff on Thursday June 25, 2020 @07:46PM (#23647104)
That's great but I wish the creator'd do something about death by FPS. Which is arguably how I end up all the time. I like to build big complex fortresses with a lot of industry and a lot of mining. And oftentimes I end up with a lot of animals to produce meat, leather and bones (had a very promising Draltha industry at one point). It's quite disheartening to put time in a fortress and "die" by FPS just because you are doing good. Will still buy the Steam version (been supporting them for a while now).
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by grawprog on Thursday June 25, 2020 @08:47PM (#23647563)
Being able to explore goblin spires and human cities in adventure mode would be nice too. It's sad when you have to avoid exploring the biggest city in your world mode because taking a step takes two minutes or more. It sucks all the more because exploring things in cities in adventure mode has given some of the best roleplaying adventures i've had in a game. It just take so damn long to do anything.

Can't think of any other game i've played where the leader NPCs of a city were vampires who'd taken over the city a few hundred years ago and were at war with a church started by a human who found jewelry created by a dwarf who'd ran away after murdering a child and crafting their bones into jewelry in a fell mood that was found by a random human in the city who started a cult around it, who then took up a personal vengeance with the vampire overlords and were undergoing covert operations against them that i disrupted when I killed the fuck out of everyone, gathered the child bone jewelry and read about that shit in legends. All procedurally generated and created on the fly through the simulation of all those respective NPC's lives.

Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by chongli on Thursday June 25, 2020 @09:55PM (#23647941)
Caves of Qud [1] is a fantastic roguelike with procedurally generated backstory, quests, towns, etc.

If you like the classic Fallout games (1 & 2) and you enjoy roguelikes with a lot of weird stuff, I think you’d get a kick out of CoQ. The game has incredible atmosphere that gives you this feeling like you’re exploring a real, living, breathing world. There’s a lot of depth to the gameplay as well, with deep character building and a complex crafting system.

I really want to get back to playing it but I’m in school right now and have a ton of work to do!

[1] http://www.cavesofqud.com/

Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by kibwen on Thursday June 25, 2020 @10:51PM (#23648204)
I just learned about Caves of Qud by this great talk by its developer that goes over examples of its procedural history generation: https://www.youtube.com/watch?v=ClGAApZYIvI

Apparently it's slated to leave early access in Q4 2020, so I'm holding off on buying it for the moment, but I'm very eager to play it.

Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by programd on Friday June 26, 2020 @02:21AM (#23649240)
And here is the paper [1] about how they procedurally generate the histories in Caves of Qud. Very interesting both from a storytelling theoretical point of view, and from a practical programming point of view (state machines and replacement grammers)

[1] http://www.freeholdgames.com/papers/Generation_of_Mythic_Bio...

Makes you wonder what you could do applying something like the GPT-3 AI text model to this kind of problem (history generation).

Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by chongli on Thursday June 25, 2020 @11:19PM (#23648336)
Definitely make sure you don’t forget to play it. It’s an absolute treasure. I’ve played to the end of the campaign so far and I can’t wait to play some games again when I get on a work term this fall!
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by rhn_mk1 on Friday June 26, 2020 @12:37AM (#23648763)
I tried Caves of Qud, but after dying a dozen times due to botched combat, I can't get into it.

The way I played I got more of a NetHack in an open world setting vibe, rather than a sandboxy exploration of a generated world.

I'm not sure what I was doing wrong. Was I focusing on battle too much? Is it even avoidable when the plains are full of monsters, and goals are placed on the other side of the plains?

Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by chongli on Friday June 26, 2020 @04:31AM (#23649909)
CoQ has a steep learning curve with the combat. There are some things to learn that are really not obvious. Building a new character is a complicated process and it's easy to mess up and make a character that seriously struggles in the early game. It took me about a hundred hours of play before I got a quasi-win (reached the end of the quest line as they've written it so far).

You can play characters which avoid combat to a large extent, in quite a few different ways. You can get so good at talking to people that you can get some extremely powerful allies to do all the fighting for you. You can also tinker up some really powerful automated turrets that will clear enemies no problem, and use force fields to protect yourself from attack. You can also avoid combat to a considerable extent by picking up some wilderness lore.

Having said all that, combat is a major part of the game, just as it is in most roguelikes.

Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by hombre_fatal on Thursday June 25, 2020 @09:17PM (#23647751)
Only game I've played with emergent (alt-history) stories like that is Crusader Kings.

Every friday the subreddit has stickied thread for sharing in-game stories: https://old.reddit.com/r/CrusaderKings/comments/hc4iyp/feuda...

https://www.destructoid.com/crusader-kings-ii-s-community-is...

Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by stryan on Thursday June 25, 2020 @08:53PM (#23647598)
Considering DF is still all mostly single threaded and IIRC Toady doesn't really know how to make it multi-threaded (per his own admition) that might take a while.
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by Twinklebreeze on Thursday June 25, 2020 @09:01PM (#23647647)
Every time multi-threading gets brought up one of the devs explains that being single threaded isn't the bottleneck. It is the cpu cache that is the bottleneck.
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by genocidicbunny on Thursday June 25, 2020 @11:51PM (#23648510)
And if it was written with a single thread in mind (which it most likely has been) naively 'multi-threading' it will likely not help do much except increase the number of bugs. Too many independent but intertwined systems communicating with each other.

Making DF use multiple cores efficiently would be amazing, but I have serious doubts its viable in the short-ish term without a significant rewrite. The most you're likely to see is some peripheral systems offloaded onto background threads when possible.

My hope is that with the upcoming Steam release they make enough money to hire another veteran game programmer or two to help them work on game and make it perform better.

Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by opportune on Friday June 26, 2020 @01:58AM (#23649143)
DF has many things that could be multithreaded or perhaps even vectorized (such as the heat simulations) very easily.

I agree you can't make the whole agent-based system multithreaded overnight but there are many calculations happening with every 'tick' that I would be quite confident are easily parallelizable.

Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by rhn_mk1 on Friday June 26, 2020 @12:39AM (#23648772)
Isn't (a large part of) DF basically a huge cellular automaton? That problem is already solved for multiple threads.
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by genocidicbunny on Friday June 26, 2020 @01:20AM (#23648934)
In a lot of ways, yes it is. But that's where theory and practice diverge. Could all the current systems of DF be implemented anew in a way that easily scales to however many CPU cores are available? Most likely in some way yes they could be. Could the current systems as implemented be ported to better scale with the number of available CPU cores? Questionable.

Game engines are incredibly complex -- there are usually dozens if not hundreds of systems interacting with each other. Over time, this all ossifies to the point where making changes to one system requires changes to many other systems. This is kind of a fact of life with almost every game engine or codebase that I have encountered, worked with, or heard of. When you start getting into more than a decade of development, there are going to be a lot of tangled systems that are going to be very difficult to pull apart.

Yes, the fundamental problem may be solved for multiple threads, but DF solved it for one thread, and that solution is part of what makes DF fun. Messing with that solution is asking for trouble.

Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by imtringued on Friday June 26, 2020 @04:48AM (#23649996)
Just because something uses a grid doesn't mean it's a cellular automaton. You can probably write DF as a cellular automaton but that's probably not what happened.

If dwarfs have x,y coordinates that mark their position and the coordinates are changed when they move then it would not be a cellular automaton.

A cellular automaton would take a cell and look at surrounding cells to see if there is a dwarf that wants to move to the currently processed cell and switch the current cell to a new dwarf cell. The dwarf cell would see that the dwarf can successfully move and delete the dwarf cell.

Which method do you think is DF using?

Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by rhn_mk1 on Friday June 26, 2020 @03:46PM (#23656154)
I think individual dwarves could still be modeled as cells, if there was an additional layer (or a single cell?) holding their future actions.

The automaton would lose the nice property of being spatially isomorphic to the screen, and the possible states would explode, but if my understanding is correct, it could still be a cellular automaton.

Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by Macuyiko on Friday June 26, 2020 @02:54AM (#23649419)
Forgive my ignorance, but do you have any good references to multi-threaded cellular automata implementations? This is something I've been dabbling with myself.
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by imtringued on Friday June 26, 2020 @04:54AM (#23650021)
You have two grids. Clear grid 2. Go over grid 1, calculate the new state for the current cell, write it to the second grid. At the end of a step you swap the grids.

Just slap on a good old "#pragma omp parallel for" with OpenMP (a nice guide is here [0]).

[0] https://bisqwit.iki.fi/story/howto/openmp/

I also found this pdf if you are interested. http://www.shodor.org/media/content/petascale/materials/UPMo...

Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by 0-_-0 on Friday June 26, 2020 @06:23AM (#23650445)
You could even do it on the GPU, with 1 thread per cell.
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by throwaway4666 on Friday June 26, 2020 @08:46AM (#23651362)
We don't really know how feasible multithreading is, but the community suspects at least some tasks could be computed on different threads, such as e.g. the pathfinding stuff that one of the worst offenders when it comes to FPS.
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by ViViDboarder on Thursday June 25, 2020 @10:33PM (#23648125)
Does that sound right? Do I have this wrong: there is too much to cache so some of the memory goes to RAM or disk where loading will take longer than cache. You could move some of the loading to another thread so that the UI (text or otherwise) can continue while other data in the backend is moved around between cache, RAM, and disk, and then processed before sending to the interface.
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by foota on Thursday June 25, 2020 @09:19PM (#23647771)
Don't modern processors have more cache available between all cores than available to a single core?
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by jayd16 on Thursday June 25, 2020 @11:27PM (#23648368)
They must mean its memory I/O bound.
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by foota on Friday June 26, 2020 @01:52AM (#23649104)
I think they meant it only runs quickly enough when everything's in cache? But that doesn't make much sense to me. It's really hard for me to believe it'd be I/O bound though, when memory bandwidth is like tens+ of gigabytes per second?
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by imtringued on Friday June 26, 2020 @05:28AM (#23650194)
IO bound can also mean that memory latency is a problem. It's not difficult to believe that DF is doing lots of pointer chasing.
Re:Dwarf Fortress Creator Explains Its Complexity and Origin... by ruste on Friday June 26, 2020 @10:31AM (#23652367)
I've started enjoying the game a lot more when I lowered my population limit (like to 10-15) and started playing smaller forts. Makes FPS death much less of a problem and means I can actually take care of my dwarves instead of rushing to keep up with population growth. Not breaching the caverns also helps a _lot_ with FPS.