Algorithm for Client-Server Games

后端 未结 6 1565
谎友^
谎友^ 2021-01-30 11:59

For stand alone games, the basic game loop is (source: wikipedia)

while( user doesn\'t exit )
  check for user input
  run AI
  move enemies
  resolve collisions         


        
6条回答
  •  暖寄归人
    2021-01-30 12:25

    A very useful and I would argue pertinent paper to read is this one: Client-Server Architectures

    I gave it a read and learned a lot from it, a lot of sense was made. By separating out your game into strategically defined components or layers, you can create a more maintainable architecture. The program is easier to code, and more robust than a conventional linear program model like the one you've described.

    That thought process came out in a previous post here about using a "Shared Memory" to talk between different parts of the program, and so overcoming the limitations of having a single thread and step-followed-step game logic.

    You can spend months working on the perfect architecture and program flow, read a single paper and realise you've been barking up the wrong tree.

    tldr; read it.

提交回复
热议问题