tnajdek / schema-messages-js

MIT License
4 stars 0 forks source link

Are you still working on this project? #1

Open crazyyi opened 7 years ago

crazyyi commented 7 years ago

Hi Tom, I have read your article written in 2015 network message serialisation which leads me here.

I can't submit my comment on your website because the server refuses me to submit. So I hope it's OK to write it here.

Your article is refreshing and I appreciate for the benchmark demo. I wish I had read the article earlier. In the article you mentioned that the Schema Messages solution is immature. Does it have many bugs? Is it actually tested in games you built?

I am using MsgPack for my game but I am not satisfied with the bandwidth it uses. I am building a multiplayer game for over 300 concurrent players. So I don't think MsgPack is the best choice for me. Reading your article I learn that ProtoBuf may also be a no go for me. Have you tried to improve the Schema Message library you built 2 years ago? I hope there is a good tutorial for helping beginners use it. I am still searching for a better solution out there otherwise I will have to roll out my own serialisation solution which may be time-consuming.

tnajdek commented 7 years ago

hi, sorry about the comments on my blog; it's due to an expired certificate on the comments server - need to fix that.

What languages are you using for your game?

I'm not actively developing schema-messages, I've used it in one experiment/game and moved on. That being said, I'd argue it's feature-complete, well-tested and, if you find any bugs, I'll look into them.

Whether it's the most optimal solution: I simply don't know. In 2014/15 I couldn't find anything better for cases where browser-based JS was involved and it still might be the case. However it might be worthwhile to re-evaluate protobuf as the implementation I've used back then could have been subpar.

crazyyi commented 7 years ago

I am using JavaScript to build my game. The fact that JavaScript is a dynamic language makes it difficult to work with binary serialization. But as you mentioned at the time you wrote the article there are limited options out there things might have changed a lot by now. There are some very successful real time browser games such as agar.io and slither.io. They may also have their own implementation of data serialization which I have studied a little bit.

I guess JavaScript may not be the best choice for making a game back end but anyway I will give it a try. I like the protobuf format. It uses very little space. i may also look into Flatbuffer which is also made by Google and is simpler than Protobuf. I am more inclined to use 3rd party serialization tools as they are usually tested by the market and I am not quite ready to roll out my own solution. But a well maintained schema definitely will use very little resource and worths looking into.

If I understand correctly, in your Schema Messages project, the schema needs to be shared on both client side and server side. Then it would be vulnerable to client cheat as anyone can read the schema if it is not encrypted. How do you solve this problem?

tnajdek commented 7 years ago

Cheating is not a problem solved at the serialization layer. Even without the schema, your message structure can be obtained either from the client source code or from listening to the network traffic. To prevent it you need to define your messages in such a way that cheating is impossible. In the client don't send player's position, send player's action. Also, ideally, in the server don't send every update, send only updates that the client should render.

Flatbuffer is definitely worth evaluating, probably more than protobuf, which, last I checked, had pure performance in JS. BTW: both these technologies will require you to share schema between the client and the server, similarly to how schema messages does.

crazyyi commented 7 years ago

@tnajdek Cheating in a real time game may be very difficult as the action goes really fast and we can always send player's action. But with the client side schema, I think it is still possible for players to inject bots into the game. I think many browser games don't have mechanisms to prevent that. I am OK with this at the moment. I am now reading Glenn Fiedler's Building a Game Network Protocol which is very inspiring. According to his article with some efforts we can pack the packets down to bit level. The only problem is that although he claims that the theory is language agnostic the code is written in C/C++.