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

Offline-Online asset synchronization #235

Open
osse101 opened this issue Mar 24, 2014 · 7 comments
Open

Offline-Online asset synchronization #235

osse101 opened this issue Mar 24, 2014 · 7 comments

Comments

@osse101
Copy link
Contributor

osse101 commented Mar 24, 2014

Here's my view of what things should move towards

Firstly, I feel everything should be ripped from level_full and level_full_local_multi except for the level specific content i.e. lighting, course, flag, environmental. That'd give us a single scene that can be populated with either online/offline players. In this scenario, players/carts/customization/network connections would have already been decided in the preceding lobby menu and the level scene would start by positioning objects at their spawn points, dividing the screen into player cams, and the general stage start sequence. And put a controller script on players to manage state change between menus, pre-level, level, and post-level.

  • Bring all offline only features into the prefabs supported by scripts. I think what's left are gamepad controls, Patrick heads, and player colours.
  • Create a place to hold references to all player game objects (like PlayerInfo but with less Network)
  • Remove all players from level_full_local_multi and add them (buggy, character, ball) programatically in scene startup then add all script components. The scripts won't let you switch over to the online prefabs at this point.
  • Remove all views from level_full_local_multi and add them programatically in scene startup.
  • Remove NetworkObject from level_full and put it and netLobby on the onlineMatchLobbyScreen.
  • Rewrite online scripts to use the same player references used by offline and break networkVariables into only Network variables.
  • Merge online/offline scripts. IMO by adding game mode case handling to the online scripts that would make them RPC to server is online and sendMessage to self if offline. Its debatable how exactly.

Edit: To clarify the end state after these changes:
Shared prefabs for offline/online
Levels are runnable by either offline/online.
1 of each script with local/network handling as needed

@Cheeseness
Copy link
Contributor

Awesome, @osse101! Thanks for getting the discussion started here :)

  • Rewrite offline scripts to use references instead of assuming they are attached to the correct gameobject. This step is up for some debate.
  • Rewrite online scripts to use the same player references used by offline and break networkVariables into only Network variables.

Ideally these two steps would see the merging of such scripts so that there was no longer duplication for online and offline modes.

@osse101
Copy link
Contributor Author

osse101 commented Mar 24, 2014

  • Rewrite offline scripts to use references instead of assuming they are attached to the correct gameobject. This step is up for some debate.
  • Rewrite online scripts to use the same player references used by offline and break networkVariables into only Network variables.

@Cheeseness This would actually be duplication of work and should be called a merge, as you said. Updated my first post to say as such.

@bobsayshilol
Copy link
Contributor

  • Create a place to hold references to all player game objects (like PlayerInfo but with less Network)

The PlayerInfo class should work for offline since you can just ignore the online-only bits.

  • Remove NetworkObject from level_full and put it and netLobby on the onlineMatchLobbyScreen.

I'll work on moving the netobj into the main menu and loading all it's settings from the config file when I get back.

@MaritalWheat
Copy link
Contributor

This is going to be a hell of a headache, but it needed to be done sooner rather than later, so glad to see work on it has begun! In regards to this point:

Rewrite online scripts to use the same player references used by offline and break networkVariables into only Network variables.

In my mind, what's needed is a generic PlayerManager type layer that can work across modes (which is what networkVariables more or less does now, but only for online games), and then a generic GameManager that can do networkObject's work for online across offline and online (i.e. world loading, and also potentially game state stuff).

As for PlayerInfo, I agree with @bobsayshilol that it can be used perfectly fine for offline as well (in fact, in the current implementation I create PlayerInfo objects for local ball markers) - the data inside PlayerInfo just needs to be properly created and managed (which networkVariables does currently for online, and a generic PlayerManager would hopefully do).

Anyways, I think what I've described is more or less what you have in mind anyways. Are these changes still in the planning stages or being currently implemented?

@bobsayshilol
Copy link
Contributor

Ah yes I've started moving the code over - I want to say it's almost done, but if I do I'll find a bug and be stuck on it for a while. The current implementation follows similar ideas:

  • The networkObject is now always present and is more of a general storage than just online-focused (I couldn't think of a name to change it to so I just left it as that). For example all information about levels and models are stored on it when the main menu loads, but all online-only scripts are attached to the relevant menu.
  • I'll be adding a PlayerManager class later today which will allow lookups, adding, removing ect...
  • Currently the level loading is done in the netLobby script for online so we can implement things like voting for maps which I'm not sure would be compatible with offline.

A GameManager hasn't been implemented yet, but I assume that's just for offline script loading since that's all the networkManager scripts?

@MaritalWheat
Copy link
Contributor

Sounds like you've made fantastic progress!

A GameManager hasn't been implemented yet, but I assume that's just for offline script loading since that's all the networkManager scripts?

What you describe your rework of networkObject as is more or less what I imagined GameManager being - basically, something to manage all the objects and data that is consistent between offline and online.

Anyways, can't wait to check out how it all works when it's in!

@bobsayshilol
Copy link
Contributor

I didn't get around to adding a PlayerManager class, but other than that it's all there now.

What you describe your rework of networkObject as is more or less what I imagined GameManager being - basically, something to manage all the objects and data that is consistent between offline and online.

Ah good to hear we were both on the same page then 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants