ID:155429
 
I know that byond is tile-based and I've read some codes that are for Pixel movement such as Fourm account's library. But I want to make my own pixel movement.

I was wondering how should I approach on making pixel movement for my game.

What should I variables should I add?

How do I avoid pixel-by-pixel collisions?

How do I make it so I do have colissions.

I'm confused on how I should start this pixel movement
Honestly I'd just use Forum_account's library as it comes with basically everything you'd need for pixel movement, is updated often, and is highly optimized.
There are really two parts to pixel movement:

1. How the actual movement is handled.
2. How you use it.

The first part is the stuff like collision detection. The second part is how the player moves. The library covers the first part and has some examples for the second part, but it's really up to you. You can customize how it works to make players that move in the direction you press, or make the players drive around like cars (up arrow = move forward, left/right arrow = turn). Even when using a control scheme that's provided to you, there are a lot of movement-related effects you can create (ex: conveyor belts).

The library doesn't do everything for you, it just lets you skip some of the ugly details so you can get right to making the gameplay.
In response to Forum_account
How many players or mobs would you think it would take to lag the server in your library? Im thinking about adding pixel movement to my game also
In response to Kagun
Even demo has huge CPU usage, there won't be many players before it starts lagging.
In response to Kagun
That depends on how you use the mobs. If there are tons of mobs active all the time it would likely lag, but if you limit active mobs to the ones in view of a player or that NEED to be active, it isn't a big deal.
In response to Kagun
Kagun wrote:
How many players or mobs would you think it would take to lag the server in your library? Im thinking about adding pixel movement to my game also

In a recent blog entry I posted these numbers:

fps     mobs    CPU
40      25      12%
40      50      24%
40      75      36%
40      100     48%

30      25      9%
30      50      18%
30      75      27%
30      100     36%


Edit: Those numbers were generated based on estimated running times of each proc. Here are actual numbers generated from running the demo on a 2.01 GHz processor:

fps     mobs    CPU
40      25      7%
40      50      15%
40      75      24%
40      100     35%

30      25      4.5%
30      50      12%
30      75      16%
30      100     22%


That was with all mobs moving. If your game has a lot of stationary mobs it'll be lower. Also, the library comes with an example of how to deactivate mobs when they're not on the screen, so you don't waste CPU time on mobs that nobody can see.