Pixel Movement

by Forum_account
Pixel Movement
A pixel movement library for isometric and top-down maps.
I just posted an update to my Pixel Movement library. The major changes include:

Control Customization

This comes in two forms:

1. Control scheme demos: three demos were added that show how to create different control schemes.

2. Key binding customization: mobs now have a controls var which defines the key bindings used by the library's default behavior. mob.controls.up is the key that makes the mob move up. By default its value is "north", but you can change it to whatever you want.

Performance Demo

With this library its easy to overload your CPU. Not only is movement more complex, but it's running four times faster than most BYOND games. This demo includes some examples of simple things you can do to reduce the game's CPU usage.

Debugging Tools

This update adds the mob.start_trace() and mob.stop_trace() procs. Calling mob.start_trace() starts the movement logger. This makes all calls to movement related procs (movement, pixel_move, set_pos, etc.) be logged. When you call stop_trace() the log is displayed. Sometimes things happen too quickly for you to be able to see what the problem is just by watching.

Here's the full list of changes:
  • Added control scheme demos (in the control-scheme\ folder):
  • The control-scheme\vehicle\ demo shows how to create a movement system where the left and right arrow keys make the mob turn, and the up/down keys make the mob move forwards or backwards.
  • The control-scheme\zelda\ demo shows how to create Zelda-like movement. The player can move in four directions and adjusts to be aligned with half-tile boundaries. This makes it easier for the player, who is a full 32x32 rectangle, line up and fit through one-tile wide passages.
  • The control-scheme\wasd\ demo shows how to use the new mob.controls var to make mobs that move using the WASD keys instead of the arrow keys.
  • Added the mob.check_loc() proc. It's nothing new, it contains code that used to be part of the mob's default movement proc. check_loc checks for situations where a mob's loc var was changed directly and updates the mob's pixel coordinates when this happens. check_loc() is called by the global movement loop, so you don't lose this behavior even if you override the mob's movement proc.
  • Added documentation in _reference.dm for check_loc(), world.movement(), start_trace(), stop_trace(), and mob.controls.
  • Fixed a problem with macro initialization - macros wouldn't work when you had a .dmf file with multiple windows.
  • Added mob-debugging.dm which contains the Stat proc (that used to be in world.dm) and contains a new debugging feature.
  • Added the mob.start_trace and mob.stop_trace procs. When start_trace() is called, all of the mob's movement related actions (calls to movement, move, bump, pixel_move, set_pos, etc.) will be kept in a log. When stop_trace() is called the log will be displayed in the browser.
  • Added the mob.controls var, which is an object that has five vars of its own: left, right, up, down, and jump. By default their values are (in the order I mentioned them): west, east, north, south, and space. You can change these values to change what keys are used for the default movement behavior.
  • Added a reference page called "Pixel Movement Debugging" which explains the debugging features that the library offers and how/when to use them.
  • Added a demo called performance-demo, which shows some simple optimizations that can drastically reduce your game's CPU usage. Run the demo with and without including optimizations.dm to see how much of a difference the optimizations make.
I have a suggestion about the debugging. I haven't checked how the debugging works yet in the update, but to allow people to use it within their project with any ease, it needs to be a pop up window so they don't have to add a stat panel into their interface just to see it. Just a thought =D.
An outstanding library gets even better.
"The control-scheme\wasd\ demo shows how to use the new mob.controls var to make mobs that move using the WASD keys instead of the arrow keys."


WASD > Arrow Keys
Ah, if only you allowed me to page you, Forum_account. I'm working on a game using your engine, and I see you online right now, but I can't send you an invitation to play the game. Drats! I'll host Miner's Adventure to catch your attention!