7 ms·
An Embarrassing Tale: Why my server could only handle 10 players
- stcredzero 9y agoPeople are welcome to see about how many players my alpha multiplayer server can support: www.emergencevector.com The theoretical limit as configured is 460 concurrent players. Be sure to read the instructions, or you won't be able to shoot, and you'll drain your energy and become helpless.
- probably_wrong 9y agoSounds like you found an usability issue. Have you considered changing the controls and/or warning the players when they do it wrong?
- stcredzero 9y agoThe former.
- taormina 9y agohttp://knckout.io/ http://knckout.io/ is the link for anyone just wanting to play his game. Also, is collision detection currently working? I mean, just trying to keep on the platform is actually pretty zen, but running into other players doesn't seem to actually do anything right now.
- wongarsu 9y agoCollisions only do something if you boost into the player (press space).
- jsnell 9y agoIt depends on whether the players are boosting. I think it goes like this: - If neither is boosting, the players just pass through each other - If one player is boosting, they'll knock the other off - If both are boosting, the players just bounce off each other I find the controls extremely unsatisfying. Top down driving games (which this fundamentally is) really need a sense of momentum and drifting.
- isaacg 9y agoThe lag is so high that I can't "boost" without going out of bounds and dying
- jachitla 9y agowhat region are you in?
- camtarn 9y agoReally enjoyed playing this game. It's really hard but pretty amusing. A good example of multiplayer gameplay distilled down to the very basics.
- wongarsu 9y agotl;dr: programmer makes game server for webgame, experiences massive CPU spikes, instead of profiling he randomly changes stuff until he finds the actual problem (not deleting past events).
- jachitla 9y agolol, nailed it
- stormbeard 9y agoIt looks like he's still a student, so this is just the type of learning experience that breaks those bad habits. Hopefully his methodology will be a bit more refined after all this.
- pagnol 9y agoI noticed that currently json is used to encode messages between clients and the server and also a lot of information that is not actually needed in every update is included, such as the color of each player's car, their name or the number of lifes left. How much could be gained by transferring only the information that is actually needed and using a different serialization format, perhaps protobuffers or the like?
- synthmeat 9y agoI got 2 to 4 orders of magnitude improvements across the board last weekend just by rolling my own binary protocol over ws, with world deltas. Didn't even bother to space-partition it to clients. Using JSON as serialization format for real-time multiplayer game is being very silly, unless it's just a prototype.
- jackmott 9y agoyes json is crazy. protocol buffers are ok. but custom bit packed format is still helpful for twitch games
- auspex 9y agoUsing JSON for a realtime game is extremely bad. Each request must not only be parsed (json-> object -> json) but each serialization requires a byte by byte encoding pass. Meaning that you're going to use a lot of CPU. Binary is a much better choice.
- jlebrech 9y agocould have used msgpack http://msgpack.org/ http://msgpack.org/
- nullpilot 9y agoMessagepack still contains field names as strings, which can easily double or triple your data, and explodes parsing time. A game is a pretty good use case for predefined schemas like Protocol Buffers, which is used by CS:GO and Pokemon Go for example. Other games like slither.io use binary over websockets without any of these libs.
- throwaway2016a 9y ago<nostalgia> I feel like a lot has been lost since the days when I was in my parents garage making TCP/IP games to run over dialup. 1. Binary was the only choice 2. You had to assume packets would get delayed (sometimes 10+ seconds) thus you had to do some fun stuff like try to use math to predict where the player would be based on what they were doing last time you got an update. 3. You had very little RAM to work with so growing memory would be immediately noticeable. #2 was the primary reason in old game you used to see other players walking into a wall for 20 seconds before jumping half way across the map. Darn n00bs who couldn't afford 56k (joking). I fondly remember the first time I played a multi-player online game I actually had to dial into my friend's modem over POTS. I then spent the next two months reading telephony documentation trying to figure out how to use the modem to do things like that myself. </nostalgia>
- deleted 9y ago[deleted]
- reificator 9y ago#2 hasn't gone away, the gaps have shrunken a lot, and we've gotten a little better at predicting actions, but it's still the exact same concept.
- zacmps 9y agoDefinitely, but other methods, such as lockstep, are also used in some games.
- dfox 9y agoThat depends on the kind of game, mainly on whether it is practical to replicate whole state relevant to player at least occasionally and whether the latency of lock step is acceptable. For RTSes the whole game state is usually impractically large and latency is not that important (and can be masked) while for shooters the state is relatively small and latency is critical.
- 9y ago
- cuchoi 9y agoCan you show the specific code that was leaking memory?
- wolco 9y agoSounds like some form of load testing could help you pinpoint issues. Loader.io has a free tier.
- maccard 9y agoHave you thought about using a profiler?
- mijoharas 9y agoPrecisely this. The advantages that can be gained from detailed and effective use of a profiler can't be underestimated. You no longer need to guess at where in your code something is taking up CPU or memory, just look. I'd say the ability to effectively use a profiler is one of the most important skills for a software dev (yet one that many people overlook).
- maccard 9y agoI've found that in the length of time people have spent speculating about what's slow and what's not slow, I've measure it, and have proof. Another advantage of profiling is that it improves your intuition about what will be slow. When I profile my existing code add, I tend to see the same things come up over and over again - vector resizing, overly broad mutexes, wrong data structure choice. Seeing these every time means that I can often pre empt these issues, but I always profile it to get hard. Numbers before and after.
- echlebek 9y agoIf you aren't using a profiler and benchmarks when analyzing performance problems you're just blindly stabbing in the dark.
- hellbanner 9y agoCheck out https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking#Entity_interpolation https://developer.valvesoftware.com/wiki/Source_Multiplayer_...
- age_bronze 9y agoJust a comment on the gameplay, the characters are moving way too fast for the size of the screen, the whole game is just too unstable and random.
- eridius 9y agoWhat does OP mean when they say "an io game"? They reference a few games that have .io domains, but the domain has nothing at all to do with the technology or style of game (or even whether it is a game at all), so I'm a little confused.
- tarr11 9y agoUsually a free to play multiplayer HTML5 Canvas Game.
- vortico 9y agoThere's not really a meaning of "io game" other than by example. It doesn't necessarily have to have a .io TLD. Here is a community with some examples. https://www.reddit.com/r/IoGames/ https://www.reddit.com/r/IoGames/
- vertex-four 9y agoMultiplayer long-running competitive games in which you kill/consume other players to become stronger, generally. Agar.io was among the first, and is mostly representative of the "genre" - people wrote a pile of clones, improvements, rethinks, etc, mostly with .io domains, so they wound up being called "io games".
- forkLding 9y agoQuick suggestions on usability, maybe start off the game with players on a slower speed so they get used to moving around first and then gradually speed up by accomplishing actions that you want them to do in a training sort of manner so that players start learning and don't get confused. Side note: I subscribe to Mark Brown's Game Maker's Toolkit on Game Design and Game progression, here is an example: https://www.youtube.com/watch?v=2u6HTG8LuXQ&t=4s https://www.youtube.com/watch?v=2u6HTG8LuXQ&t=4s I think it would definitely help
- jachitla 9y agoI had thought of that. When onboarding a new user, they fly off the map A LOT. Only problem with this idea is, I think it would be a lot of friction for users that have played more than 1 or 2 games (assuming you have the same thing happen to all players on start). I have been looking for a continuation mechanic though. Speeding up after some knockoffs sounds like a plausible candidate.
- logicallee 9y agoif OP is reading this, can you share your technical stack, frameworks etc that you're using. I feel like you kind of left this information out. (I don't even know what language you wrote this in.) Thanks.
- jachitla 9y agoNodeJS. If you click on "Acknowledgements" on homepage of knckout.io, you can see some modules I used. You will also see what was used to kickstart the project. Email me at jasonchitla@hotmail.com if you have more questions.
- sigi45 9y agoHorrible game mechanics. Took way to long to understand how to control it and collision doesn't work
- shlant 9y agouse the up arrow to "boost" and knock players off. There is no collision if neither player is boosting. The controls could definitely use some work though
- trollopTheJoe 9y agoPoorly written article about a poor programmer writing a poorly written code.
- Jyaif 9y agoSpace partitioning when there are 4 players is a bad idea.