Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player's drone sync + labor division #145

Merged
merged 10 commits into from
Apr 16, 2021

Conversation

Baldie-dev
Copy link
Contributor

@Baldie-dev Baldie-dev commented Apr 15, 2021

This is the implementation of #126

I am basically sending 3 events using transpilers:

  • Drone went to build something
  • Drone is going back to mecha
  • Drone changed build target

The labor division (each drone will build something else) is achieved by leveraging the original approach of marking which prebuild is under build from the drone. In case of collision (client and host will send drone at the same time), a random number is generated as a priority for the drone order.

For example:

  1. Host will sent packet: my drone is going to build that with the random number 178361.
  2. Client will sent packet: my drone is going to build that with the random number 2781.

In this case, the Client lost and his drone has to go back to mecha. In the case of more players, the higher number will always win.

In the GIF below, I have build 8 buildings and each player has only 3 drones. That is why the first 6 buildings are built quickly and the last two later.

output

@Baldie-dev
Copy link
Contributor Author

I will resolve conflicts + two bug fixes are needed... please do not merge yet

@Baldie-dev
Copy link
Contributor Author

It should be ready for the merge now :) all issues solved.

@Baldie-dev
Copy link
Contributor Author

ready for merge

@Mushroom Mushroom merged commit 824e8cd into NebulaModTeam:master Apr 16, 2021
@Baldie-dev Baldie-dev linked an issue Apr 16, 2021 that may be closed by this pull request
@Baldie-dev Baldie-dev deleted the building-drones-sync branch April 17, 2021 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants