• Content count

  • Joined

  • Last visited

Community Reputation

126 Neutral

About pjuke

  • Rank
  1. So if I got this correct, both players needs the server to tell the player to move. That is, even when the user press' the forward key, the actor wont start to move until it gets the response from the server? Like the first Quake game, with no client-side prediction?   I see that solution would work, but I need immediate response from inputs tho. Especially from the player which spawns objects. I'm currently using a jitter-buffer on the receiving side, so it is already a little bit of excessive latency going on.   Thank you very much for replying anyway. Do you know any other 'common' solution?
  2. I'm developing a web-based networked game using HTML5 and Box2D as physics engine. The network communication is by Web Sockets.   Player A can spawn objects in the world, while Player B controlls an actor that can interact with them (jumping on them and such).   But here's the problem I've come across: How do I synchronize the spawning objects from Player A, to Player B?   I mean. Imagine if Player B is running across the screen, and Player A spawns an object that is falling to the ground. Now, due to the latency, the actor is running a bit behind on Player A's screen, and therefore, the spawning object might collide with the actor on Player A's screen. But in reality, the actor on Player B's screen have already run pass that point, and therefore, no collission.   It's a very basic game, but now I just realized I'm stuck and don't know how to solve it really.   I guess I have to do something with the server. At the moment, the server only relays the messages between the clients, no physics or so is ran at the server-side. All physics is on client-side.   Thanks in advance! :-)
  3. OK, so I've played around today and noticed something/got some problems. Speex got three "modes"; narrow-band, wide-band and ultra wide-band. Each band accept X numer of samples; 160, 320 and 640. So speex can only encode 640 samples at time at its maximum. Now as I said, I'm using pyAudio (PortAudio), and I've got some questions (in general) about sampling and encoding the audiostream: I'm using ultra wide-band for now, which allows me to grab 640 samples of my inputstream. Now this works fine as long as I just let me program idle and do its thing, but as soon as I fire something up on my computer (it could be Firefox or anything), I can hear my audiostream kind of gets interrupted by the computer. It kind of gets cut for a short time and theres some static noise. If you check the size on that buffer meanwhile, you can se it shoots into the air and sometimes even overflows and crashes :/ So I don't know if its just a bad wrapper or something? I mean, the audiostream has to be completely independet from other software on my computer, otherwise it wont work, obviously. I could run that loop in another thread tho, but hey, how shold that help for not being interrupted by other software on the computer? So... does anyone have any experience in this?
  4. Hello! I'm currently in a project where I need to write a VoIP program like Ventrilo/Teamspeak/Mumble. I'm very familiar with python and I really like it and it would be great if I could use that as my language to develop it. But the question is. Is there a good idea? To use python I mean. Second, do you know any good library for manage audio in/out and encoding? I've found THIS speex-wrapper and also found pyAudio to be a good wrapper of PortAudio, also pyMedia has got some nice features, such as mux/demuxer. But I don't know if it's a good idea, so I want to hear your tips/ideas/feedbacks! Thank you in advance!
  5. Hello folks! I'm writing a small VoIP chatprogram in python an Im stuck with some problems. First of all im using pyAudio which is a PortAudio wrapper for python (if you didn't know). I'm currently reading chunks with the size of 2048 of the stream, and I wan't to send those over the network. Then I found this speex-wrapper for python (yay). BUT. There's a problem. Speex seems only to be able to encode 320 bytes of data at time?? Therefore, if I want to use speex, I have to chunk up my data in the size of 320 bytes, and that will clog up my audio-buffer. Because i've tried to encode chunks of 2048 in size, but speex only encodes a tiny bit of it and the sound gets all wierd and so. But maybe there's just a bad wrapper? It's found over here: http://www.voicechatter.org/forum/viewtopic.php?f=10&t=563 (random hax since the original pyspeex os outdated). SO I'm looking for a way to encode my audiostream to be able to send it over the network! Thanks in advance! (:
  6. Feedback on my new VST's and sample

    Quote:Original post by Atrix256 I agree with the other poster too that it is pretty gloomy, is that somethign you were shooting for? "Mystic" is maybe the wrong word, a gloomy-feeling is actually kind of what I'm aiming for :) Quote:Original post by jjandreau text... Yes, it is gloomy. And thanks for the tip of using ethnic percussion, I find it kind of neat! I will work some more on a complete piece, it should not be gloomy completely through, it's more the intro of it. Thank you for your replies anyway :)
  7. Feedback on my new VST's and sample

    Quote:Original post by Dannthr You've got a good incidental feeling here. I think the only question I have is what is your intention behind all of your seemingly random instrumental choices. You bring in the harp, and then it goes away, you bring in a guitar, it goes away. It feels very undecided. Even with incidental music, you'll want to be able to give a reason for your choices, at least that's my opinion--art is deliberate. I know exactly what you mean by the randomness! As I pointed out, it's more of a test rather than a complete score, just some ideas of mine that I pinned down just to not forget them, sort of. That's the reason being so undecided. The problem for me is that I usually only write these small bits, then I can't think of a continuance, but I'm working on it. I will eventually post a more connective track in the future :)
  8. Yo! A friend of mine is currently working on a MMORPG and I was asked to write the score (or music w/e you wanna call it) for his game, so I sat down and played around a little. The result is this: http://www.box.net/shared/xex7jucx8x Took me like three hours in total to make. But it's mostly a test, not really a complete track, but I just wan't to hear your oppinions on it? I wanted to create a kind of "mystic" feeling, and I like to think of a cold landscape with lots of mountains and snow when this sort of music is being played (lol). As in Dun Morogh if you've ever played World Of Warcraft...
  9. Hi! I'm having some issues with threading, I'm not really sure how to implement it, take a look at this sample code: from threading import Thread class Test(Thread): def __init__(self): Thread.__init__(self) self.start() def main(self): # This is my main-function while 1: # It's in this loop my actual program runs. The "problem" is how I start the thread and execute the main() function inside the class, I don't really understand how I should do it to make it work. You see this class is only one piece of my program, I want this main() function to be run in a separate thread. Thank you in advance! :) [Use source tags to format code. -Zahlman]
  10. Yo! I'm having some issues with my players movement over the network. The interpolation is kind of jittery, it's not a very smooth motion. I'm using THIS method (by hplusplus, thank you) to interpolate the positions from the server. But I might be using it wrong? The link seems broken, but I can quote it here: Quote:Assuming the data comes in at a regular interval, then you make it so that you plot the position at time (Tcur - (t2-t1)), where Tcur is == t2 when you receive P2, and moves ahead at real-time pace. Let's call the update interval (t2-t1, also t1-t0 etc) the Tu. The position of the object at time T is then P1 + (P2-P1) * (Tcur - t2) / Tu. I've tried to take a average Tu but it still is a bit of jittery movement. Do you have any suggestions of making it 'better' to compensate for the random jitter and latencys on the network? Thank you in advance! :) [Edited by - pjuke on January 12, 2010 2:37:26 AM]
  11. Quote:Original post by Antheus text... Ah OK! Well, yes, I'm using TCP. And the client actually stalls as you mention, I've noticed it, and it only occurs when it receives shots from the server. But I will take a closer look at my code and try to find where it stalls.
  12. Hi! I've been writing a lot of network-code lately and discovered a few ways of doing it, interpolation / extrapolation etc. etc. And so far, I've solved it by letting the client send a position update 20 times a second to the server, the server then interpolates these position updates, and broadcasts them to the other clients, which interpolates these positions as well. This way works pretty good, but I'm having problems. You see, each player can shoot at each other, and I need to send a message with the shot position as well, 20 times a second. This results in 40 messages / second to the server, well it's doable, but I don't know of I've done it wrong, but my clients tends to freeze and crash when it has do first send 40 messages a second, and receive (and handle) 40 messages a second. The handleing works fine, I think it's the sending that causes problems. So therefore (now to the topic), I'm looking for another way of doing it. And I've searched around the 'net and found out that the client should send Events to the server instead. Like "Starts to move", "Im turning 15 degrees to the left", "I just stopped moving", "I fire a shot" etc. etc. Then it wouldn't be that much to send right? So the server would receive these events, and update it's view of the world, and then as usual send messages 20 times / second to the clients, so the can interpolate this information from the server. I believe this is a good way of doing it, please correct me if I'm wrong, because I need a functionable code (it's for a schoolproject) as soon as possible. And one last thing. If it s the "correct" way of doing it, I believe the client should start to extrapolate when it sends the event, otherwise it has to wait for reply from the server before it starts to move. How should I then correct my position to the one the server is giving me? Maybe change the speed I'm moving over time or something? Give me your opinions! Thanks! :)
  13. Quote:Original post by Kylotan Time to fire up Wireshark. Look at exactly when those messages hit the network on the sending side and arrive at the receiving side. That will help you narrow down where the problem is. Your abbreviated results are not very helpful. Somewhere between 1.05 and 5.00 the times started drifting - where, and by how much? Did they slowly diverge? Or did there abruptly come a point where the messages took an extra 3 seconds? And why is your client claiming to receive messages earlier than they were sent? That is not possible so you must be leaving out some information. Probably the best thing is to have the client log its current time as well as the timestamp in the message side-by-side so we can compare the two. Also, tell us exactly what your testing setup is. One machine? Two machines? Internet? LAN? Is wireless involved? And when do you put these timestamps in there? When you create the message? Or when it is actually sent? Make sure it's the latter. (PS. Stop calling them 'packets' if you're using TCP.) Ok! Let's begin then. First of all, I'm not very familiar with Wireshark but one thing that I noticed is that my TCP stream are not shown. I'm sending data 20 times a second but nothing is showing up. Well there is something, but that is mostly HTTP requests when I visit a website or something. Nothing on my local PC. At the moment, I'm running the server and client on the same machine. It's connected by cable, no wireless. I have also tried with my laptop and my PC, both with wireless and cable on the laptop. Same issue, and nothing in Wireshark. I will give you a better analysis as soon as I get Wireshark to work. And the timestamp is set almost excactly before the sending. You see, my message-handler works by using instances of a Message-class, where I have a variable that holds the time. I'm setting the timestamp exactly before serialization (using pickle) and sending it. So my question for now, before I can give you some more detailed information, is how I get Wireshark to capture my messages? Thank you for helping, I really appreciate it! :)
  14. Ok guys so I'm back! I completely re-wrote my network-code. But the problem still exists!!! (argh). Let me tell you how it works: Server Each cycle in my loop, I call a function called tick() which selects on all sockets connected, to see if we got something from the client. It uses a global incomming buffer (one buffer for all clients that is) to put the messages in. Then a just do like this: for message in get_messages():. get_messages() returns the buffer with messages. My message-handler is this loop. Client Same as the server. For some reason, the packages are sort of delayed. On each packet, I put a timestamp from the server's clock. The time between packages are 50 milliseconds btw. And the results are something like this: Server Client 1.00 Got message at 1.00 1.05 Got message at 1.05 .... .... (skipping some time) .... .... (skipping some time) .... .... (skipping some time) 5.00 Got message at 2.05 5.05 Got message at 2.10 5.10 Got message at 2.15 .... .... .... .... 12.00 Got message at 4.55 12.05 Got message at 4.6 12.10 Got message at 4.65 The client is receiveing "old" packages. But my incomming buffer on the client is always 1 or 0, so it doesn't get stuck in there, it is on the sending side I believe, but I don't know... And one more thing! If I suddenly stop the sending from the server, the receiving will stop on the client as well. So there must be some kind of "buffer" between the client and server that secretly holds the packages and sends them when the buffer is big enough, or I don't know? So therefore I'm begging you for help! Thanks in advance! EDIT I found a solution of the problem, but I don't know if it's really it... The thing is that I'm sending one position-packge per client, to each and every client. By other words, a client will be receiving a package containing its own position. And for some reason, if I disable that, and just sending packages containing others positions, it works! Why is this? This can't be the problem really, I mean, why can't a client receive info about it self? EDIT2 Forget tha last edit, lol. I tried a few more clients and the problem was there again, so it is the same problem as before... [Edited by - pjuke on December 14, 2009 1:41:15 PM]
  15. Quote:Original post by hplus0603 If you're saying the client and server are setting TCP_NODELAY, are those functions properly passing the address and length of the "one" parameter? Seriously, I don't know. I looked around at the internet but didn't find any reference on TCP_DELAY on python sockets. I only found some example code somewhere and copy pasted it. If you got the time, please check out the code snipped I provided before, because I might be setting it the wrong way. Quote:Original post by Kylotan Great answer Ok thank you! I'm re-writing it all at the moment, lets see what happens!