Jump to content
  • Advertisement

Paulus_newbieus

Member
  • Content Count

    63
  • Joined

  • Last visited

Community Reputation

131 Neutral

About Paulus_newbieus

  • Rank
    Member
  1. Paulus_newbieus

    Dealing with websocket message overload on client

    Thanks for the help guys. You were correct - by turning off the Nagle algorithm, my jitter completely vanished! For interest of other readers, in .Net this is possible by toggling the NoDelay property to true (by default its false) on the System.Net.Sockets.Socket class. I believe this change will soon be integrated into the Fleck library by the project developer. Cheers
  2. Paulus_newbieus

    Dealing with websocket message overload on client

    OK, interesting. I cant see any obvious way to disable Nagle (never heard of it) or how to turn off delayed-ACK. I don't suppose you guys could point me to a good source of on-line explanation for these things? I do broadcast a single message to all my client connections once every 25 milliseconds, and I do actually already attach a time stamp to the message - I use this to work out the rate to animate (linear interpolation). So even though I have the time stamp, It's not yet clear to me how I can use this to re-arrange my packets. At the moment, positions are just drawn straight away. Should I be buffering the updates, re-arrange them depending on time stamps, and then draw them? This feels like yet more lag time. Appreciate the help guys!
  3. Paulus_newbieus

    Dealing with websocket message overload on client

    Aaah! Of course, why not, this sounds extremely likely. I must admit I was expecting them to arrive in the correct order. Running this simulation locally (debugging on my PC) with server local) I do not get this issue, so I did not consider the ordering to be different. I am using Fleck: https://github.com/statianzo/Fleck I am just using it in its default set-up - I have not done any tweaking or tuning whatsoever, just running it out the box.
  4. I have a web-socket server sending object positions to all clients at a fixed rate (say 40 Hz). Client side (HTML5 browsers) I receive these messages and draw the object (canvas) at that new position. My problem is that sometimes, if there is not a great deal of other JavaScript processing activity on the client, the objects seem to skip a bunch of updates and get transported over a large range. So instead of a nice smooth animation, I get stuttery movements. I have some code to handle lagging updates using linear interpolation - but this problem is different, this is not where the updates are coming in too slow, its where they are coming in too fast! How the heck do I solve this without resorting to decreasing the server update rate, which I really don't want to have to do?! Any suggestions greatly appreciated!
  5. Paulus_newbieus

    Max Payne 3 - Plays best on PC or PS3?

    So I loved all the previous Max Payne games and am really looking forward to the new one. I have started playing games on my console more and more, although I come from a heavy PC gaming background. My problem is that I cant decide whether to buy the game for PC (better graphics?) or my PS3 (couch comfort?)! What do you guys think?
  6. Paulus_newbieus

    Seeding a pseudo-randomly generated game map

    Thanks, much appreciated guys.
  7. Paulus_newbieus

    Seeding a pseudo-randomly generated game map

    So short is the x coord and short2 is the y. You are bit shifting the x by 16 and adding it to the y, to make it a unique single value? This is so the point {1;2} will not result in the same seed as {2;1}, am I right? And alvaro, you are doing something similar. [/quote] I am doing something similar, but my code works. What Waterlimon posted has several issues. He probably meant to say `(short1 << 16) + short2' or `(short1 << 16) | short2'. With '&' you'll get 0. And you can't use `short' as a variable name. [/quote] Thanks for clarification and taking the time to help me out alvaro! I actually come from a VB .Net programming background (*hangs head in shame*) so could you please clarify with the symbols what's going on with the bit shift and addition i.e. should it be adding the results? Also, alvaro what's the [color="#006666"][font="CourierNew, monospace"]10366439865051156459ul [/font]signify, and how would that be better than a bit shift? Many thanks!
  8. Paulus_newbieus

    Seeding a pseudo-randomly generated game map

    Thanks for suggestions guys. So short is the x coord and short2 is the y. You are bit shifting the x by 16 and adding it to the y, to make it a unique single value? This is so the point {1;2} will not result in the same seed as {2;1}, am I right? And alvaro, you are doing something similar.
  9. Hi, I am looking to build a pseudo-randomly generated game level/map. A map is divided into blocks of areas, and using a seed I want to be able to regenerate the same content of any of these areas anywhere in my game map. So if I teleport to a far-off area, it will look the same as the next time I visit the same area after restarting the game. I know lots of games already use this mechanic, but my issue is with the fact that to seed a pseudo-random number generator you typically supply a single value such as an unsigned integer. What I have instead is an x,y grid coordinate, not a single value, because that is the only way I can think of how I would identify a map area, especially if the map is potentially infinite in size. For example, the first area may be 1,1. To the right is 2,1, and below is 1,2 etc. So I guess what I am asking is how can I use a coordinate as a seed?
  10. Paulus_newbieus

    Using Square Root to calculate Area

    Thanks for the feedback all, much appreciated! Quote: Someone already asked this, but I'll do it again: Why do you think you need the square root? Can you show us an example? I thought that I needed the square root because I was testing with non-Axis-Aligned rectangles. I have just tried with your simple example figures and I get the same result. Basically I became very confused because I am working in a "zoomed in" scale, and applying the square root seemed to give correct figures but I was in fact just plain wrong. Because I can not guarantee my rectangle will always be AA, I think this is really what I should be using: http://www.wikihow.com/Calculate-the-Area-of-a-Polygon
  11. Paulus_newbieus

    Using Square Root to calculate Area

    Quote:Original post by Magpie OK the Area of a 4 sided figure, Square or Rectangle is Width * height. If you are using coordinates you need to calculate the distance of the width and the height. IE: Width will be W = Sqrt((X2-X1)^2 + (Y2-Y1)^2) Height will be H = Sqrt((X3-X1)^2 + (Y3-Y1)^2) So area is W * H Ahaha - Yes I am using a 2D coord system. This must be why I need the square root in there, because it needs to be the distance otherwise it doesn't make sense when I convert it to real world measurements. I can expand my actual function - this is what it is doing: Area = Math.Sqrt((m_MaxPoint.X - m_MinPoint.X) * (m_MaxPoint.Y - m_MinPoint.Y)) Does that sit with what you have said Magpie?
  12. Paulus_newbieus

    Using Square Root to calculate Area

    Hmm ... does it have something to do with my coordinates? Perhaps related, why would I also need to square root the result of a distance calculation? Public Function Distance(ByVal Point1 As PointF, ByVal Point2 As PointF) As Single Dim dx As Single = Point1.X - Point2.X Dim dy As Single = Point1.Y - Point2.Y Return Math.Sqrt(dx * dx + dy * dy) End Function
  13. Paulus_newbieus

    Using Square Root to calculate Area

    To calculate the area of a 2D square or rectangle, you multiply the width by height. However, unless I then get the square root of this value the result is wrong! Public Overrides Function GetArea() As Single Return Math.Sqrt(ShapeWidth * ShapeHeight) End Function Why do I need to apply the square root?
  14. Paulus_newbieus

    pseudo-random game content - Where to start

    Yes but is it possible to know the sector seeds of a sector 287634 million miles away, just by say passing in a 3D point position parameter, instead of actually generating the entire galaxy up front?
  15. I've been thinking about how you generate content for things like a game, but from a pseudo-random seed. The pseudo-random is important, because I want to be able to re-create the exact same thing if I know my seed value. Generally I know that if you seed a languages randomizer with a certain number, you will get the same sequence of values from the formula. This is of course really useful to store the definition of a game map and its contents just by knowing the seed. So with the seed alone I will be able to generate exactly the same game map on many different machines, without each machine actually having to know the definition of the map up-front. It just takes the seed, then loops through some method calls and constructs the map. I think games use a similar method already, in fact do I think Elite used something similar to generate all its planets? Anyway, the key here when using the random class and the seed is that we have to loop through some procedure. As we go through the loop, we are slowly building up the same content. Now, my question is, is it possible to look ahead into the future to determine what the random number output will be? Think about flying through space in Elite. Lets pretend the game has not yet ran through its routines to generate the entire galaxy, but you go into warp and appear somewhere far away. I come out of warp and appear next to a planet full of amazonians. Now, say I exited the game, reloaded the same map and went into warp at the same place. Would I still appear at the Amazonian planet? Is this possible to tell without knowing the content of the entire galaxy upfront, or is there some procedure that could hop us ahead to that point in space without having to iterate through a loop a bazillion times? I’ve started looking at Fractals and even Perlin noise – am I on the right path? Could you guys direct me to some good reading material please?
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!