SOTSOS v0.3.9 - speeds up UI and turns

Moderator: Makail

Post Reply
nugarin
Posts: 127
Joined: Wed Dec 05, 2012 8:03 pm

SOTSOS v0.3.9 - speeds up UI and turns

Post by nugarin » Sat Dec 29, 2012 7:05 pm

SOTSOS - sots on speed!

ManagedCache needs tweaking - it installs and seems to run, but I wouldn't recommend using it until I've verified that its fully compatible with 2.0.24917.1

IMPORTANT: Should you encounter problems with SOTS2 while running SOTSOS - do test without SOTSOS (preferably with clean game), before reporting any issues to Kerberos.
Do use https://github.com/nugarin/sotsos/issues for reporting and tracking bugs in the mod and any side-effects.
SOTSOS is known to break MP - will find out what is happening and solve it when I get time - running low on beer-money at the moment, so sotsos is not getting much love right now.

General improvements and speed-ups to the game.
More responsive UI and about 1/3 faster turn times (tested with 400 star systems/7 players @ turn ~300) - last checked with 2.0.24759.8, needs verifying with current version.

Current version is 0.3 build 9 - supports 2.0.24917.1

Screenshot of a modded admiral manager UI - viewtopic.php?f=39&t=40697#p477443

Binaries/Source
https://github.com/nugarin/sotsos/tags

Installation instructions
https://github.com/nugarin/sotsos/wiki

Goals of the project are
  • General speed-up of the game
  • Advanced hooks for modding.
  • Agile temporary workarounds for vanilla issues
  • AI customisation
  • Advanced empire management

Implemented features
  • Managed cache
  • Faster game experience - especially noticeable with station list/tech tree/empire summary screen - not verified with latest version
  • Fully externalised patch-definitions - everyone with IL Spy and a text editor can now write patches:)
  • CIL/xml patcher and its GUI.
    • Pimped up admiral selection screen - more admirals on screen + filtering by traits.
    • Enable very hard AI difficulty
    • Refresh "turns left to finish the build order" number on the star system when fiddling with teh production sliders.

Coming next
  • Empire management grid for trade/production and ship construction
  • Instant station-list/tech tree node selection in the late game
  • Better installer with less hard-coding.
  • Optimised station list handling
  • CLI for the patching engine

    Planned features
    • Rally point functionality for the newly built ships - automatic caravan fleet construction
    • Continue speeding up the game
    • Custom UI-s for managing the empire (BuShips, BuPers, BuPlan)
    • AI customisation.
    • Support full CIL instruction-set

Issues:
https://github.com/nugarin/sotsos/issues

Source code and binaries are available @ https://github.com/nugarin/sotsos

People with coding experience are welcome to fork the code and send me their pull-requests.

Cheers,
nugarin
Last edited by nugarin on Fri Mar 01, 2013 10:29 pm, edited 36 times in total.

mikhailincali
Posts: 29
Joined: Thu Dec 06, 2012 12:11 am

Re: SOTSOS v0.0.0.1 released.

Post by mikhailincali » Sat Dec 29, 2012 7:18 pm

I'll try it out later. Sounds interesting.

User avatar
jam3
Posts: 137
Joined: Tue Feb 16, 2010 9:20 am

Re: SOTSOS v0.0.0.1 released.

Post by jam3 » Sat Dec 29, 2012 8:09 pm

Hey with what were were talking about earlier you might want to look at just pulling from the parser instead of using regex, would also save a little mem/cycles

http://en.wikipedia.org/wiki/Lemon_Parser_Generator

Tanis200
Posts: 88
Joined: Thu Jun 07, 2012 2:02 pm

Re: SOTSOS v0.0.0.1 released.

Post by Tanis200 » Sat Dec 29, 2012 10:34 pm

I get a crash when using this dll and starting a newgame with less than the maximum number of players (ex. set players to 4 in a 5 player map).

W (2012/12/29 16:30:54) [game] System.NullReferenceException: Object reference not set to an instance of an object.

at Kerberos.Sots.Strategy.GameSession.AddStartingDeployedShips(GameDatabase db, Int32 playerid)

