1
$\begingroup$

Could I use the Blender Game Engine, Python, and Python's sockets module (internet data/communication module) to make a multiplayer Blender game?

$\endgroup$
2

1 Answer 1

1
$\begingroup$

Yes, you can.

Game aspect

You can use any Python network library (such as socket) to send and receive data. The BGE itself does not have a build-in network system.

Access method

I suggest to use a non-blocking polling operation. This means your python code asks the connection for the data received since the last run and applies it to the scene. When no data was received ... do not wait for data as this will block your game.

Threading

Avoid the usage of threads (as you often see in examples). This can cause conflicts inside the BGE game loop. Just Implement the inner code of the thread loop as a script.

Network business

The sole transfer of data (connecting, reading and writing) is pretty simple. The most work needs the business around that.

When to connect?

When to send what?

When to expect what kind of data in what format?

This strongly depends on your game.

Be aware you should think about:

  • Where to get the servers IP address?
  • How to authenticate a client?
  • How to create a lobby to bring the players together?
  • How to start a game session with known clients?
  • How do the participants of a game session communicate with each other?
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .