Skip to main content
added 628 characters in body
Source Link
Monster
  • 8.2k
  • 1
  • 12
  • 27

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?

Yes, you can.

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.

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.

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.

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?
Source Link
Monster
  • 8.2k
  • 1
  • 12
  • 27

Yes, you can.

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.

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.

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.