Should I use lance-gg for browser multiplayer game in 2022? - browser

What I'm trying to do:
authoritative server - physics completely under the authority of the server: Nothing moves until the server says it does
handle up to 50 players per game map
Players and other game objects will
interact/collide with each other and physics like projectile shooting are required.
Web browser multipalyer game.
Client: theree.js, A-Frame
Server: lance-gg
Can I use lance-gg for the gameplay and the game objects synchronization?
Would it be impossible or very hard to provide a smooth physics experience to the player?
Since there is some time since last update, bug is something I should be worried about?
I have liked a lot the Sprocket League github project.
When I tried to reserch a bit for the Lance-gg, I have saw it has been a time since the last update.

Related

Multiple Paths confusion when designing REST API

We have a resources named Games and Players
/games -> Get all Games available
/games/{game-id} -> Get the game details of specific Game with game-id
/players/me -> Get logged in Player details
There will be Games played by the player which can be tagged under Games or Players
Scenario 1
/games/me -> Fetches games played by the current logged in player
This groups the request under Games tag. I'm using Swagger API so this call will be going to GamesAPI controller on the client generated code. I see its fair to be in the Games api rather than player as its related to games.
Problem : It looks too odd to consider "me" as a special id as it looks it is one form of {game-id} which I can't digest.
Scenario 2
/players/me/games -> Fetches games played by the current logged in player
This groups it under Player tag which goes to PlayerAPI after code generation. The path has a meaning which is good but, its more relevant to have it in GamesAPI (by my choice - I could be wrong, please suggest)
Among these two scenarios which is the better way to design this problem?
Scenario 1 seems to be better among two because in general your games url will land to GameController and there you can have action function for fetching all games, one game of given id, or the logged in user's games.
Relationship design is driven in API's how your schema's are designed .So, in your case
1 Player can play 1 or Many games - So 1 to Many relationship
Hence, you should be grouping game data based of players . So, 2 scenarios arise for an API to have better performance
Scenario 1
Is it easier to search in Games for the player id and then group them?
Scenario 2
Is it easier to search Players on the basis of the Game id and then group them?
Logically, speaking and considering scenario 1 makes more sense , hence
/games/{player-id} -> Fetches games played by the current logged in player
This is how I solved it.
As mentioned with Scenario 1, I see "me" conflicts with {game-id} and confuses users.
With Scenario 2, I see fetching user games from player API isn't intuitive.
So I went with an approach where it tries to keep the endpoints minimal.
I added a new query parameter "playedOnly:boolean" for GET /games which returns all the games related to the player.
This simplifies lot of things. I can still go with /games endpoint and no more confusion!

Socket.io - Optimizing communications between 2 sockets

I'm working with Nodejs, Express, and Socket.io, I started out with this tutorial for a chat with multiple rooms and which is quite popular:
http://psitsmike.com/2011/10/node-js-and-socket-io-multiroom-chat-tutorial/
I added a feature in which one player can challenge another one(within the room, where there might be other players) to a 1v1 rock, paper, scissor match in a turn based manner. Everytime a player chooses any of his 3 options available(rock,paper,scissor), I send to a function in the backend the ID of his opponent and the option chosen.
I wanna know if there is a better way to communicate through sockets other than sending the id each time, and what other alternatives are out there to emulate a match between 2 players only, without having to worry about the connection being lost or having other players interfere.
What if you start a new room for a new game? Both challenger and opponent get added to the new room.
There will be no interference even if either player starts games with other opponents as all games are in separate rooms...

Game center sandbox

Ok, so I have an app available in the app store, for its next update I want to add Game Center functionality, I have done all my coding and everything is working as I would expect (using NSLog to make sure that the correct coding is called) but, when I open up Game Center, one achievement is there but not the second one that I got and one of the leader boards was showing a score a few hours ago, now its not and on the other leaderboard the score is showing as an old score.
is the Game Center Sandbox mode really this bad as I have been searching for errors in my code for hours now and I swear, there arent any.
Can anyone help me please?
Note - I saw on here someone suggested to use the game with 2 game center accounts, I have done that and on the second account no highscore or achievements are showing at all.
Thanks Graham
In my experience two accounts do seem to be necessary and you have to wait a while (sometimes hours or overnight) for results to appear. Other times they appear quicker. I actually tested with 3 accounts but I doubt the third made any difference.
And double check that the leaderboard ID in iTunes Connect exactly matches the ID in your code.

Questions about updating my node.js game

