Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 04 Aug 2002
Offline Last Active Nov 18 2012 04:11 PM

Topics I've Started

Dealing with websocket message overload on client

18 August 2012 - 03:21 AM

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!

Max Payne 3 - Plays best on PC or PS3?

14 April 2012 - 12:21 PM

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?

Seeding a pseudo-randomly generated game map

24 October 2011 - 11:03 AM

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?

Using Square Root to calculate Area

16 August 2010 - 12:41 AM

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?

pseudo-random game content - Where to start

10 January 2010 - 01:18 AM

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?