Saturday, 3 August 2013

Work's been a little slow lately but still going, also been distracted a bit with the new Civ V expansion.. just for researching ideas of course... lol. I did find a simple code statistic generator that I ran on my code to see how much I've done and for anyone else who might be interested:

Files: 26
Code lines: 25456
Comment lines: 4839

Classes: 217 (0 or 0.00% commented)
Class fields: 1250 (5.76 per class, 0 or 0.00% commented)
Class methods / functions: 1446 (6.66 per class, 14 or 0.96% commented)

Global functions: 93 (0 or 0.00% commented)
Global variables: 337 (0 or 0.00% commented)
Constants: 17 (0 or 0.00% commented)

Total items: 3360 (14 or 0.41% commented)

It doesn't count commented functions\method the way I comment them so I have more then the 0% - 0.96% commented code. This is just my code and doesn't include any code for Irrlicht the renderer or the BlitzMax wrapper.

I also did some work trying to get multi-threading working though it seems with BlitzMax that the built-in garbage collector isn't very fast for multi threaded programs and basically causes the programs to freeze for a second ever 2-3 seconds which isn't worth it. I might do some more research into it later when the multithreading is more obviously needed, maybe manage memory more carefully or do some manual clearing if possible. It might make it usable but at the moment the AI code is faster single threaded anyway. Probably because the GC freezes, total turn time went from 9 seconds ST to 19 seconds when MT for the same turn processing)  I'm sure this will change once it's doing more of what I'll add to it.

I've added the ability for the AI to determine when to declare war on another empire. At the moment it takes into account quite a few variables such as how many wars it currently has, the history and outlook of each war and to military strength for each war and estimated strength for them all together. So it shouldn't be declaring war on a really strong empire especially when its already got other wars that aren't looking so good... etc.

I'm still going on the AI to determine when to end wars and make peace, I was working on that then realize I really need to be able to get the AI to say what it will want if another empire wants to make peace with it. Then from this you can get and AI that is at war but wants peace to get the cost (Cash, ships, planets, etc) it will be for each war it currently has then determine which empire(s) it should make\pay for peace with.

So while I was working on that part of the AI I've gone back to the working on the diplomacy screen so I can initiate trades\offers with the AI and more easily debug\see how the AI will value each\trade offer. Once the player diplomacy screen is done. I'll get the AI response working correctly so then i can get back to the relationship work and hopefully get the 2 integrated with each other properly.

No comments:

Post a Comment