-
Notifications
You must be signed in to change notification settings - Fork 0
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
basic platforms #1
Conversation
Hmmm weird. I recognize the error but I didn't have it when I ran. Try getting rid of |
looks great! |
Screen.Recording.2022-04-15.at.7.37.07.PM.movOn my end (Firefox): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a couple specific comments even though this is already merged
return row * VISIBLE_BLOCKS_ACROSS + col; | ||
} | ||
|
||
// TODO: have this run once total, not once per client - not sure how to do this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually we will probably have this for free because the server will send the “initial” map state to clients when they join; it won’t be clients’ responsibility to come up with the map by themselves.
} | ||
|
||
// if entering brand new col | ||
if (adjustedX === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
afaict this is not guaranteed to run every time - if a computer is under some graphical load (e.g. from another program running) it's entirely possible that the time between requestAnimationFrames is such that adjustedX jumps from BLOCK_SIZE - 1
(or less) to 1
(or greater) without passing 0 (since it’s a function of the time)
Basic platform setup
Finished
Still TODO
Lingering thoughts
Right now the new column gets added on the front end, i.e. individually for each client (which is the only way to get this PR to work with no Erlang server). Even though every user does get the same right column every time, I'm thinking this could cause issues with this updating the server a bunch of times (once for each client), so maybe in the future we want this to actually happen on the server and then update each client...
To test
Run the app, then go to /game. Voila! It doesn't look like much right now because it just creates the same map infinitely, but see video below for more obvious example of this in action. I changed it temporarily so the new columns come in with red blocks instead of blue, which makes it clearer that new columns are actually being added as older ones are deleted.
Screen.Recording.2022-04-10.at.2.38.16.PM.mov
Super appreciate any thoughts <3