0.12.0 Development Thread

Announcements and infodumps from the Species dev team.
User avatar
Quasar
Site Admin
Posts: 1730
Joined: Tue May 29, 2012 2:04 am

0.12.0 Development Thread

Post by Quasar » Wed Dec 19, 2018 2:48 am

https://speciesdevblog.wordpress.com/20 ... ng-0-12-0/
Updates will be slowing down for a while as I work on multithreading for 0.12.0. This is a big and promising feature, but also a dangerous one. It’s kind of like summoning an eldritch god: you might get immortality, or your life force might be consumed to power a terrible murder portal through which demons can invade the earth.

(it’s important to make your analogies relatable)

The number one complaint on Steam is performance. And I get it. Species gets more interesting with more creatures. If you’ve got a supercomputer with a trillion cores that cost you as much as the first three Apollo missions, you’re probably going to resent it if it can’t run Species better than a machine somebody got in a garage sale for 5 bucks and may actually be a microwave. Unfortunately, there’s a good possibility it won’t because CPU core speed hasn’t significantly increased in the last decade.

Performance is not the reason I’m looking at multithreading, however.

This is how the game is currently built, using a bit of sample data taken from a quick P. specium simulation:

Image

As you can see, each frame time is given primarily to creature AI, specifically to the method called “UpdateBehaviourals” (that big red chunk of CPU time in the middle of each frame).

Logically, then, that’s the method I should extract and put into another thread, so it can run in parallel to the other operations.

Image

This would be the “simple” (not actually simple) way of implementing multithreading.

And to be fair, a potential 30% performance improvement (assuming ideal conditions) isn’t to be sneezed at. But to be frank, it’s not enough to justify how much development time and risk multithreading the update call introduces.

But most modern CPU’s have more than two cores, and there’s still a big chunk of time on the main thread going unused (that blue block in the picture labelled “await”), which means we’re not done. What if we could *split* the “UpdateBehaviourals” method across multiple cores, by updating some of the creatures on one, some on another, and so on?

Image

That’s a lot better: a whopping 70% improvement! (assuming ideal conditions and that this sample data is representative).

But even more importantly, from my perspective at least, the blue ‘await’ blocks are now on the other threads.We have spare CPU cycles, not on the main thread, but on the threads doing the AI.

This is the real reason I want multithreading in 0.12.0. I still have features I want to add, specifically to Creature AI. Creatures need to be able to rationally decide what movement method to use to reach a target, which requires increased situational awareness.Predators need to be able to find food from further afield, so they can travel to more habitable areas from across the map rather than just dying off once all the prey in their area are gone.Social creatures need to communicate with one another and factor those communications into their decision-making process. And each of those features will have an associated CPU cost, which I simply can’t afford at the moment.

But if I can properly parallelize the creatures “UpdateBehaviourals” routine…that is, not just offload it to another core, but offload portions of it onto all the other cores… then I’ll get a significant amount of spare CPU cycles to work with, and I’ll be able to implement those features without worrying about them impacting performance at all!

Of course, this is even harder to implement than the aforementioned “simple” option, which itself is nothing of the sort. But I’ll have plenty of time and incentive to whinge about those problems soon enough.

For now, let’s leave it on a optimistic note: if this works performance will scale with the number of cores you have.* More cores = higher creature cap!

Cheers,
Quasar



* (assuming ideal conditions and that the sample data is representative and that the earth hasn’t been invaded by demons pouring from a terrible murder portal)

Natural_20
Posts: 1647
Joined: Mon Jul 14, 2014 5:25 am

Re: 0.12.0 Development Thread

Post by Natural_20 » Wed Dec 19, 2018 4:10 pm

This is a big part of why I've been pushing for multithreading: the AI is only going to get more and more taxing, and with the current performance, that would pretty much eat that one CPU core alive. It's better to just get it over with so that, when you reach those big AI milestones, you actually have enough processing power to implement them.
Last edited by Natural_20 on Fri Dec 28, 2018 1:55 am, edited 1 time in total.
Quasar wrote:Dammit, we forgot to sell the psycho drugs and now the chickens are ODing.

User avatar
White parrot
Posts: 1810
Joined: Wed Sep 12, 2012 4:42 pm

Re: 0.12.0 Development Thread

Post by White parrot » Fri Dec 28, 2018 12:26 am

I'm waiting with bated breath. This could be huge if successfully pulled off.
At this point, we shouldn't be surprised by anything nature does. She's like a meth addict whose drug-fueled rampages unfold in slow motion and span millions of years.
Silly Otter wrote:Welcome to the forum.
Please ignore the cultists.

