newb with a lag problem...

  • First of all, hello! I've stumbled upon arianne/marauroa at the end of last year and followed its development periodically ever since. From what I as a rookie coder with a background in mainly graphic design and media art can say, it's already an impressive achievement!

    I'm currently in my final year at a university of applied sciences in Austria, majoring in information design. My school required that I spend one term as an intern in a related field, and I ended up working for an indie game-designer who's hell-bent on creating a large graphic chat system / MMORPG blend. I'm supposed to hack up a quick prototype. :P

    Anyway, I am in the final stages of development of this "prototype". It sports a 3d engine written in Java/OpenGL and a fully functional offline demo-mode. I agreed to at least give it a try to work out a simple online version capable of handling several players walking around and chatting with each other. Having tried out Marauroa (tried to code a simple chat server and client which worked quite nicely), I thought it'll be able to do this just fine.

    So this is what I have done so far:
    I have downloaded the marauroa classes and put together the server code in Python. From what I can tell, it's working quite fine. It has a chararacter class with all necessary attributes and facilitates moving the characters around and checking for collision.

    I guess the client-side is more of a hack. I'm actually using classes from the marauroa/net directory directly. Well, the NetworkClientManager, mainly. I'm not sure if this was supposed to be done this way, but time is really an issue for me and it seemed to work quite nicely (except for the issue I'm getting at here). I have coded a networking class that runs in its own thread, querying the networkclientmanager for new messages in an infinite loop. The main game loop runs in another thread, performing client-side computations and openGL rendering. Both call Thread.yield() at the end of their cycles to give each other the chance to run.

    Please let me stress again that I'm really not a software engineer by far and that consequently I may have treated your software quite cruelly... If so, please accept my apologies. :)

    Anyway, the problem with this setup is that I get quite an enormeous lag (up to a second) in receiving messages from the marauroa server, even when I'm running it *locally*. Actions sent from the client to the server arrive there almost instantly, though.
    What really bugs me is that I have no idea whether this is a problem in my design (i.e. whether the JOGL OpenGL bindings are granted too much CPU usage), or whether it's because I shouldn't have ripped out your net classes this way anyway, or whether it's something entirely else.

    I thought perhaps one of you has seen this problem before, as it's very probably that I'm missing something obvious. Any hints would be muchly appreciated.
    I'm using 0.41 btw.

    Thanks again for the effort you're putting into this. I'm sure there's a lot of people who are looking for something just like arianne/marauroa.

    best greetings from Vienna,

    • Hi there, nice to see a real user of Arianne finally! Im not an expert at the system and suggest you wait for a reply for Miguel the main delveloper, however a few things I might be able to point out.

      You say lag of a second, are you sure you have not got the game turn time at one second?

      second, the client is meant to be coded using the ArianneXP system, ie the Arianne Library for client side. Im not sure about where this is in Java but im sure Miguel can help.

      Finally please remember that we have loads of documentation on the Homepages Wiki and it would be good (for your own sake) if you made sure you went through those at least to fully understand the inner workings.

      Good luck, maybe when your game is done you can show us all ;)!


    • Hi and thanks for the quick reply.
      Turn time is at 100ms. The lag varies between approximately 300ms and 1000ms (my guess).
      If this is of any help: I have tried to insert some print statements at the end of the nextTurn function, and they show that reaction to the client's actions takes place on the server with virtually no delay, so my best guess is that it's the client that's taking its sweet time interpreting incoming perceptions. :) But I don't know where to look for a remedy to that.

      When I first downloaded marauroa, I tried to make a point in downloading as much info as I could find - unfortunately, at the time, the info seemed to be spread over quite a few locations, so I do hope that I have everything in place. I'm a bit hesitant to look at the docs for the new 0.90 version for the sake of ensuring consistency.
      If I can get this to work and if my approach is not too far from what you guys intended, I'd like to write a quick tutorial from a hack's perspective if I can find the time. :)

      I didn't get into ArianneXP, mainly because it seemed a bit overwhelming at the time. Honestly, I was just looking for a quick solution, and looking into those dependencies after brushing up on my amateur java, learning OpenGL, some MySQL and some Python seemed to be just a bit too much for me. I'll grant you that I rushed this decision, but I really wanted to work with my own code as much as possible, as far as the client is concerned.

      I'd really love to show you what I'm working on, as I'm quite proud of my work. Unfortunately, my employer believes the approach we took in the overall look and feel of the game justifies working under an NDA. (I don't. :P )

      Anyway, as soon as he'll get into production and his paranoia will ease, I'll be happy to post the demo.


      • Locally, the lag must be hardly 0. The game lag you will see is (*should be*) 100% related to turn time.

        Interpreting the perception at client ( as I am sure you are using PerceptionHandler class ) is inmediate and it can't add any delay.

        If you want, send me the server and client files related to Marauroa and I will tell you if the problem is arianne related.

        And again, I would not move to 0.90 until it is more estabilized and documented in the wiki, I would wait to see a few releases of stendhal before doing the jump.


    • Hi.

      I am sure that the problem you are pointing is related to turn time.

      Arianne is turn time based, so you establish turn duration in marauroa.ini file ( or whatever ). Write a turn time of 300 (milliseconds) and everything should run smoothly.

      Exactly Client is more than a simple hack. Your idea of placing it on a different thread is not bad, check on NetworkClientManager that you are not placing a delay on reading from network.

      You could try to copy file on 0.90 release that does ease a lot the development of clients in Java ( but you will need to modify it a bit to works with 0.4x ).

      I won't use 0.90 release by now, I would wait for it to become a bit more *stable* ( in development ), anyways porting a game to 0.90 is pretty easy.

      Hope it helps.

    • Thank you very much for your help, Miguel.

      As a matter of fact, I completely overlooked the PerceptionHandler class until now, which just shows that it was a good idea to come here for help. :)

      Anyway, I spent last night rewriting the code using your PerceptionHandler and PerceptionListener, but my problem still persists, so if I may, I'll take you up on your offer and send you some code. I'm now very sure I'm missing something that will be obvious to you.

      My code is a huge ball of goo, but the NetworkManager is in essence relatively clean and I've done my best to comment it so you get an idea of what's going on. The python file for the server is basically derived from the mapacman example; I'm sending it over as well, but I'm rather sure the fault is in my java code.

      thanks in advance,



Cancel   Add attachments