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!

1 comment:

  1. And also. New comment system + refreshed look of the blog.