at Kerberos.Sots.Strategy.GameSession..ctor(App app, GameDatabase db, GameSetup gs, String saveGameFileName, NamesPool namesPool, IList`1 activeTriggers, Random rand, Flags flags)

at Kerberos.Sots.App.NewGame(App game, Random initializationRandomSeed, GameSetup gameSetup, AssetDatabase assetDatabase, GameSetup gs, Flags flags)

at Kerberos.Sots.App.NewGame()

at Kerberos.Sots.GameStates.StarMapLobbyState.NewSinglePlayer()

at Kerberos.Sots.GameStates.LoadingScreenState.OnUpdate()

at Kerberos.Sots.GameStateMachine.Update()

at Kerberos.Sots.App.Update()

User avatar
motorbit
Posts: 2241
Joined: Mon Sep 17, 2007 7:22 pm

Re: SOTSOS v0.0.0.1 released.

Post by motorbit » Sat Dec 29, 2012 10:58 pm

geil!

tyed this. no side effects that i had noticed, but the game feels a lot smoother.
looking forward to see more of your work, its realy impressive so far!
thanks a lot.

nugarin
Posts: 127
Joined: Wed Dec 05, 2012 8:03 pm

Re: SOTSOS v0.0.0.1 released.

Post by nugarin » Sat Dec 29, 2012 11:31 pm

Tanis200 wrote:I get a crash when using this dll and starting a newgame with less than the maximum number of players (ex. set players to 4 in a 5 player map).

W (2012/12/29 16:30:54) [game] System.NullReferenceException: Object reference not set to an instance of an object.

at Kerberos.Sots.Strategy.GameSession.AddStartingDeployedShips(GameDatabase db, Int32 playerid)

at Kerberos.Sots.Strategy.GameSession..ctor(App app, GameDatabase db, GameSetup gs, String saveGameFileName, NamesPool namesPool, IList`1 activeTriggers, Random rand, Flags flags)

at Kerberos.Sots.App.NewGame(App game, Random initializationRandomSeed, GameSetup gameSetup, AssetDatabase assetDatabase, GameSetup gs, Flags flags)

at Kerberos.Sots.App.NewGame()

at Kerberos.Sots.GameStates.StarMapLobbyState.NewSinglePlayer()

at Kerberos.Sots.GameStates.LoadingScreenState.OnUpdate()

at Kerberos.Sots.GameStateMachine.Update()

at Kerberos.Sots.App.Update()


Likely caused by the incorrect sqlite3_trigger_rowid implementation - I was really not sure what should go in there and made some educated guesses based on observation. Will debug it tomorrow with different player numbers and update with a solution.

KarroK
Posts: 123
Joined: Mon Dec 03, 2012 12:52 am

Re: SOTSOS v0.0.0.1 released.

Post by KarroK » Tue Jan 01, 2013 4:36 pm

after "fixing" the solution (check if you can use the vc vars instead of hardcoded paths) for VS2012:

there's a redefinition of LOG_LEVEL around line 24 in liblogger_config.h, while its just a warning:

#ifndef _DEBUG
#define LOG_LEVEL LOG_LEVEL_INFO
#endif

#ifdef _DEBUG
#define LOG_LEVEL LOG_LEVEL_TRACE
#endif

is a bit neater (imo) this is of course assuming there is only a debug and a release target, not something inbetween.

ps. Love the initiative of this, maybe some talking with the sots2 devs may see it used as official patch :)

nugarin
Posts: 127
Joined: Wed Dec 05, 2012 8:03 pm

Re: SOTSOS v0.0.0.1 released.

Post by nugarin » Thu Jan 03, 2013 8:35 am

Yeah, one of the early VS 2012 previews gently caressed my VC++ installation, one has left it in this state since one hardly ever uses the c/c++. Will sort it out when I get the last known issues with the new version ironed out.

nugarin
Posts: 127
Joined: Wed Dec 05, 2012 8:03 pm

Re: SOTSOS v0.0.0.1 released.

Post by nugarin » Thu Jan 03, 2013 11:46 pm

jam3 wrote:Hey with what were were talking about earlier you might want to look at just pulling from the parser instead of using regex, would also save a little mem/cycles

http://en.wikipedia.org/wiki/Lemon_Parser_Generator

I looked into it, but I do need to know what to do much earlier - I am bypassing the statement processing altogether if it is already cached.

User avatar
Aranador
Posts: 597
Joined: Sat Nov 24, 2012 4:30 pm

Re: SOTSOS v0.0.1.5 released.

Post by Aranador » Sun Jan 06, 2013 6:29 am

Wow - programming awesome. I know two things about what you are trying to do, and one of them is Jack.

But I did have a wonder - can the cashing and parsing be done on a seperate thread and thus leverage another core ?

KarroK
Posts: 123
Joined: Mon Dec 03, 2012 12:52 am

Re: SOTSOS v0.0.1.5 released.

Post by KarroK » Sun Jan 06, 2013 4:40 pm

