Forum Games Our interpolation

Discussion relating to game development with Flash

Our interpolation

Postby FulaFisken » March 18th, 2011, 5:37 pm

We have a bugs that needs fixing but otherwise it is working quite good. You steer with, UP, LEFT, RIGHT and shoot with SPACE. The game is using a client/server model and the server is authourative with its own game loop and physics.

OBS! Shooting might cause unexpected behaviour in this version, so beware :D (ie. the game bugs out completely)
OBS! Tabbing out from the game also creates some funky bugs.

http://rymdenrunt.appspot.com/swf/rymden2.html


course == current ship state
target == ship state retrieved from server

New interpolation code: (this is not done on your own ship)
Code: Select all
public function interpolate():void {
   //update target to current time
   while (target.tick < course.tick) {
      updateHeading(target);
   }
   
   //Calculate position diff   
   var diff:Point = new Point(target.x - course.x, target.y - course.y);
   var distance:Number = Math.sqrt(Math.pow(diff.x, 2) + Math.pow(diff.y, 2));
   
   //warp ship if diff is to large   
   if (distance > BLIP_OFFSET) {   
      blip();
      return;
   }
   
   //smooth step course speed to target speed
   var velStep:Number = 0.5;
   course.speed.x = target.speed.x + velStep * diff.x;
   course.speed.y = target.speed.y + velStep * diff.y;
         
   //smooth step course angle to target angle
   var angleDiff:Number = NumberUtil.angleDifference(target.angle, course.angle);      
   course.angle += angleDiff*0.8;
   course.angle = NumberUtil.clampRadians(course.angle);
}
Fula Fisken
website blog twitter
Play Game
Astroflux
User avatar
FulaFisken
Paid Member
 
Posts: 139
Joined: March 2nd, 2011, 10:15 am

Re: Our interpolation

Postby Benjaminsen » March 18th, 2011, 8:36 pm

Looks great although I find it a tad strange that my own ship would be jumpy.

Can you outline a bit more how your server / client integration works?

/Chris
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Our interpolation

Postby FulaFisken » March 19th, 2011, 12:17 am

I think I forgot to tell you that we do a correction on your own ship if it is different from the server position, hence your own ship might jump a tad. We have not quite worked out if we should just let the client steer his own ship and only adjust it if the error is greater than a certain treshhold or if it should be interpolated just like the other ships.

If we go for interpolation I think we need to keep the rotation completely client driven since interpolation of that would create a wobble effect at the end of each rotation phase.

Honestly, we are not completely sure what we are doing since this is our first ever multiplayer game. But we are getting there ;)

Edit: I would love to post something more detailed once we have everything working as intended and not so messy.
Fula Fisken
website blog twitter
Play Game
Astroflux
User avatar
FulaFisken
Paid Member
 
Posts: 139
Joined: March 2nd, 2011, 10:15 am

Re: Our interpolation

Postby Oliver » March 21st, 2011, 5:36 am

Hey,

Cool.. i love the amount of smoke coming out of the engines after just a quick press. That ship must have some really big engines!

Honestly, we are not completely sure what we are doing since this is our first ever multiplayer game. But we are getting there


I'd just like to point out one thing which might be counterintuitive, but that i've heard over, and over again: Cheat.

All multiplayer games cheat as much as they can get away with. Your #1 priority is to create a game with fun gameplay, and your second (or lower) priority should be that the game is secure. It doesn't matter if your game is the most secure in the world, with the complete simulation running serverside if the game is not fun to play.

A model that i've often seen employed is that the server mostly just sanity checks the input from the client in order to catch outright cheating, stuff like "the client says it's moved here to x,y... is that reasonable given his/her last position".

When in doubt, err pro-gameplay.

There is nothing wrong with cheating -- everybody does it for a reason: it gives the best games!

Best,
Oliver
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am

Re: Our interpolation

Postby FulaFisken » March 21st, 2011, 10:43 am

Oliver wrote:Hey,

Cool.. i love the amount of smoke coming out of the engines after just a quick press. That ship must have some really big engines!

Honestly, we are not completely sure what we are doing since this is our first ever multiplayer game. But we are getting there