User avatar
Quasar
Site Admin
Posts: 1730
Joined: Tue May 29, 2012 2:04 am

Re: 0.12.0 Development Thread

Post by Quasar » Thu Jan 10, 2019 2:41 am

https://speciesdevblog.wordpress.com/20 ... -bodyplan/

I'll have more to say on the subject of multithreading soon.

User avatar
magmacube_tr
Posts: 740
Joined: Wed Jul 11, 2018 8:01 pm
Location: Now on the depths of the once-volcanic Hasan Mountain

Re: 0.12.0 Development Thread

Post by magmacube_tr » Thu Jan 10, 2019 7:44 pm

PLANT EVOLUTION

Sliding for world saves, imported cratures and that species counter-signifiyer-shower thingie on sattelite map.

Edit: and also replacing dead trees on savanna to acaica trees.
Your cube of magma with memes 8-)

Natural_20
Posts: 1647
Joined: Mon Jul 14, 2014 5:25 am

Re: 0.12.0 Development Thread

Post by Natural_20 » Tue Jan 15, 2019 2:12 pm

So on the Steam news, you mentioned seasonal cycles. I thought you weren't doing those because of the game's crazy-fast time scale? Are we just going to be playing on a planet with a very long orbit?
Quasar wrote:Dammit, we forgot to sell the psycho drugs and now the chickens are ODing.

User avatar
magmacube_tr
Posts: 740
Joined: Wed Jul 11, 2018 8:01 pm
Location: Now on the depths of the once-volcanic Hasan Mountain

Re: 0.12.0 Development Thread

Post by magmacube_tr » Tue Jan 15, 2019 2:30 pm

Natural_20 wrote:
Tue Jan 15, 2019 2:12 pm
So on the Steam news, you mentioned seasonal cycles. I thought you weren't doing those because of the game's crazy-fast time scale? Are we just going to be playing on a planet with a very long orbit?
Maybe the seasons would only be fertility based.
Your cube of magma with memes 8-)

User avatar
Quasar
Site Admin
Posts: 1730
Joined: Tue May 29, 2012 2:04 am

Re: 0.12.0 Development Thread

Post by Quasar » Wed Jan 16, 2019 2:52 am

Natural_20 wrote:
Tue Jan 15, 2019 2:12 pm
So on the Steam news, you mentioned seasonal cycles. I thought you weren't doing those because of the game's crazy-fast time scale? Are we just going to be playing on a planet with a very long orbit?
From any individual creature's perspective they'll play out more like glacial cycles, but yeah. The standard year length will probably be something along the line of 2 hours in-game, and the cycles will be applied to both temperature and fertility, so you can have a Wet season, a Hot season, a Dry season and a Cold season (or spring, summer, autumn and winter if you prefer).

Part of this is just for the fun of it and to fill out space on the planned 'Map Editor' screen, but it's also to apply disruptive forces and prevent evolutionary stagnation in long running simulations.

This is not for 0.12.0, but there's a very good chance it'll be soon after.

Natural_20
Posts: 1647
Joined: Mon Jul 14, 2014 5:25 am

Re: 0.12.0 Development Thread

Post by Natural_20 » Wed Jan 16, 2019 2:04 pm

Quasar wrote:
Wed Jan 16, 2019 2:52 am
Natural_20 wrote:
Tue Jan 15, 2019 2:12 pm
So on the Steam news, you mentioned seasonal cycles. I thought you weren't doing those because of the game's crazy-fast time scale? Are we just going to be playing on a planet with a very long orbit?
From any individual creature's perspective they'll play out more like glacial cycles, but yeah. The standard year length will probably be something along the line of 2 hours in-game, and the cycles will be applied to both temperature and fertility, so you can have a Wet season, a Hot season, a Dry season and a Cold season (or spring, summer, autumn and winter if you prefer).

Part of this is just for the fun of it and to fill out space on the planned 'Map Editor' screen, but it's also to apply disruptive forces and prevent evolutionary stagnation in long running simulations.

This is not for 0.12.0, but there's a very good chance it'll be soon after.
Hmm... well, glacial cycles seem to follow more of a hot-and-wet, cold-and-dry pattern, but that's neat. Maybe multiple options?

If you really wanted to make it customizable, you could give the player four "season" blocks and let them set climate conditions for each.
Quasar wrote:Dammit, we forgot to sell the psycho drugs and now the chickens are ODing.

User avatar
Quasar
Site Admin
Posts: 1730
Joined: Tue May 29, 2012 2:04 am

Re: 0.12.0 Development Thread

Post by Quasar » Sat Feb 02, 2019 11:00 pm


Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests