Hey folks, since my last post here has received great help (specifically by @hplus) -- I figured I'd keep on asking more questions. Warning, this includes a lot of babble, bear with me.
Let me explain my current mindset and thoughts so far:
- I don't have a physics loop on the server. When players skills are used, the only thing I am validating server-side is whether or not the player is in range.
- I am sending around 20 PPS when a player is moving. The only validation here on the server is to check the difference between the players last and new position. And if that value is higher than XXX, they are speed hacking / changing their intended X, Y values. This way, no physics server loop is needed and the client can handle all collisions.
- After that validation, the server basically relays the players positioning packets to everyone in a game. Then, I use a lerping method to smooth out the movement. And 20 messages per seconds seems like the minimum needed for smoothness. I could lower this, and use tweens, but ew.
What I'm trying to get at, is.. I am relying on the client for a lot of things. Say for example, since physics are not on the server, if a player shoots a fireball and when it reaches a target. this packet is sent to the server. I then check if that player is in range of that monster, and if the skill is NOT on cooldown, it goes through. This would be enough to prevent speed hackers that attack at 1000 times a second, but not enough for pixel perfect collision (physics) on the server. So, a player could just send that packet (opening up Chrome Dev Tools) while they are two screen widths away from the monster and it won't validate on the server because that monster's not in range. The player could also send the packet before the fireball's animation is done and it would be validated as the server has no sense of physics. Is that acceptable / okay?
Basically, I'm a nervous wreck and just need some confirmation (or criticism) about my thought process of this.
What I am worried about is the 20 PPS the client is sending to the server (when they are moving). Is this even something that other games do? I mean, I know you're supposed to just send the "Player is moving right key" instead of having a TCP stream of data being send from the client.. but man, doing this helps so much! Collision is done for you, no physics loop on the server, lag compensation is so easy to deal with, fixed timestep isn't needed (although, that's because my clientside game framework (Phaser) is weird...But, this all comes with the cost of the extra bandwidth and processing power for those extra messages. And that is why I am scared if nodejs is appropriate for this type of design.
So, I'm looking what are your thoughts on my train of thought here. Am I too paranoid?
Also, I just thought of an issue about the no physics on the server. Let's say, for example two players are in a game. John and Muffin. Muffin shoots a fireball towards John. Muffin manipulates his client so that fireball packet (that tells the server he hit him with a fireball) doesn't get sent. John see's this fireball coming towards him and it doesn't do anything (not notified by server). And thus, John doesn't get hit.. I'm not sure but John would most likely be happy that he received no damage, but this is not good design and just one flaw I found without a physics loop on the server. But then again, this is only detrimental towards Muffin and not John. And since Muffin is technically manipulating the client, his fireball doesn't hit John and thus, he doesn't do any damage. (Obviously the server still checks for skill cooldown, and player range on the server), but this could end up in some serious "distorted gameplay", but not really harmful gameplay... (as no damage will be done towards John) -- And Muffin, is not necessarily going to be mad because he is trying to "hack", and knows what he is doing.
So.. trusting the client has its negatives and positives but for the general small indie game dev, it should be fine?