Saturday 15 September 2012

python - Pygame and Multiprocessing Strategy -


I am developing a game in pygame and I do not know which process to go into which process.

I have two processes connecting a pipe, one will calculate another in one window.

My question is: Which part of the main loop should go to another process?

In my game I have to do event handling, collision detection, AI, drawing and heavy calculation (2D lighting).

I'm scared that if I put a lot of stuff on the other process, the main has to wait for input and the FPS gets freezed.

PS: Right now I'm starting the game so that I can not show you a lot of code.

is there

I recommend the following structure PyGame with two processes :

You divide your program into two parts:

  1. Models

    All game logic

    • Please update the game, for example
    • < P> GUI
    • Gui is in the main process because it starts many games When a game starts, it must start important parts of the game.

      Responsibilities

      • Handle User Input Press Right Arrow
      • Send Models to Modifications eg

        Note that I really do not know much in PyGame. But besides keeping and viewing models is possible.

        You can also see, at a glance. But it's really huge enough to just merge and merge the controller if the program will not be distributed on the computer.

        Then I have not heard that it is very sure that it is very much because you only need to split your game into two parts, not three.

No comments:

Post a Comment