What are the basic componets of game logics?

As i asked this question i want to know more
I am creating an app similar to catrobat
How can be genralize game logics in such a way that every game can make up by just apply those genralized roles ?

I think roles are as follow

  1. inputs - do something when detect any input may be pressed some key or any other input sensor example movement by pressing w,a,s,d or arraw keys.

  2. collisions - do something when a specific object collisions with an other specific object example disappear enemies when bullet collides and even user’s finger touch collides with some specific object in game.

  3. change in object’s properties - do something when a specific property of a specific object is changed to some value or any other logic like greater than or less than example when user’s health is zero then game over.

  4. Time - do something at a specific time or any logic like after few seconds…etc example display new enemies after every 5 seconds.

By combining those roles i think we can achieve every possible game logic for example when user reached at a specific place then after 5 seconds create an enemy.

Is my roles enough to make every game or did i miss something ?

  1. Render - ;p

(Networking goes in there with the logic somewhere also.)

1 Like

Depends on the type of game maybe, but with a deterministic model, I think you want to shoot the inputs out asap after they are received, since travel time is so long. (Incoming packets can be received at any time, queued… And you want to clear that queue before running the simulation…)

So 1.5. Networking

  1. Render - do something when something specific is appear or disappear example when score is counted by how many enemies are destroyed so player’s score should increase when any anemy is disappeared.

am i right ?

Sort of joking ;p
In the context of BJS it’s literally just scenes.render() (after the game state is decided)
The render step is historically the most time consuming step for game engines (why bjs is so great =D)

all right.

i found blockly. This will convert bricks into javascript code
now my question is what type of bricks should i create such that by using those bricks or combinations of those bricks can create most games.

You are right though, you still need to render ex. Scenes and GUI in the correct order.

That’s pretty interesting actually…

I wonder where you would slot in AI

Probably during your #4?

for now i just focus on basic 2d games just like catrobat’s ‘pocket code’ app but i want to use Babylon.js for executing javascript code generated from bricks.

Okay, so I think your basic loop is

  1. Input
  2. Logic
  3. Render

seems very usefull ! thanks :smiley:

Within input is

  1. Local input (and broadcast that input)
  2. Network input

Within logic is

  1. Collision
  2. Object update
  3. Ai/‘CRON’ updates (not applied to objects yet, so not rendered until the next iteration)

And then render?

1 Like

Something like that, trying to sort it myself XD

The blocks idea helps

thank you so much !

1 Like

I would still wait on a third opinion XP