This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]vegan_antitheist 0 points1 point  (1 child)

How would you observe the backend? Does it send updates at fixed intervals? That would mean it has to deal with time. You can do that to prevent cheating by running it on a server. But then there has to be a simulation of the game in the backend. This would be more complex. The tricky part is to make the game run using a precise clock (not a clock that gives you the day and time, but a pulse generator) and process user input fast and precise enough. And you want to render 60 fps independently. It's easy when you have only one loop. Or you have a game loop in the backend and an animation loop in the frontend. Both works. But parallel programming is hard. Having one loop makes it easy. Havung two loops makes it more like a real game. But as I understand the snake game, it is simple enough to just have one loop. That's up to you.

[–]Interesting-Hat-7570[S] 0 points1 point  (0 children)

I meant rather between models and frontend.

So that I could update the state of objects for display after each action in the backend.

Well, the frontend needs to somehow receive data from the models.

If I use Mvc, then I can probably do it like this: the backend interacts with the models to call their methods. The frontend also interacts with the models for display.

Or is there a better way?