Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Need some help with game movement programming theory


java
 Share

Recommended Posts

Hey guys

Basically i'm having some real issues making a perfect system for movement. I can do all the coding fine, i'm just having problems with the logic/theory…

Basically this is how i want it to work:
-User presses buttons, moves the character on screen and sends packets to the server

How will i coordinate the movement?
Will there be a timer when the user presses the button detecting how long and then send packets accordingly? If so then how will other clients move the character which moved?

I can't remember how i did it in vb couple years ago..

thanks guys
Link to comment
Share on other sites

You could simple have the person move 1 pixel and have it wait a set amount of time before moving another. Or just cap your FPS and let it be based on the loop time, though speed hacks would have a fun time.

The packet of your movement (not every pixel, also use UDP if you can) will get sent to the other players and then make there sprites move based on that.
Link to comment
Share on other sites

so..
```
while(keydown) {
timer.start;
}
```
timer tick:
```
move;
send(moved);
```

something like that? and i have packet flood protection on the server which will be set up differently for each type of packet received to detect speedhacks and the like :)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...