While you're at it, Theres a WHOLE lot of history being kept in the sql db save games at the moment. Not sure if it is possible to somehow get rid of this but I assume the thousands of sql queries dumped in those logs don't benefit performance at all :<

edit:

Found something that might be useful to look at, both for yourself and the sots2 devs:

http://stackoverflow.com/questions/1711 ... -of-sqlite

nugarin
Posts: 127
Joined: Wed Dec 05, 2012 8:03 pm

Re: SOTSOS v0.0.1.5 released.

Post by nugarin » Sun Jan 06, 2013 7:26 pm

KarroK wrote:While you're at it, Theres a WHOLE lot of history being kept in the sql db save games at the moment. Not sure if it is possible to somehow get rid of this but I assume the thousands of sql queries dumped in those logs don't benefit performance at all :<

edit:

Found something that might be useful to look at, both for yourself and the sots2 devs:

http://stackoverflow.com/questions/1711 ... -of-sqlite


Way ahead of you:) I have already implemented a patch for that. Will be available for world+dog as soon as I get patcher gui finished.
Basically it is just injecting 3 IL commands to the instruction set of the method doing the logging:

Code: Select all

        private string assemblySrcName = "sots2_managed.orig.dll";

        [TestMethod]
       
        public void CanPatchSimpleExit()
        {
            var def = new PatchDefinition()
                          {
                              Name = "TestPatchOne",
                              Version = 3,
                              CodeBlocks = new CodeBlock[]
                                               {
                                                   new CodeBlock()
                                                       {
                                                           InsertPos = 0, //0 POS needed for the param,
                                                           TargetMethodInstructionCount = 43,
                                                           Lines = new List<CodeLine>()
                                                                       {
                                                                           new CodeLine(OpCodes.Nop),
                                                                           new CodeLine(OpCodes.Ldc_I4_0),
                                                                           new CodeLine(OpCodes.Ret),
                                                                       },
                                                           TargetMethodName = "System.Boolean Kerberos.Sots.Data.SQLite.SQLiteConnection::TryLogQuery(System.String)",
                                                       }
                                               },
                              Description = "Disable SQL logging" //insert "return false" to the beginning of the method
                          };


            var subject = new PatchRunner();

            subject.LoadAssembly(assemblySrcName, Path.Combine(Directory.GetCurrentDirectory(), "TestData"));
           
            subject.ApplyPatch(def);

            subject.SaveAssembly(assemblySrcName + "tst1.dll");

            //Empirical assert

            //TODO: write port for verifying
        }

DeKa
Posts: 247
Joined: Fri Nov 20, 2009 12:04 am

Re: SOTSOS v0.0.1.5 released.

Post by DeKa » Sun Jan 06, 2013 7:42 pm

it would be nice to allways include a "how-to-install" ... :p

nugarin
Posts: 127
Joined: Wed Dec 05, 2012 8:03 pm

Re: SOTSOS v0.0.1.5 released.

Post by nugarin » Sun Jan 06, 2013 7:49 pm

Aranador wrote:Wow - programming awesome. I know two things about what you are trying to do, and one of them is Jack.

But I did have a wonder - can the cashing and parsing be done on a seperate thread and thus leverage another core ?


It's probably possible to move some of the database stuff out from the the main thread. I don't really believe that it would help much, though - one would still need to maintain query queues and open another can of worms with syncing all these worker threads.
The additional hashing/caching is not very expensive. I've kept it all in C, it will be very smooth once it is fully optimised.

Currently I am focusing on working with the managed .NET part of the game - simple tweaks to the UI and game-play. I will eventually look into the caching again - I am planning to tweak vanilla row cache implementation and possibly flatten some of the tables - the thing is over-normalised. Lots of the stuff is write-once/read-many, meaning that several multi-level queries could be killed off.

Cheers,
nugarin

nugarin
Posts: 127
Joined: Wed Dec 05, 2012 8:03 pm

Re: SOTSOS v0.0.1.5 released.

Post by nugarin » Sun Jan 06, 2013 7:52 pm

DeKa wrote:it would be nice to allways include a "how-to-install" ... :p


Sqlite caching layer part is installed as follows:

1) consult https://github.com/nugarin/sotsos/issue ... state=open for the known issues
2) back up original sqlite3.dll in the sots x86 bin directory
3) drop in the newest one from https://github.com/nugarin/sotsos/tree/master/Release
4) post any issues to the same url @ step 1)
5) update https://github.com/nugarin/sotsos/wiki

Post Reply

Return to “Modding”

Who is online

Users browsing this forum: No registered users and 1 guest