Basic MMORPG framework

Hi,

I’m branching this new topic so we dont clog up mikko’s Smash Bros’ thread, ( I still think that is an ace idea though mikko, will help if I can :wink: ).

I would like to put together a basic blender / python multiplayer pack which contains all the basic bits to make a multiplayer game, playable over the internet, which people can drop their own content into quickly
and easily.

I have already started doing this, and you can download what I’ve got so
far from http://www.zerofilter.com/Client_Server.zip

This file contains the server script that runs in python, and the blender client file. Currently it only runs the server and accepts connections from
the clients, nothing more, so anyone who is a serious network programmer, this is where you come in!

Would be great to hear what folks think of the files, and any help and advice that anyone has. As I said, CURRENTLY IT DOES NOT WORK, but I dont think we’re far off from having a working demo!

I forgot to say, to test the client, you will need to change the host settings in the ClientConnect script. Currently it gets the IP address of whatever computer is running the server from a web-page, which wont work unless it is changed!

So yes, I know that first build was pretty crap, and probably meaningless to most!

My first problem:

When using the try: --> recieve data process, can that only be used once? In my client script I try to use this twice, it works fine the first time (ie: to assign the client its own ID number), but when I try to get the client to recieve the ‘game state’ aftert that it falls over. Anyone got any ideas?

I’ll take a look at it tonight. Maybe your second “try: --> receive” comes too soon, so the server did not have time to send the data?

heh youve got a lot of work ahead of you :slight_smile:

:slight_smile:

RonC

That must be comforting. :expressionless:

making multiplayer for blender is hell. I’m not kidding.

ROnC

Is it Blender that makes this so difficult or is multiplayer in general a pain?

so :smiley: you still workin on this one ???

it seems interesting . . . . 8)

Don’t give up, or even let doogs intimadate you. He can only make bunny eared characters and wine like a 3 year old half the time anyways :wink: I haven’t tested out your client/server yet, and I dunno if you’ve seen this tutorial yet, but I thought it would be helpful to your work:

I started with it when I was working on my FPS game ( https://blenderartists.org/forum/viewtopic.php?t=56478 ) that I started makin into a LAN game. I haven’t gotten very far with it, and just recently recovered the files from an HD crash, but thought it would help you out. I’ve asked d00gs about CDO’s mmorpg network system but it’s so top secret that my military security clearance can’t even access. Good luck with the game and if you need help, I’d be glad to help out as much as I can. I’m currently working on a racing game, but always eager to show my opensourceness and share information.

definently don’t stop…
you’ll find a way…it will work
hell it might even be better then cdo…though it is a good milestone for blender…they like set the milestone, the broke the record about how far we can go with online gaming with blender…

err ohh yea…START SMALL! one you get online going don’t try to make an massively multiplayer online game…you dont really have that choice…unless you have an awesome internet connection and a supercomputer…i had a freaking server (literally) and dsl internet…I could only hold 2 people online and my models were too high poly…

ohh and this http://ash.webpark.sk/multiplayer_eng.htm
will help you out a million…its a very good basis…go to devshed.com go to the python section and they have 2 pdf’s on netowrking in game with python…

Blimey :smiley: weird when u get caught up in other stoof for ages, and neglect a post!

Well, thanks 4 tips n support, and reality checks :stuck_out_tongue:

I have unfortunately not had 2 much time to pursue this blend recently, but I will be taking it up again soon. I’ve got to brush up my python (no pun intended) and then try again :wink:

Cheers for all the interest so far, anyone who wants to use the script is welcome to, I’d love to see someone make it work in their own game, cos so far i certainly cant :stuck_out_tongue:

http://www.bbc.co.uk/radio/aod/genres/urban/aod.shtml?radio1/goldfinger

Ive bin too busy listening to this to do python :slight_smile:

i did not try to intimidate, just telling this guy its a lot more work than one would originally think

RonC

Yeah, begining to realise that myself. However the Python libraries make it a damn sight easier than building an entire socket system from scratch!

I did have something basic working for a bit, guess I got overexcited with initial successes, and didn’t properly appreciate what is required.

However, I aint giving up. When I have 5 mins free from work next time, I’ll be continuing. My original idea sometime last year was to do something like ‘Spore’. Although thats now been done much better than I could do!

I’m new for this engine, already made something not finished, and noticed the game sometimes start with different speed (looks like everything have higher damping than origin) without change any parameter. I don’t know what’s that, but will that make big problem in a network game?

I dont think it should be a problem if the client/server is planned properly. Its just a case of making sure the server waits for signals from all clients. That does mean however that one slow-running client may make all the others lag a bit too, which is where you would need to introduce a timeout routine or something. Have you tried out the sample file above? (Remember to run the python script in its own python window, NOT in blender), let me know if you get it to work! :slight_smile:

Yes it works on my Fedora system. I don’t know how to check the features but at least it connected. As some simple network games, the code make Blender freeze before connected, maybe this can be improved.

This will make playable Blender games much more common, we don’t need made so many stages or AIs to beat because we got network opponents, good job.

Wahey! I’m really glad to hear it worked on your system!
Conveniently, I’m moving into a new programming job which should be easier on my spare time, and allow me to get back to work with this project. ( Purchasing Elder Scrolls - Oblivion certainly didn’t help either that game is sooooo good )

The next stage is to make an array in the python server to hold all of the clients, and add new fields with each new connection thread. (Which I’m not sure about yet)

Something I do now know more about is the next stage, using the ‘Add Object’ actuators to place the players, hopefully I’ll have this added soon.

I’m really hanging on for the ability to dynamically import images as textures in GE, that would be fabuloso. Also dynamic parenting, but I gather that has been solved to some degree.

If anyone does anything with this script and need some upload space give me a shout, got plenty of empty server space + good-ish bandwidth.

hello i took a look at it and got most of the client script to work except for the end
import pickle
from socket import *
import time
time.sleep(2)
cont = GameLogic.getCurrentController()
own = cont.getOwner()
scene = GameLogic.getCurrentScene()

Are we connected ? (Connection is handled by ClientConn script)

if own.Connected == 1:

Try to recieve our personal Avatar data

rec = 1
try:
data = GameLogic.conn.recv(1024)
except:
rec = 0

if rec == 1:
if data:
cData = pickle.loads(data)
GameLogic.myPlayer = cData[0]
print 'Connected to player thread: ’ + str(GameLogic.myPlayer)

Send the ‘All clear’ back to the server and

Get ready to recieve the full gamestate if needed

GameLogic.conn.send(‘Ready’)
time.sleep(1)

rec = 1
try:
pData = GameLogic.conn.recv(4096)
except:
rec = 0
print ‘Recieve GameState Failed …’

if rec == 1:

print ‘Recieved’

if pData:

Unpack the WHOLE game State

gameState = pickle.loads(pData)

print gameState

Loop thru list of players

for player in gameState:

If not THIS player

if player <> GameLogic.myPlayer:

Creator = cont.getActuator(‘Create’)
own.setPosition((cData[2]))
GameLogic.addActiveActuator(Creator, 1)
Avatar = Creator.getLastCreatedObject()
Avatar.Client_ID = cData[1]

Hope this helps

Thanks dude, I’ll get back to working on this script now I have some free time