-
Notifications
You must be signed in to change notification settings - Fork 23
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
[WIP] Player structure array + initial multiplayer support #200
Draft
iamgreaser
wants to merge
47
commits into
AliceLR:master
Choose a base branch
from
iamgreaser:mp/player-array
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
replace_player now loops over all players
find_player now loops over all players
In this case, swap the foreground and background as per the convention of my original attempt at multiplayer.
Worst case, O(MAX_PLAYERS*pushes) noops and O(MAX_PLAYERS) scans If this is slow I'd like to know. (Try getting that out of your head.)
These will come in handy when working out which player to target and/or blame
Also, actually compile and link distance.c
And with that said we have reached peak multiplayer
I think this may cover all things that aren't bears
I'm going to need to work out what's going on with the sensors If knowing what they're doing is bad for my sanity please let me know
because we're about to import something that has a hurt_player
I've tried to go with what's intuitive, but combinations of things can clash. But at least the Forest of Ruin triggers work nicely.
That should be the rest of the stuff that doesn't involve sensors
Just a little bit. I'll revisit this once we start getting more multiplayer stuff in.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WIP, but I'd like to get some eyes over the code so I have a better idea of how this should be done.[OK I'm happy to have this merged once everyone's happy with it] [Also please ignore the WIP tag, I hate the GitHub interface and I think I've blocked the element that lets me change the title of this thing]My earlier attempt at adding multiplayer to MegaZeux dates back to early-to-mid 2018 and since then the code's had a clue-by-4-rocket-machine-launcher-steamroller applied to it so good luck getting that to apply.
So far this contains enough to... well, work normally when you don't enable multiplayer support. However when you do enable it, you get something which behaves similarly to the previous attempt except every player uses the exact same inputs.
I'm considering getting a little bit more clone-b-gone into this before dropping the WIP tag[There's still clones in the multiplayer cases which tend to show up in Ordnance but singleplayer is fine] but I'm tempted to do the input support in a separate PR. Consider this PR impractical for actually playing multiplayer but there isn't an obvious way to do multiplayer input well with MZX. [I have something in mind]Either way, this does end up moving stuff into a player structure with the wonderful power of
sed -i
, and some of the code has been refactored to take advantage of this. Also, unlike the previous attempt, moving the primary player doesn't require moving all of the other merged players at the same time. [I then proceeded to manually MPify and structify all the things so there's now only two places which havemzx_world->players[0]
in them and they're not particularly worth structifying]