I'd just like to point out one thing which might be counterintuitive, but that i've heard over, and over again: Cheat.

All multiplayer games cheat as much as they can get away with. Your #1 priority is to create a game with fun gameplay, and your second (or lower) priority should be that the game is secure. It doesn't matter if your game is the most secure in the world, with the complete simulation running serverside if the game is not fun to play.

A model that i've often seen employed is that the server mostly just sanity checks the input from the client in order to catch outright cheating, stuff like "the client says it's moved here to x,y... is that reasonable given his/her last position".

When in doubt, err pro-gameplay.

There is nothing wrong with cheating -- everybody does it for a reason: it gives the best games!

Best,
Oliver


Thanks. We are aware what you are saying about cheating. However, we are also doing this to improve our technical knowledge about multiplayer games so we don't mind getting stuck for a while as long as we are having fun. Another thing is that we intend to create a lot of NPC units in the game and it would be nice if a server and not the client is enforcing their position.
Fula Fisken
website blog twitter
Play Game
Astroflux
User avatar
FulaFisken
Paid Member
 
Posts: 139
Joined: March 2nd, 2011, 10:15 am

Re: Our interpolation

Postby FulaFisken » March 22nd, 2011, 9:52 pm

We did a pretty significant update today and the movement of your own ship is really sweet now. However, a player that is killed can still bug out. Tabbing out or minimizing the browser while playing can also screw something up, don't really know why yet.

http://rymdenrunt.appspot.com/swf/rymden2.html
Fula Fisken
website blog twitter
Play Game
Astroflux
User avatar
FulaFisken
Paid Member
 
Posts: 139
Joined: March 2nd, 2011, 10:15 am

Re: Our interpolation

Postby HAnz » March 22nd, 2011, 11:36 pm

Looking good.
There is a bug though, it's that you can't press left and up and shoot but you can press right and up and shoot.
Also you might want to put the engine flame under the ship so it won't look like the ship is on fire when you turn around, and maybe shoot the bullets from under the ship, it would probably look better that way.
I make games and stuff.
User avatar
HAnz
 
Posts: 46
Joined: August 7th, 2010, 2:59 pm

Re: Our interpolation

Postby FulaFisken » March 23rd, 2011, 12:38 am

HAnz wrote:Looking good.
There is a bug though, it's that you can't press left and up and shoot but you can press right and up and shoot.
Also you might want to put the engine flame under the ship so it won't look like the ship is on fire when you turn around, and maybe shoot the bullets from under the ship, it would probably look better that way.


Yeah, I heard about that key press issue from another tester but we don't know why it happens yet. It doesn't happen on any of our machines and only 2 (you included) have reported it so far. What computer do you use? Could it be that your keyboard doesn't allow certain key combinations? Does it "beep", as in a bios sound effect?
Fula Fisken
website blog twitter
Play Game
Astroflux
User avatar
FulaFisken
Paid Member
 
Posts: 139
Joined: March 2nd, 2011, 10:15 am

Re: Our interpolation

Postby Benjaminsen » March 23rd, 2011, 9:08 am

HAnz wrote:Looking good.
There is a bug though, it's that you can't press left and up and shoot but you can press right and up and shoot.
Also you might want to put the engine flame under the ship so it won't look like the ship is on fire when you turn around, and maybe shoot the bullets from under the ship, it would probably look better that way.


Sadly this is due to your computer not sending keystrokes to flash after n amount of buttons are pressed.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Our interpolation

Postby Benjaminsen » March 23rd, 2011, 9:12 am

Just played with a few people from all over the world. The game still seem a bit laggy.

I also got the below error after an intense battle.
Image

It's still very cool though!
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: Our interpolation

Postby FulaFisken » March 23rd, 2011, 10:46 am

Benjaminsen wrote:Just played with a few people from all over the world. The game still seem a bit laggy.


Was the ship movement choppy due to bad interpolation or was that game laggy because of the graphics and performance issues? We feel the movement is good enough to let us work on the game for a while but we might have another go at it later on.
Fula Fisken
website blog twitter
Play Game
Astroflux
User avatar
FulaFisken
Paid Member
 
Posts: 139
Joined: March 2nd, 2011, 10:15 am


Return to Games