Run without rendering (for online game)

Recommended Posts

hi everyone :)

I want to make a online game, so I need to run the game at the same time in local (browser) and on a server (nodejs),
on the server, all the code must be executed, except the canvas rendering.

any clue where to start?

PD: the biggest problem I see is that the objects that leave the screen, by default are no longer evaluated.

Share this post

Link to post
Share on other sites

they are a few games here that you can look at for online gaming examples.

else for your second question you can set the alwaysUpdate property of your renderables to true, this will keep them "alive" even though they are out of the screen.  Be careful thought, that obviously, the more objects you have the more resources it will use.

Share this post

Link to post
Share on other sites

Yes I know
but each of them has a logic for the server side and another one for the game itself, for example Contra 2000 uses a server in java. Another option is use a server just to synchronize events like Node-Mayhem , but that generates many problems in the gameplay (if there is a lag) and it is very easy to cheat.

that's why I have the idea of running the logic of the game on the client and the same on the server, I'm not sure if I'm explaining it well, but I'm sure it's a good idea.

and indeed the idea is not use "alwaysUpdate", instead make the server use a default size, and now that I say I think it is not so complicated, I will create a plugin or something and I will show them

Share this post

Link to post
Share on other sites

Out of curiosity, how do you expect running melonJS on the server to prevent cheating? This is a topic which I have studied fairly extensively. Unless you implement a mechanism to actively address cheating, you're going to get a very sad surprise one day when your players start complaining about cheaters. For starters, here's a short list of relevant resources on the subject:

To followup with an idea provided in that Stack Overflow answer, running the game only server-side is effective against cheaters if you can guarantee low latency while streaming an audio/video feed (or the procedural equivalent). But that's way beyond the scope of what melonJS intends to provide.

By the way, are you familiar with the concepts of prediction, dead reckoning, and jitter buffering for networked multiplayer? If you miss these, you're going to have an unpleasant experience because the network is unreliable. Once your game goes multiplayer, you've entered the realm of distributed computing. And as with the CAP theorem, you can't sacrifice partition tolerance. This is a fun can of worms that many platform engineers will spend their entire careers learning and dealing with.

Isn't it amazing how extending a simple game to play on even two computers suddenly raises the complexity exponentially?

Share this post

Link to post
Share on other sites

I think of it this way

  • I want to make a game for web browsers (javascript)
  • and it has to be multiplayer
  • in addition to the game, I need a server
  • Why do I have to create a server if I can run the javascript on nodejs?

Yes, what you say is true: "running the game only server-side is effective against cheaters[...]", that's exactly what i want to do, but "[...]if you can guarantee low latency while streaming an audio/video feed" not necessarily, because I will have all the game on the client side too.

And Laghacking, if you are playing in a console and voluntarily release the joystick, only you lose. the same here.

it's my vision, I don't want to make a mmorpg or some huge production, I just want to avoid developing two times (server and client), and if I can gain a bit of security, much better.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.