Frogboy Frogboy

AI coding, I can’t even begin to express how excited I am

AI coding, I can’t even begin to express how excited I am

I haven’t got to design an AI since…well 2006.  It’s been a long time and the Stardock games team of 2013 is insanely awesome and the tech is just amazing too.

Now, I programmed the AI in Legendary Heroes and helped on the AI in Fallen Enchantress (I wrote worker functions for War of Magic).  But I haven’t got to sit down and make something from scratch since GalCiv II.

And wow, things are so much better now.  Virtualization, lots of cores to handle threads (GalCiv II was written for a single core with 1 hyperthread).  The things I can do now are, well they’re just plain sick.

While I am quite proud of the AI in Fallen Enchantress: Legendary Heroes, it was something I had to retrofit onto Elemental: War of Magic. It was a miracle to get it to work as well as it does because War of Magic was single threaded.  I had to make it multithreaded after the fact (if there are any programmers here, please feel free to comment to explain how nasty that is).

In GalCiv III, the AI is able to operate on a virtual machine version of the game state. So I can monkey around in real-time without it affecting other players. I can not only have every computer player have its own thread, I can have different components of the AI have their own threads and in multiplayer, I can distribute the work up across the different players.

There’s a lot more too. From crowd sourcing ship designs, tech tree strategies, planetary improvement strategies, etc. to throwing raw number crunching stuff onto the player’s video card.  We’ve come a long way from 2006.

80,927 views 39 replies
Reply #26 Top

Quoting Achronous, reply 20

OMG, the stars, the stars!!

Joking aside, I thought yellow star habitability was common knowledge, as Brad said. Searching in the forums (Galciv2) for it brings up a number of threads that I remember. I think it wad mentioned in the manual as well, but I can't vouch for it.

The single most annoying thing wasn't the AI knowing where the stars were, it was knowing where all the resources were as it claimed all of them if you were lax.

Now, I'm starting to suspect something about those as well... 

 

EDIT: Ok, Brad, maybe you shouldn't have said anything....

Reply #27 Top

Quoting Wetballs, reply 23

Yeah well, I don't think I'll ever look at yellow stars the same again.  Did everyone know they had better planets?  I never realized that.
 

 

I didn't know about the patters or intentions, but my gut feeling always has said that programmers make the yellow sun look like Earth's solar system ;) (I realise that in truth the Earth is not on all yellow suns, and that the gut feeling is stupid at best).

Reply #28 Top

Quoting Gaunathor, reply 25

Quoting Wetballs, reply 23Yeah well, I don't think I'll ever look at yellow stars the same again.  Did everyone know they had better planets?  I never realized that.

He didn't say "better planets", but "good planets", which is accurate. The best planets are around purple stars.

 

Gah!  Don't tell me that!  Now it'll be impossible for me to forget!

Reply #29 Top

I remember the Dread Lords spawned in my galaxy, and after I stopped their reign of terror I found out that their planet "Amalda" was a native class 60. After I took control of it, my planet quality abilities and PQ improvements made every single tile available. I was beside myself with joy; I seriously have never seen anything like it since, maybe it was a bug?

Then there was a time I found a planet with a PQ of 1, or a blue star with five "Purple water" habitable planets or that time my game glitched out and spawned a solitary planet without a star.

Hopefully the the planet-generation system in Galactic Civilizations 3 is more random and less deterministic than its predecessors; the outliers and the exceptions make the game more fun in my opinion. Things like rogue planets, binary stars, more varied planet environments and the like would really add a lot of personality to the game.

Here' hoping Stardock can make it happen

Reply #30 Top

Quoting DarkSide73, reply 18

 Especially in a game of this nature a couple of errands threads could cause memory leaks.  And since they are running on seperate threads that is going do be no easy task to properly manage even with some assistance from the language.

 

Wait, what memory leaks? Are you talking about some unmanaged libraries used in the threads that cause the leaks, or can you provide a example code where such thing happens? By memory leak I assume you mean memory that is allocated but never released, but such thing shouldn't happen in the C#. On the other hand, if you are talking about accessing indexes not existing any more.. Now there is a real dilemma, but not without known solutions for most cases (and it depends on the data and requirements). 

