scidave's Forum Posts

  • This tutorial shows how to make network programs, and online and LAN multiplayer games using Python and the PodSixNet (http://mccormick.cx/projects/PodSixNet/) library.

    The tutorial walks through setting up your environment,distributing your game, using the PodSixNet library, and then reviews the .cap files of several example network programs. The games include a chat program, network pong, and a 2-10 player dungeon escape game. Latency is briefly addressed and some techniques to reduce lag are mentioned.

    Download link (need Construct .99.84 or later)

    http://www.box.net/shared/1ukq09e6e1

    <img src="http://i43.tinypic.com/153ma2p.jpg">

    <img src="http://i42.tinypic.com/657hbc.jpg">

    Users are assumed to know a little bit about Construct and should already have done the Ghost Shooter tutorials at the minimum. Only minimal prior knowledge of Python is necessary. Enjoy!

  • New version uploaded. Increased speed of players, and added interpolation to the beast. There is no noticeable lag on the beast even after a 600ms roundtrip latency is added. I think it is safe to say that this takes care of *most* internet latency issues, at least for slower action and RTS games. Unfortunately, I can't interpolate the other player's positions because of the broken Python access to private variables. This will probably be fixed in the next Construct release so it is not that big of a deal.

    http://www.box.net/shared/ypq6pdj0mf

    Good progress is being made on the tutorial front as well.

    p.s. I never got any feedback that people couldn't get this to run (besides Tulamide). My guess is that most people testing already had either Python or Visual Studio installed. If you could not get it to run then try running the VC redistributable installer and that should take care of the problem.

  • Everything that Newt said.

    I did a really simple example of what you are talking about in the Adventure tutorial part 4 using global arrays.

    Look at that example and perhaps you will get some ideas for an approach that might work for you.

  • I was thinking about accounts that could be sent to email to be "activated" or what-ever.

    Seems reasonable. I would recommend using a globally accessible email relay like gmail then. Be sure to let us know if you run into any roadblocks. Good luck!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • This would be straightforward to do with Python:

    http://docs.python.org/library/email-examples.html

    I don't quite understand how sending emails is going to get you closer to making an MMO though.

  • Excellent work! Just downloaded it and it worked well. I like how you in-lined the library code so folks don't have to mess with custom Python builds.

    Used Constructed 0.99.86.

    I think this should be .99.84.

    btw.. I stumbled upon pysage today which is a Python tool on top of pyraknet. May be worth a look.

    http://code.google.com/p/pysage/

  • Does the "Is visible" work for multiple instances of a sprite. So say you have 100 instances of one sprite on the layout, but only 5 that are visible would that only put the 5 instances in the SOL?

  • I'll take a crack at answering your questions, although I'm not a big network programmer myself.

    Are there any examples of some MMORPGs using it

    • Eve uses Stackless Python.
    • The creator of PodSixnet is making an MMO that should support hundreds of players at one time.
    • OpenRTS is written in Python/Pygame

    And can you say for certain that using a python library for networking will work well with a fast paced online action game with construct, and there isn't any reason why it shouldn't be fine.

    It hasn't been done yet so nobody can say for certain, although I don't see any roadblocks assuming the following issues are addressed:

    • Access to Object private variables in Python
    • Access to behaviors from Python code

    While there are workarounds to the two above cases it will make for messy and inefficient code. You need to have access to behaviors in order to interpolate and predict properly. Until that is done, Construct/Python code will be limited to turn-based and slow action games over internet.

    MMORPG in a 2D sense would probably mean 6-18 characters in a room cooperating.

    This is already a given in Python. I'd venture to say even in PodSixNet you could do this for faster pace assuming that you also interpolated the players positions and perhaps added predictive code. I don't know how fast your characters will be moving so if things are happening insanely fast you might have issues w/ TCP. You wouldn't even need to do the GGPO type things you are talking about.

    There are different levels of netcode which handles various levels of lag. From simple to more complex:

    1. Basic TCP/UDP library. PodSixNet is an example of a basic TCP library. It performs what it needs to do quite well and integrates perfectly with Construct. However, by itself it is only practical with slower online or fast LAN games. You will start to notice the effects of lag over a 150ms latency (300ms round-trip).

    2. Interpolation: Even with a UDP library you can't escape lag. Interpolation is used to smooth the movement of the player from the prior position to the new position. This is usually done with tiny movements each frame until the player reaches the new position.

    3. ClientSide Prediction (Dead Reckoning): If there are large amounts of lag even interpolation will not be sufficient. In that case, the clients can predict where other objects will be by keeping a rolling average of the latency and using speed,direction characteristics to predict the actual position.

    4.Lock-Step: This is usually used in a peer to peer networking scheme where each client will take a fixed amount of latency in exchange for seemless play with other peers (of similar latency). Usually, everybody will have a latency of say 100ms and that allows for deterministic play between all of the peers.

    5. Roll-back: This is used in GGPO and in a bunch of FPS games as well. Sometimes a player will die on the server, but then an update comes from the client saying that he would have moved in time. The game is then rolled back on the server and all clients get updated information.

    I think roll-back will be a real pain to implement and I have no idea how it would fit in with Construct. I'll have to leave the timedelta issues and implementing it to the developers.

    I'd like to know if this isn't more suited to a C++ plugin or something else.

    I think we can all agree that a plugin is going to be more suited to networking than Python. If a plugin was written it could handle a lot of the synchronization for fast-paced games behind the scenes you might have to do with Python. That being said, PodSixNet integrates well with Construct so for its use case I would say it is well suited.

    So to summarize all of this:

    If you want to make turn-based, RTS, or slow action online games use PodSixNet. It integrates easily with Construct and is easy to understand and use.

    If you want to make fast-paced games then as of right now it is not practical (because of Python access to behaviors). Once the Python support is improved then it is probably up to the skill of the programmer, but you are in uncharted territory.

    Edit: Based on frpnit's work with UDP, the Mastermind library might be a good alternative as well.

  • Unfortunately, this is a somewhat tedious step.. but hopefully the next update to Construct will make this easier. Make sure you select the .pyc libraries when you are creating the executable.

    You must select all of the .pyc libraries (except the encodings directory entries.. don't check those) when you get to the portion in the export wizard on python settings.

    This should be in page 4 of the quickguide on creating the .exe. You probably have around 25 .pyc files that you need to check.

  • Awesome!! Way to go. You've helped me out as well identify how I can make the instructions better.

    Nice work!

  • 2. I installed GTK+ and added directory "C:\gtk\bin" to my system variables and named it "gtk"

    You need to add "C:\gtk\bin" to the "Path" system variable. Remove the "gtk" variable and add the directory to your path.

    <img src="http://i43.tinypic.com/256dwyb.jpg">

    For example, I installed mine to C:\opt\gtk\bin and this is how my path looks.

  • You should never have any problems running the code inside of Construct. The part with using cx_freeze and the library.zip is only when packaging for others.

    If it fails inside of Construct, that means that your pyGtk, or other library install is somehow wrong. Are you able to run this Python script from the command line?

    http://www.box.net/shared/bsiqeevoi6

    Does it correctly produce a screenshot? If it fails then go back and make sure you followed all the steps in the tutorial (especially the steps in page 3 about setting your system path).

  • Uh... isn't using python library solely for taking screenshots a bit excessive?

    Of course it is. but how else would you have him accomplish this? Write his own plugin in C++??

  • Sounds like you are close to getting the build to work. Here are the steps from where you are at.

    1. On page 3 of the Part 2 tutorial there is a Python script. You need to create a file called "test.py" and copy the import lines of the script into that file. Read the Python_quickguide if you have not already.

    The file should have the imports:

    import sys

    import pygtk

    import gtk

    2. Once you have the script, you need to build a cx_freeze build script called "setup.py" like below in the same directory as the script you just created. This is shown in the Python_quickguide.

    from cx_Freeze import setup, Executable

    setup(

    name = "screenshot",

    version = "0.1",

    description = "Basic screenshot example",

    executables = [Executable("test.py")])

    3. Once you have done that, open up a command prompt, cd to your directory and run the tool:

    "setup.py build"

    4. This step produces the library.zip file and all of the other dependencies that you see I copied with the executable. You unzip the library.zip file into your Construct\Data\Python directory. The other dependencies you bundle with your executable. You might also have to bundle the vcredistributable as I was explaining earlier.

    Give the quickguide a short review and hopefully this all works!

  • See my post before your. I just uploaded a new version with the vcredist and some new Dlls.

    Please remove Python26 and try the new version out first without installing the vcredist. If that doesn't work then try installing the redistributable. It is only 2mb so much better than installing Python.

    Ok, I duplicated your error message after I uninstalled Visual C++ on my XP system. I then installed the vcredist and that solved the error message.

    As far as releasing new instructions, that isn't necessary. Just follow everything in the tutorial and the only addition is to install the vcredist. If you don't want to install the vcredist then read the Part 1 tutorial where I discuss packaging your own msvcr90.dll and manifest file.

    Good luck!