I am making a little game using node.js for the server and a .js file embedded in a HTML5 canvas for clients. The players each have and object they can move around with the arrow keys.
Now I have made 2 different ways of updating the game, one was sending the new position of the player everytime it changes. It worked but my server had to process around 60 x/y pairs a second(the update rate of the client is 30/sec and there were 2 players moving non-stop).
The second method was to only send new position and speed/direction of the player's object when they change their direction speed, so basically on the other clients the movement of the player was interpolated using the direction/speed from the last update. My server only had to process very few x/y7speed/direction packets, however my clients experienced a little lag when the packets arrived since the interpolated position was often a little bit away from the actual position written in the packet.
Now my questions is: Which method would you recommend? And how should I make my lag compensation for either method?
If you have low latency, interpolate from the position in which the object is drawn up the new position. In low latency it does not represent much of a difference.
If you have high latency, you can implement a kind of EPIC.
http://www.mindcontrol.org/~hplus/epic/
You can also check how it is done in Browser-Quest.
https://github.com/mozilla/BrowserQuest
Good luck!

questions about Game Center (sandbox)

I'm using pretty straightforward code, modeled on the code in Strougo & Wenderlich, but wacky things are happening that I'm trying to figure out. A couple of them:
1) In the Game Center app on the device one game I bought from the app store (namely Temple Run) is showing up in the sandbox along with the game I'm trying to debug. How did that get there? I have several other app store games with game center features that don't show up so it isn't that everything on my device is showing up.
2) The game I'm developing has achievements and leaderboards. The code for submitting both seems to be working but only my achievements show up in the Game Center app. It says "No Leaderboards" instead of showing my leaderboards. However if I run the code that retrieves leaderboard information it works as expected and I get back my scores.
3) The game center app in the simulator doesn't say "No Leaderboards". It has leaderboards for my game but it says "No score". On the leaderboard detail screen it shows my rank as #1 of 1 friend and #2 of 2 players, and on the detail of that it shows the actual scores in my test game.
4) The simulator's game center app says I have no achievements even though the device's game center app shows the achievements correctly. Is the simulator's Game Center app simulating the Game Center Server and not communicating with the real Game Center server?
5) Do I count as one of my own "Friends" even though I didn't do anything to become a friend (to explain #3 above)?
6) The leaderboard screen on the device looked like it was working at first glance but I just realized that the scores it's showing are numerically wrong! What's with that? Maybe they're left over from yesterday or some other time?
1) Game Center accounts get stuck in sandbox mode sometimes, one solution is to log out from the Game Center application and log-in from the game (temple run in this case)
2) I'm having similar issues too, I think some has to do with sandBox accounts. For example I can't see any of the leader board scores uploaded when I send a score from just one device, as soon as a second device submits a score, they both appear in the leader board.
Also have you also enabled Game Center for the current version from iTunes Connect?
I know this is old, but I found an answer that helped me, and might help someone else. Also the itunes connect changed a lot through time, maybe this answer is more relevant for recent problems. I hope the OP have fixed all his issues by now.
2) This one might do the trick. 2 test accounts. iOS Game Center: Scores not showing on leaderboard in sandbox
Even having one device you can have multiple test accounts with generics emails:
https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SettingUpUserAccounts.html#//apple_ref/doc/uid/TP40011225-CH25-SW9
This answer is more about the 2 question that helped me.
But for the other ones:
1) It happened with me too. I don't know if it was because the app were open when I logged into Sandbox environment or if recent downloads apps might affect this somehow - anyways the apps show there; but it seem harmless.
3) I always hear to test on devices always, so I believe you shouldn't take simulator in consideration on this. And the answer of 2 might solve this issue as well.
4) Did you check inside the itunes connect if you have added the Achievements to the game? And I mean added, not just created. After creating you must insert them on the "Versions" tab, find the Game Center part, press "+" on Achievement. I always forget to add in-app purchases the same way.
5) As you said about "temple run" appears on your account out of the blue, maybe your test game appeared on your "not test account" somehow, but with no data GC data recorded on it.
6) Didn't understand well. Sorry about my english.
A) They are like out of regular order (high to low), or
B) the score itself is wrong? Like: you scored 7, but it shows a previous 5.
A) This happens all the time and I figure the sandbox is a lil buggy. So I double check the high score on Player Preferences and when checking I always parse the value again.
B) you can change the order of score displaying when creating the leaderboard.
https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/GameKit_Guide/LeaderBoards/LeaderBoards.html#//apple_ref/doc/uid/TP40008304-CH6-SW22
Every time I create a new game is a fight testing GC. Hope this helps anyone out there.

Resources