Reply #31 Top

Quoting ParagonRenegade, reply 29
I seriously have never seen anything like it since, maybe it was a bug?

Maybe. Amalda has a base PQ of 36, if I'm not mistaken. Still, it's possible that one of the PQ enhancing random events happened.

Quoting ParagonRenegade, reply 29
Then there was a time I found a planet with a PQ of 1

Those are extremely rare in TotA, along with PQ 2 worlds. I'm not sure, if they are even supposed to appear in TotA anymore. In DA, on the other hand, they are much more common.

Reply #32 Top

Quoting Gaunathor, reply 31
Those are extremely rare in TotA, along with PQ 2 worlds. I'm not sure, if they are even supposed to appear in TotA anymore. In DA, on the other hand, they are much more common.

In DA they were pretty common, but I've never seen anything under 4 in TA. The best part of the PQ1 planets (and why they were cut) is that the AI would not colonize them until every other available planet had been claimed. They frequently terraformed up to level 16, even 19 - and the AI just let the player have them.

Reply #33 Top

Quoting WIllythemailboy, reply 32

In DA they were pretty common, but I've never seen anything under 4 in TA. The best part of the PQ1 planets (and why they were cut) is that the AI would not colonize them until every other available planet had been claimed. They frequently terraformed up to level 16, even 19 - and the AI just let the player have them.

I am/was playing the current version of TA.

That being said, I've only ever seen one once, on an immense map with abundant everything. I found it by accident by going to the planet list and searching "planets- sort by class". I was so surprised.

 

With all my abilities, it became a class 26 :3

Reply #34 Top

Hopefully such AI tweaks aren't needed in GalCiv III, and the AI can compete with said asymmetrical information.

 

Purple stars I remember having the best planets (class 26s) on occasion, but those were rare.

 

 

Reply #35 Top

PQ1 planets? I have seen only one per game, and it was always named "Wisp". I never saw any PQ2s or PQ3s, but perhaps "Wisp" could be enhanced to those levels. And "Mars" in Sol's orbit has always started as PQ4. 

Reply #36 Top

Quoting Lucky, reply 35
PQ1 planets? I have seen only one per game, and it was always named "Wisp".

I think you're mistaken. Wisp is the secondary planet in the Altarian home-system, and it's a PQ3 world (always has been). 

Reply #37 Top

Quoting Gaunathor, reply 36


Quoting Lucky Jack, reply 35PQ1 planets? I have seen only one per game, and it was always named "Wisp".

I think you're mistaken. Wisp is the secondary planet in the Altarian home-system, and it's a PQ3 world (always has been). 

Hum. I'll have to look again when I have time.

Reply #38 Top

Ive seen such happen when using c# to dispose of connections to dbs after reading large data sets into memory (10,000 + records per read) the dispose method does not clean up when you call it.  Could not tell if the issue was related to MSSQL, DB or Oracle as connections were to all three and the service I was running also needed to keep running checks periodically for activity.

 

At the time I also thought that c# should not have an issue with memory but more research on the way dispose actually works suggests otherwise. To manage the AI and all of the things going on in this game and to do so across threads will be no easy task in any language including c#.

 

Reply #39 Top

Quoting DarkSide73, reply 38

Ive seen such happen when using c# to dispose of connections to dbs after reading large data sets into memory (10,000 + records per read) the dispose method does not clean up when you call it.  Could not tell if the issue was related to MSSQL, DB or Oracle as connections were to all three and the service I was running also needed to keep running checks periodically for activity.

 

 

What .NET will do automatically is release the managed memory when not referenced any more. But in truth you are probably not talking about that with the dbs issues. What you are talking about is disposing a object by doing something object specific. In case of dbs, it means sending something to the db engine and basically saying 'please close the connection'. That is not something .NET can do, unless of course  you'll tell how to do it by using IDisposable interface and the 'using' keyword. Normal Microsoft libraries regarding mssql have that interface, but it is still your job to use it. There could be also bugs, since those libraries use to some extent the unmanaged hell (another thing .NET cannot control).