Apian-Framework / BeamGameCode

Engine-independent C# core game code for Beam
0 stars 0 forks source link

Revisit local player bike creation #33

Closed jimkberry closed 2 years ago

jimkberry commented 2 years ago

Currently it works like this:

(Keep in mind that NewPlayerMsg is a Beam message, not an Apian one. To Apian all of this is just game/app activity)

Upshot is that there are situations in which the player bike doesn't ever get created. They seem to involve the peer getting synced, then losing sync, then regaining it and AddPlayer() says "Hey! That player already exists" and bails.

Rather than dealing with just that symptom, however, I think a more anti-fragile approach is a better idea.

jimkberry commented 2 years ago

How about instead of waiting for a special event - or worse yet, a sequence of special events, we instead look for a situation in which a player bike needs creating?

That kinda-sorta already exists for AI-driven bikes. All that needs to happen is for either the game (or maybe the frontend) to notice that the local peer is active, and there's a player for it in the CoreState... but no non-ai bike owned by that player. I think it needs to be the FE, since this should really be a locally-induced action.

Probably ought to somehow hook into, or at least work with - the current "local player's bike destroyed message" FE code that causes the "restart" button to appear on the UI.

jimkberry commented 2 years ago

You know, I'm just not seeing this anymore. I'm going to just close this without working on it. If it becomes an issue in the future I'll just write it up again.