Author Topic: Multithreading Help Wanted  (Read 3873 times)

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Multithreading Help Wanted
« on: July 11, 2018, 01:35:00 pm »
Last release I asked for some help on the multithreading problem, which was clarified here.  At this point, I've basically hit a wall in my ability to improve the threading without getting really excessive in my expenditure of time.  There are a variety of other things that really need my attention right now, so I'm having to put this on the back burner.

That said, I've open-sourced our multithreading code and our core sim loop, so if there are any kind souls who want to take a look at it and help more directly with revisions, that would be super appreciated.  I know folks were a bit hampered by being blind to the code before.

How to get at/test code:

  1. Make sure that Steam has updated you to the latest build of the game (0.749 or later).

  2. Inside the install folder for the game, open the AIWarExternalCode.  There you'll find a AIWarExternalCode.sln visual studio solution.

  3. You can open that with visual studio community edition 2015 or 2017, and then it should let you compile directly to the GameData/ModdableLogicDLLs folder.

  4. Running the game after having compiled a new version into that folder will run it with your changes in place.

  5. If you want to use a different IDE, or even no IDE and just compile manually, you can do so.  Badger has scripts for doing so on linux, for example.

  6. The actual scripts of relevance are in the AIWarExternalCode/src/Sim folder (and its subfolders), which has a variety of C# files that I've added comments to.  There are other files that call into and out of those files, but all of the multithreading bits and the main-thread-bits that call them are all there.

  7. I've made a mantis ticket on our bugtracker that has the savegame, plus instructions on how to see the issues.


Any help is appreciated!  And I'm happy to answer questions. This thread is the ideal place to ask, since I get notified by email and anyone who is working on this can see what we're all talking about.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Multithreading Help Wanted
« Reply #1 on: July 11, 2018, 03:47:12 pm »
It's a cool idea, but that would require a refactoring of basically the entire game.  I think that we have far too much data to actually be able to do that, anyhow, to be honest.  Further down the document the suggestions start getting a lot more solid in terms of me explaining myself and folks thus having a better understanding of what to suggest.  The main game loop runs lightning fast at the moment -- it has no delays whatsoever.  The main problem is that the secondary threads are just not starting/stopping/something fast enough.  It may be as simple as some logic errors, or an issue with what appears to be some nested worker threads from my read of it (code was originally Keith's).
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Multithreading Help Wanted
« Reply #2 on: July 12, 2018, 12:05:18 pm »
I've got some code changes from BearPerson, which gets us set up well with some better profiling as well as getting rid of Thread.Sleep and identifying a different timing issue.  I'm in the middle of some of the DrawMeshInstanced bits right now, so I can't integrate his changes yet, but I will be right after that.  For now I'd suggest that everyone hold off investigating this too much, because I think that he's cracked the case (or at the very least moved the ball extremely far down the field).
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

 

SMF spam blocked by CleanTalk