better game engine optimization scheme expected

multi-core CPU not fully utilized

Dear programmers of Sins of a solar empire rebellion,

The overall game is wonderful, however, approaching later stage of the game when there are huge number of units of any kind (including all structures, trade ships, etc), the game becomes very slow. Typically, in a major battle involving 6~10 players, each having hundreds of ships (including carrier fighters and bombers) in one gravity well, the game is so slow and essentially unplayable. I have a lenovo Y470 computer with 2G video ram and 8G DDR3 ram, CPU is 2.0G 4-core with Hyper-threading, turbo boost to 2.66GHz, graphic card is Geforce 550M. I realize that even when the game is very very slow, it does NOT make use of multi-core CPU resources. Typically, it only uses 2 threads, one for drawing graphics, one for processing game logics.

I myself am a programmer, with some experience in optimization. From my point of view, the game engine can be optimized for parallel processing which makes use of all CPUs. The object list can be processed in parallel by making a duplicate copy which doubles memory used for storing all dynamic object data. So create 2 list buffers, one is home buffer, the other copy (target buffer) for updated objects. During update, the home copy is kept read-only and is accessible by all threads, updated information is stored on the target copy, and all update is based on information in the home copy only, and each update only write the data of updating object (a thread updating object 319 can read any objects in home buffer but it can only write to object 319 in target buffer). Updates of objects which will influence the state of other objects have to be put into a list which is to be processed after the parallel update is over.

To better address the multiple object influence issue, alternatively, you may consider constructing a directed graph, in which each object is a node. If A influences B, there is an arrow from A to B. When you update an object, you lock the object first, if an object is locked by some other thread, you process the next object first and come back to it later.

In such a way, there will be no conflict among all threads. And the entire game logic process can be parallelized, which can make better use of multi-core CPU. Thanks!

Cheers,
Xuancong
g0801784@nus.edu.sg

8,989 views 9 replies
Reply #1 Top

While we all wish it was feasible, keep in mind this game engine was made in 2007 (parts of it perhaps earlier than that). I'm sure they now know of tons of things they could do know to make the game take advantage of how much better people's PCs are in this day and age, but I'm sure its much harder to update an already large game to take advantage of these things without tons of bugs and stability issues. We'll just have to wait for a sequel I'm afraid before our 8GBs and multicore PC will be of any use.

Reply #2 Top

Thanks GoaFan77.

Then is it possible for me to acquire the source code of the game engine? If the engine module is isolatable I don't need other modules' codes or resources. I can attempt to change it to multi-thread. It shouldn't be that complicated. I used to change code from single thread to multithread. Is the game engine in an isolated .dll file or what? I use Visual Studio 2012.

Reply #3 Top

TBH i do not know a lot about programming but heck if you could make it devs should give you aces to it. Perhaps with mutual agreement they could incorporate it in one of their later patches :P

 

Reply #4 Top

Quoting xuancong, reply 2
Thanks GoaFan77.

Then is it possible for me to acquire the source code of the game engine? If the engine module is isolatable I don't need other modules' codes or resources. I can attempt to change it to multi-thread. It shouldn't be that complicated. I used to change code from single thread to multithread. Is the game engine in an isolated .dll file or what? I use Visual Studio 2012.
End of xuancong's quote

I believe they are pretty protective of their code, but you could email the devs I suppose.

Reply #5 Top

It's a nice offer but unless the product is about to be abandoned I don't think they will release the code to the community.  Maybe they could hire you to do an analysis of the feasibility.  That would require ironclad confidentiallity and non-compete contracts.  

 

 

 

Reply #6 Top

I am not very familiar about devs. Would you introduce to me how it works?

What's the difference between the Rebellion.exe and Rebellion.dev.exe or something like that?

Is Rebellion.dev.exe less optimized than Rebellion.exe?

I wish to sign whatever non-disclosure or non-compete contracts they want. Do you have access to internal members of iconclad, say programmers of that engine?

I may or may not succeed in parallelizing the engine (depending on the complexity of the engine), but I just want to have a try first. It's quite a big pity for such a wonderful game not to have parallelization so that it becomes so laggy with large fleets. Thanks a lot!-:)

Reply #7 Top

I'm of the mind to hope for the best, but not expect it until the sequel. I just hope we'll get a teaser trailer before the end of this year

Reply #8 Top

I can't see any circumstance where Ironclad would expose it's engine source to anyone outside of their company or Stardock. Maybe it will go open source at some point, but I doubt that will happen anytime soon if at all for a multitude of reasons.

You also seem to be overestimating your skills in this regard, but hey one can dream I guess.

Reply #9 Top

You could always PM Yarlen and he could point you in right direction or say no straight away. Or Frogboy for that matter...

But yeah as far as I got while reading some of moders and devs conversations they are very proud and keep source code tight to their chest so it is a long shot to get it, As for changing it to multi core support they said that it is 1 year project and to complex to do for any expansion.

If they will ever release SINS 2 or new game that will use it they will have to bite into it but......