Monday, December 25, 2017

Project status update #1


So I think it's time to let you know what happens with the project. Since last progres update unfortunately I had no time to work on the project. In the recent days I was totally busy with my game project and of course my full time job as we were preparing World Of Trucks event to be pushed. I have no exact calendar when I work on the given project so I cannot promise you any progress update but don't you worry! The project is not dead and it will be definitely out. 2018 will be the year!

Also as you may notice I changed titles of previous blog post. So instead of counting development days it would be just "progress update #number" - just for a better reading. Unfortunately working everyday on the project is not that easy to do in the long term.

And as we have christmas right now. Merry christmas to your all! I hope you spend it with your families and happy! (Unfortunatley I wasn't able to deliver some of you most wanted gift - but I will improve - I promise! 😇). And if you don't care about christmas - be proud of who you are, never give up on your targets and be happy!  💪

Thank you for your support!

Thursday, December 14, 2017

Progress update #7 - Pickupables are f*cking hard to get right. (Day 18)


Another progress update time! So after long hours pulling my hairs i'm somewhere half-way through the complete pickupables synchronization. I made this database of pickupables I mentioned in previous post. This is end of the fight, but definitely not end of the war I'm having with them. There are still a lot of bugs that needs to be fixed for example spawning of new pickupables does not work yet (for example items buying).

Commits since previous progress update:
  • Use interaction vector instead of player position to find doors to open.
  • Added object create/destroy play maker action hooks and callbacks.
  • Kill game process immediately after fatal error or assert.
  • Make dumping of the object to file a separate method in DevTools.
  • Use OnWorldWasLoaded instead of manually handling level change.
  • Moved game anim database from MPController to GameWorld.
  • Added pickupable spawn and destroy network messages.
  • Indent each component during transform tree dump so it can be collapsed in text editors.
  • Added basic nametags.

I needed to do something that I will finish fast and I will see the result to rest a little bit. Those will be toggleable and will definitely be improved with connection condition indicator.

  • Added rotation getter to network player class.
  • After picking up object snap it to player location for nicer transition.
  • Binding network message handlers is now possible from outside of network manager.
  • Added pickupables database.
  • Spawn network player after loading full world state.
  • Added missing using.
  • Air break uses key press instead of key down events to move character.
  • Added an method to teleport local player.
  • Teleport local player to network player when pressing F8. (debug only)

Now the plan is to fix all the bugs and move back on vehicle sync and polish it.

Keep your fingers crossed!

Monday, December 11, 2017

Progress update #6 - Commit time! (Day 15)


No progress update in recent days was caused mostly by my private life - don't worry the project is still alive and I'm not loosing my motivation!

So finally I found time to sit down cleanup code and fix some bugs. As you saw in the video I've attached to previous post - I had first working demo of pickupables sync. They are implemented in pretty nice way into the game so I could collect them pretty easily however there appeared to be few problems that I still need to solve.

For example there are few items that are destroyed depending on the calendar day you are playing the game on and my idea how to solve it is: there will be "items database" in the where I will store copy of all items that can be picked up and then on session join the host will decide which items should be spawned and where. Thanks to this if hosts game decides to kill some object during startup it will not be shown on other clients. Also this will be used to synchronize items buying/consuming etc.

There is still much more work - for example there are few specific items for example beer case that needs more detailed synchronization (bottles). It is also on my roadmap.

So to keep the tradition alive, the recent commit messages.

Added transform network message containing location and rotation.
There are more and more objects that require position+rotation combo to be synchronized. I've made common message that contains both of them so I don't need to include position and rotation separately in all the messages. Just time saver to not write both.

Instead of few arrays use objects to store initial state of the objects.
I was sending all network objects data in few separate arrays (ids, positions, and other stuff - each of them were separate). It is not the best for caching in modern CPUs as it needs to jump between various addresses in order to read it. Now it works fine but with more objects being send it will get worse so to fix this I made it now array per object type.

Also this change reminds me I need to start thinking about some workaround for MTU sizes as full world sync packet is getting bigger and bigger.

Added Public Release configuration.
No, unfortunately it does not mean i'm getting closer to the release 😢. As I'm writing debug code I'm also surrounding it with #if's so it would not be included into public release builds that I will send to you. I needed this configuration to make sure I do not have any references to those code in code that will ship later. Just for convenience.

Fixed dumping of the fields value is null.
Ye another result of codding without much sleep. I was referencing values even if those were null and because of that most of the objects were missing a lot of fields. Now I can interpret object dumps without any problem 💃!

Make DumpWorld static so it can be called from any place in code.
I need to dump whole game world sometimes to understand what game is doing.

Added game callbacks that can be used to track various game events.
Sometimes lifetime of the game object is undefined so i don't want to invalidate all callback when the object spawns or destroys. Instead I just have "global callbacks pool" that i can subscribe from any place in network code and don't care about game object lifetime.

Added game player wrapper.
Nice wrapper to hook into the player game object. For example to track object pickup and send it to network code.

Fixed unused variable warning in public release compilation.
I had declared one variable that was unused in public release builds. #if'defed it :-)

Implementation of GamePlayer wrapper.
Just an implementation of the game player wrapper I added before.

First iteration of object picking up synchronization.
Object pickup synchronization without stuff I mentioned at the beginning of the post + object throwing is behaving the same as dropping.

Do not include vehicle debug draw code in non public release builds.
Let's save some FPS for you 😼.

Thank you for your support!

Thursday, December 7, 2017

Progress update #5 - Just another progress update (Day 11)

Hello guys! Day #11 of development is beind me. I cleanup a lot of code and did... a little experiment. Check video for more 😁

And a little changelog.

Day #9

Corrected mod name in steam not running error message.
Allocate zero-sized array in default constructor of network message.

Day #10 and Day #11

Added multiplayer mod ui canvas.
Added logger class.
Added message box to uicanvas prefab.
Do not include referenced dlls into the installer. Game has it's own copy of them.
Correctly implement door OnOpen/OnClose PlayMaker actions.
Added vehicle ids to vehicle full sync update.
Added player initial state to handshake message.
Added safe call wrapper that handles all exception in the executed lambdas.
Utils documentation and cleanup.
Added MPGUI.
Play maker utils cleanup and docs.
Added current value getters to interpolators.
Fixed current value of interpolators after setting target.
Show message box on disconnect and on lobby setup failure.
Added fatal error and assert handler to Client.
Moved asset bundle handling to Client class.
Added basic vehicles synchronization.
Correctly handle level transitions.
Setup gui controller game object on mod startup.
Corrected hint paths for my summer car reference dlls.
Added workspace setup readme file and updated setup.bat.
Added cloc.bat.

Day #12

Secret stuff I show in video.

Stay tuned for more!

Monday, December 4, 2017

Progress update #4 - First vehicles synchronization demo. (day 9)


Basic vehicle sync is there! Yay!

Today I decided to skip full progress update as there is still a lot of stuff WIP vehicles related. When I will stabilize them to some point I will do list of changes I did since Day #9.

Thanks for following the blog!


Progress update #3 - Next step: vehicle synchronization (day 8)


Yay! Another progress update! The project started a week ago and the progress since then is unbeliveable. There is a lot of positive feedback from My Summer Car community which motivates me to work even harder on the mod. Thank you all!

So going back to the progress update. As you probably noticed in the title of the post - the next step in the mod development is vehicles synchronization! Yes!

So far I did basic research of how vehicles are implemented into the game and if everything will go well in the next blog post I will be able to show you some footage with vehicles! Yay x2 😁!

So just to keep the form of the blog post. What I did on day #8?

Added custom LoadLevel method to call OnWorldLoad callback even if level is the same.
This was source of few bugs I had in the code. After level change in OnWorldLoad I'm initializing all object managers. The issue was that If level name was the same - the OnWorldLoad callback was not called so the state was broken. Custom LoadLevel "wrapper" will always call this callback.

Added arrays support to network message generator.
So my custom "protobuf-like network messages generator" (Maybe it is time to start calling it SummerMessages or MSCMPMessages or whatever?) finally supports arrays. This change allows me me to, for example send more objects into single messages.

Added world full sync message.
Thanks to the previous change. I am finally able to synchronize full world state when player joins session so, new player will see consistent world as the player(s) that are currently in the session. How awesome is that? 💪

Utils to convert network vector3 to game vector3 and vice-versa.
I wrote set of handy helpers that will let me perform conversion of network message containing vector to game format of vector. DIY!

Added play maker utils class.
As I'm doing more and more stuff with PlayMaker (love it btw) I needed to create proper place to put all the new functions to.

Moved game doors handling to game door manager class. Synced all basic doors.
Yay all doors are synced! Also! They synchronize it's state properly after joining to the session, so if another player opened some doors before you joined the session you will see them opened when you spawn in the world.

Make LoadAsset method public.
This method will be useful later, for example for loading custom animations. Because it will be definitely used from other classes than MPController (GameCharacter for example) I made it public.

Implemented full world synchronization on join.
Just implementation of the full world state synchronization in network manager.

Remove unused development ui.
Removed some GUI I wrote at the beginning of the mod development to debug local player game object. Not needed anymore.

Added vehicle sync related messages.
Added set of basic network messages related to the vehicle synchronization. I will use them later.

Print details about play maker state actions in world dump.
Added that for better understanding what each state in playmaker finite state machines is doing. Probably one day I will write some visualizer for all this data as trying to understand the whole logic of it just from plain text is pain in the ass.

Added interpolators.
Added generic interpolators class for use in various places to not repeat the same code in few places. I still need to refactor network player to use it.

In the end - a nice gif of properly working handling of vehicle enter/leave event tracking.

Thanks for your support!


Sunday, December 3, 2017

Progress update #2 - Day #6 and Day #7 progress update.


So progress update from day 6 and 7. I was mostly working on my game however I managed to do something for MSCMP too. That is.

Day #6

Print all animation states from animation component during the object dump.
I've added printing of all anim states for each animation component in world so I can see what animations are there for multiplayer use.

Added data folder where asset bundle for multiplayer will be located.
Just creation of the data folder on repository.

Disable airbrk when dev mode is disabled.
Exactly what commit message says, nothing more 😃.

Added game animation database.
Setup game animation database class that stores AnimationClip's that can be reused by multiplayer mod.

Added custom asset bundle loading.
Asset bundle will allow me to add custom assets like custom models and animations for multiplayer use.

MPController is now singleton.
MPController is the component I'm attaching to the controller game object - i want to have access to it from different places in code so I made it singleton.

Added Unity multiplayer mod asset bundle project.
Added Unity 5.0 (version MSC is using) project and setup it to generate multiplayer asset bundle.

Day #7

Added installer.
Added simple installer using InnoSetup - sending new builds for testers was starting to be pain in the ass with all the data and other stuff so I needed to setup it now.

Adjust speed of the walking anim according to the actual speed of player.
Walking animation speed is now connected to the walking speed of player for much nicer visual effect.

Use steam api to retreive my summer car path.
Instead of asking tester to place path.txt I've used steam api in launcher so it automatically checks if game is installed and if so gets the path to the game.

Non commited changes.
Also I was doing some stuff that did not yet end up on the repository as it is not finished. What is it?

I added support for arrays to my "protobuf like" network messaging framework. Thanks to this I can send state of more objects into one message. So full world sync when joining the session is already implemented - at least sending state of the doors.

I made game doors manager and made it register all game objects that are doors, thanks to this all doors will be synchronized  ✨auto magically✨. Also I broke door opening code and I will take a look why it stopped working right after I publish this blog post.

Thanks for reading!

Friday, December 1, 2017

Progress update #1 - Animations, fixed launcher crash (day 5)

Hello guys!

So first progress update on the blog - day #5 of the mod development. What I did today?

Code refactor and comments.

I needed to cleanup the project as the code was getting worst each day I work on it. Also as I still remember what all the stuff I wrote in the last 4 days is doing I commented it for easier development in future.

Fixed timeout handling.

There was one nasty bug in connection timeout handling. When you were player and host closed the game it's character disappeared but you were not kicked out of lobby. That is fixed.

Added walking and idle animation to network characters.

So yes, animations! The Hullu character I'm using to represent players has only two of them - idle and walking. I need to take a look if I can reuse some of the animations game has with their skeletons or I need to make custom ones for mp.

Temporary solution for per user configurable game path. (path.txt file next to the launcher)
As I'm starting to test the mod over real network - not lan - I need some way for users to select My Summer Car path so they can test it. For now it's just path.txt file next to the launcher - I will likely use registry for that purpose later.

Offset character so it does not fly.
As you may see on the gif above - the character is levitating. I moved it a bit down so it touches the ground properly.

Do not load game when player is already in game.
You can now safely join other player when hosting a game. It's still not the final solution - in the end it will be "restarting game world" so the world not be desync. But I needed it for quick testing.

Fixed timing related crash in injector.
There was one timing related crash in the injector. Injector is a DLL that is injected into game process which then hooks into the mono and loads multiplayer mod C# DLL. I was doing it "worst way possible". That means I started another thread and the injector was waiting for all the stuff to initialize by just checking values into while() loops - this solution was full of race conditions and it was just asking for trouble from the beginning.  I fixed it by hooking into proper place in unity player and then loading the mp mod DLL. Works like a charm 😁.

Thanks for reading!