Page 1 of 3 123 LastLast
Results 1 to 20 of 45
  1. #1

    Networked Multiplayer Deathmatch Template [2 or more players] WIP

    Hi there,
    This is another template for network multiplayer. This is like a deathmatch (actually not a FPS, sorry)
    I made a lot of improvements over the first version.
    • Server and client are in a single file (but in different scenes)
    • This version uses only non-blocking sockets. So, it does not freeze blender and don't need multithreading
    • Interface to choose run server, or type server IP address and run client
    • Real multiplayer. 1, 2 3,.., 20, 400 players can join the game. It is limited only by server memory and network lag. You can use this in your MMORPG ( it's a joke !!! Check posts below)
    • On screen message log

    What is missing:
    • Detect clients disconnection to remove avatars from game. (I already did it, but the script simply disapeared )
    • Detect when client fall from arena and send a "frag" message (and count "frags")
    • Some UV scroll on tank movement

    How to test (in one single machine):
    • Open multiple Blender instances with the tank.blend file and position windows side-by-side (you can see 4 blender instances in the pic below)
    • Run ("P") the game engine in all Blender's
    • Choose one Blender to run server (click "Run as Server")
    • Choose the remaining Blenders to run client (click "Run as Client")
    • Use WSAD in a client to move the tank. Arrows to aim the turret. Space to shot
    • See action sychronized in all blender's

    How to test (in a network):
    • Chose someone to be the server (everybody must know the IP addres of the server machine)
    • Run Blender (tank.blend) on server machine and click on "Run as server"
    • Run Blenders (tank.blend) on other machines. Type the server IP address and click "Run as client"
    • Try a deathmatch (and tell me if it works )

    I tried to put a lot of comments in the network code to help people understand it. But what people must be aware is that the network code is not the hard part. The most complex task in any networked multiplayer game is to define and control the communication protocol and synchronization messages and procedures.
    I wil try make this a complete game

    There it is:
    http://www.4shared.com/file/82320784/232ff1b3/tank.html

    PS: Linux users. Plz, tell me if it works in your linux box
    Attached Images Attached Images
    Last edited by morgade; 24-Jan-09 at 16:08. Reason: Link updated



  2. #2
    Banned Member
    Join Date
    May 2007
    Posts
    3,015
    awesome!

    we really need more multiplayer games

    me and p00f want to make a chess like game to play online.

    thank you



  3. #3
    ooh this looks effin sweet, I'm downloading it in a sec...



  4. #4
    Hello
    not working on my Debian/GNU Linux

    Here's the messages:
    PYTHON SCRIPT ERROR:

    Traceback (most recent call last):
    File "NWC_ReceiveState", line 9, in ?
    File "/usr/lib/python2.4/threading.py", line 13, in ?
    from collections import deque
    ImportError: /usr/lib/python2.4/lib-dynload/collections.so: undefined symbol: _PyArg_NoKeywords
    Compiled with Python version 2.4.1.
    Checking for installed Python... got it!

    Bye and thank you



  5. #5
    Originally Posted by OTO View Post
    Traceback (most recent call last):
    File "NWC_ReceiveState", line 9, in ?
    File "/usr/lib/python2.4/threading.py", line 13, in ?
    from collections import deque
    ImportError: /usr/lib/python2.4/lib-dynload/collections.so: undefined symbol: _PyArg_NoKeywords
    Compiled with Python version 2.4.1.
    Checking for installed Python... got it!
    Thanks OTO.
    It looks something wrong with your threading module. Well, i am not actually using it (but i forgot to remove the import command from the scripts). I posted a version without this imports. If you can test it again ...

    http://uploaded.to/?id=6ymlk9
    Last edited by morgade; 22-Jul-07 at 08:09.



  6. #6
    Member Pash's Avatar
    Join Date
    Feb 2007
    Location
    Rhode Island
    Posts
    423
    Wow, this is awesome, I just hope those people who are looking to make MMORPG's don't become harder to persuade



  7. #7
    Member goldentaiji's Avatar
    Join Date
    Jan 2004
    Location
    Virginia
    Posts
    1,432
    Wow, really nice.

    Heh, wasn't able to test it out on my old labtop, but will try it out with my desktop later on. Is this only for network or does it work over the internet too? Haven't tried that yet either.

    Morgade, if it's not too much of a hassle, would you be able to explain what parts of the code would be hackable to be customized for different multiplayer games.

    In particular...
    - which places send/receive message pertaining to the player
    - how that information is used, etc.

    Jason Lin



  8. #8
    Member facemania's Avatar
    Join Date
    Sep 2003
    Location
    Canada
    Posts
    876
    Very cool!

    Maybe some more mmorpgs aren't too far into the horizon as some of us thought?

    Thanks Morgade!



  9. #9
    lol an mmorpg would be fun to do. it sounds like a great community project...



  10. #10
    Hello again

    now, it seems to work!!
    I could connect Player 1 and there's no error messages.
    Nice work!
    Bye



  11. #11
    Member Olm-Z's Avatar
    Join Date
    Apr 2006
    Location
    Bxl - Be
    Posts
    322
    for me it's working on ubuntu (6.10 and 7.04) with network on LAN ...but it's not "fast" ... the animation drops at 15/20 fps with lag with "outside" and "services" using the CPU almost at 100% together ... with only 2 clients ...
    I think that from this, we are long time ago in a galaxie far, far away from having a MMORPG structure ...

    but it's a good start .. !

    Also, the disconnecting feature is VERY important ... the whole system is pointless if it's not able to wipe out disconnected player, at least after some time of idle...



  12. #12
    Originally Posted by Olm-Z View Post
    for me it's working on ubuntu (6.10 and 7.04) with network on LAN ...but it's not "fast" ... the animation drops at 15/20 fps with lag with "outside" and "services" using the CPU almost at 100% together ... with only 2 clients ...
    I think that from this, we are long time ago in a galaxie far, far away from having a MMORPG structure ...
    mm... A lot of things can be happening. Coding a network game server requires a lot of hacking. It's needed to optimize sockets buffering use, message sending interval, position interpolation in clients, delay workarounds, etc... The CPU charge could be saved if you use a lower buffer size in the recv operations (try changing it to 512 instead of 4096 in the ReceiveState and ReceiveInput scripts). The lag could be caused by network problems, or lower operation system UDP datagrams queues (causing message dropping). Or even you are noticing the LogicTicRate set to 30 (state being synchronized only 30 times per second to avoid network flooding). Finally, check if some unexpected error are being printed every frame in the console, making everything slower.

    The MMORPG thing in my post was just a joke. A MMORPG server is a real complex system. You can create a MMORPG client with Blender, but i doubt someone can create a robust server. The server could be more easily created in something like Java or C++ (and it sill can use Bullet physics).

    Originally Posted by Olm-Z View Post
    Also, the disconnecting feature is VERY important ... the whole system is pointless if it's not able to wipe out disconnected player, at least after some time of idle...
    I will try to add this soon. It's just an Always sensor pulsing every 3 seconds to a python script that checks the state of all TCP client connections, and remove objects related to clients with invalid TCP state.



  13. #13
    Member hoxolotl's Avatar
    Join Date
    May 2002
    Location
    Netherlands
    Posts
    811
    1) is it open source, or do you want royalties to further development? (beer? pizza? cake?)

    2) going to check thouroughly when I get home from work, but eh, do you mind if I cannibalise the code and game mechanics for another project? (off course I'll make any *cough* improvements *cough* on the network engine available).

    3) yes, I know, I'm sucha a lazy programmer I don't even take the time to code it myself.

    (the coughing is mostly due to me not being a good programmer, and that I suppose I won't be able to do anything but bog the network code down, but at the very least, I'll give it a try).
    "If the greatest view is seen from the edge of a cliff, it's best to know which way you're facing before thinking two steps ahead."



  14. #14
    Member Olm-Z's Avatar
    Join Date
    Apr 2006
    Location
    Bxl - Be
    Posts
    322
    The MMORPG thing in my post was just a joke. A MMORPG server is a real complex system. You can create a MMORPG client with Blender, but i doubt someone can create a robust server. The server could be more easily created in something like Java or C++ (and it sill can use Bullet physics).
    well ... I understood that =^^= ...

    From my point of view, a MMORPG is not only a problem of network coding, but also a content production question.... it needed millions of bucks to blizzard to build WoW, so of course, we're not playing in the same court....

    For the multiplayer server part, I think it could be done in python also, and maybe the BZoo project could give some ideas. (don't know if it's still alive ...)

    Here, I tried to reduce the buffer but it didn't change anything... and no error in the console...

    I understand this is some hard work, it's why I did reply with what I found on my systems (and the fact that it works with lan on linux)... I'll look further to see if another machine has the same problem as server, as I tested this on an AMD64 build that I don't trust completely.

    keep up the good work !!



  15. #15
    Member hoxolotl's Avatar
    Join Date
    May 2002
    Location
    Netherlands
    Posts
    811
    Just poking my head in to tell people that it seems to be working, for me, running 6 clients on the same computer gets a little laggy and weird but it passed the crucial test: it didn't crash my old'n buggy computer
    "If the greatest view is seen from the edge of a cliff, it's best to know which way you're facing before thinking two steps ahead."



  16. #16
    Originally Posted by hoxolotl View Post
    1) is it open source, or do you want royalties to further development? (beer? pizza? cake?)
    Open Source. You can send me some bucks if your game become the next WoW

    Originally Posted by hoxolotl View Post
    2) going to check thouroughly when I get home from work, but eh, do you mind if I cannibalise the code and game mechanics for another project? (off course I'll make any *cough* improvements *cough* on the network engine available).

    3) yes, I know, I'm sucha a lazy programmer I don't even take the time to code it myself.
    Go ahead.

    Originally Posted by Olm-Z
    well ... I understood that =^^= ...
    I know ! I emphasized the joke because suddenly i realized that most people reading the post could take it serious !

    Originally Posted by Olm-Z
    For the multiplayer server part, I think it could be done in python also, and maybe the BZoo project could give some ideas. (don't know if it's still alive ...)
    Mmm.. I know it's like to argue about religion, but actually I'm not a Python fan. I think that static typed languages (like C# or Java) are better than dinamically typed (like Python) to implement big projects like a game server.



  17. #17
    Member chuzzy06's Avatar
    Join Date
    Feb 2006
    Location
    Massachusetts
    Posts
    356
    aw man morgrade this is awsome . Your going in my credits list whether you like it or not, lol.
    Thanks for this, Chuzzy



  18. #18
    i keep getting 'import error: no module named socket'

    can someone help



  19. #19
    simply, fast and works fine
    excellent work
    in the future
    it wanted to play fps with some of this page .



  20. #20
    Originally Posted by rowboat View Post
    i keep getting 'import error: no module named socket'

    can someone help
    You need Python installed in your computer to run it
    Probably you don't have it installed, or your Python installation is broken



Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •