HostileStudios Multiplayer System [1.5.6] (performance and reliability update)

http://hostilestudios.com/networking/net_log.png
One of the many asked questions in Game Blender is how to achieve multiplayer games.
There are a multitude of methods in which to achieve a networking system, but here is a robust, powerful system, for both in-experienced and confident python coders or the casual Logic Brick users.

CLICK THE LOGO TO GET THE LATEST RELEASE (1.5.6)
THIS REMOVES THE _decode COMPONENTS, REPLACING THEM WITH ONLY ONE ‘plugins.manager’

1)What you need

2)How to use it

https://youtu.be/ctNbvAj_nzY

What you can do ‘out of the box’

  • Set object position
  • Set object orientation
  • Set object properties
  • Set object visibility

Example of MultiPlayer in action

https://youtu.be/vmRSBu7vzas

Step by step
Download the python files from the website
Download the blender Build http://graphicall.org/83
Copy the files in the zip to the directory “2.75\scripts\bge_components”

Server:

  • In the components window type “terminal.server”
  • Click Help ->Toggle System Console
  • Start Game

Client:

  • In the components window on an empty type “terminal.client”
  • In the components window on an empty type “plugins.manager”
  • In the components window on the object you are moving type “plugins.position”
  • In the components window on the object you are rotating type “plugins.rotation”
  • Click Help ->Toggle System Console
  • Start Game

Useful links

http://i.creativecommons.org/l/by-nd/3.0/88x31.png

I think i may have made a mistake in the code for disconnecting clients, will sort today

please use another site to upload…graphicall is way to slow.

Nice script! Great work…i got it working on my pc…but yet more features to come right?
If i want someone to connet to my server? What shud he/i do?

Right, i am going to continue talking to you via PM/Skype, but here is the reply for the benefit of others
If you want someone to connect to your server, you give them you external IP address.
The problem is that the server needs to have the specified ports open, and it may only need the listerner (server) port open, but regardless it is best to port forward the listner (server) port and the nukber of clients who may connet (e.g 10000-10030).
I’m working on making it into a python script so that it can be used on Linux vps’ without blender, but it is behaving unusually.

how would i use this to make an fps game kind of like call of duty’s multiplayer. i have most of the models done, and a basic game setup, would i need to start over? any help would be appreciated.

I’m afraid this reply is short as i have little time at the moment. you need to work on a state system, so that you can send instructions to perform certain animations. I really will do a.tutorial, but until then, wait about a few days! I’m away at the moment, so no internet!

Right, so i’m going to introduce the concept of multiplayer games to you.
Firstly, read this tutorial. I have spent more time on developing basic multiplayer ideas, and it will help a lot: http://blenderarchive.hostilestudios.com/network/

After reading that, you should have some ideas about what i’m about to explain.
Multiplayer games comprise of two main features:
> Synchronized data
> Optimized Data

Of course, the synchronized data is just sending and receiving information. No, the harder part of networking is code optimization;
sending as little information as possible whilst retaining accuracy.
This means of course, that if you wanted to make a player move, you would not send the positions and rotation of each bone in it’s armature; that is a LOT of data.
Instead you have to work off what i call a [client-dummy] scenario.
This means that you have an advanced player setup that looks good and graphically functions smoothly.
Then, you have an enemy which receives preconfigured animation identifiers, and the players position.
This means that you don’t have to send (for example) the amount of ammo the player has, instead just tell the dummy when to shoot, and when not to shoot.

To implement this into a game such as yours, you first need to identify what data is to be sent.
In order to keep things simple, i will provide the bare basics, in the knowledge that once you have read this entire post, you ought to be able to expand upon it yourself.

plz make a mac version so i can test it on my mac too

I can’t really compile it, because i don’t have a mac, but the source code is on Moguri’s blog

Massive New concept for system design on it’s way.
Firstly i’m prototyping the design, then i will release a demo!
The concept revolves around dumb terminals and plugins.
The terminals act as a bridge, sending data to and from the client. The plugins analyse this data. The plugins work via TYPE, ID and OBJECT. TYPE is the plugin type (see below)
The plugins are specific types, such as movement senders, orientation senders, score senders.
ID is used so that plugins can be recognised to exist or not
OBJECT is used so that plugins will not create new objects if the object already exists. (saves the sender objects name in a dict)

More coming

More than one plugin can be used per terminal,
provided it doesn’t conflict (if you do something odd!)
In the event that the object

First public beta released! Click the image in the main post!

thanks agoose,I dont have words to this( and to all the other things that you ve shared with us) its just sublime, thanks a lot! you are helping a lot of people with this kind of thing.

Thank you leonn, for your kind comments and support for a majority of my work!

Blablabla. I didn’t mean to post here. This forum really needs a delete post button.

Oh no! My netbook has died, and i have my latest setup on it :open_mouth:

Recovered the files! :slight_smile: Can anyone read the first post again, and suggest features?

Added demonstration build, with build, files, and doc.

0: Really awesome, I thought it would be hard to make an online game… I was wrong . :smiley:

1: Is there a way to change the client ID or the server ip in game?
Example: The user start the game, before entering in the scene with the terminal, he choose is name and the ip he want to connect to via an input box.

2:Is there a way to get the client ID or the client ip in game. I want to create a lobby with the connected players id listed in it.

All of these are possible. At the moment, i have a random number added to the client ID so that i can debug it quickly, but i’ll be sure to remove that, or allow access to it.

I’m doing stuff as i write so keep checking this post