BigAtom

by Shadowdarke
Easy and flexible multi-tile atoms
ID:91652
 
BigAtom is designed to allow developers to easily work with atoms that are larger than a single 32x32 tile.

BigAtom is simple enough to drop it into an existing game with just a few basic changes to your source code, but flexible enough that power users can fine tune it for a variety of optimizations and advanced special effects.

BigAtom Articles:
"Go BIG in Existing Games" - Walks the reader through switching a bare bones game over to use Big Atoms.
"BigAtom - Keep It Simple, Shadowdarke" - Explains how to use BigAtom in 4 very easy steps.
"BigAtom Overlay Mode" - Explains how to use Overlay Mode to keep object counts low in your games.



Version 5 6/12/2010
BigAtom did not properly pass Bump() messages. Now the part that bumps into an obstacle will Bump() said obstacle correctly.

Added the bigatom_BumpCheck(turf/T) movable atom proc. This will search through T to see which atom is responsible for blocking movement (based on density) and call Bump() with that blockage as the argument. You can override this proc for custom Bump() systems.

Version 4 3/10/2009
Basic overlays feature implimented through the bigatom_Overlay() proc. The format is:

bigatom_Overlay(overlay, options)

The overlay argument may be any value you could normally add to the overlays list
(http://www.byond.com/docs/ref/info.html#/atom/var/overlays).

The options argument will be used for advanced options. The only currently implimented option is
BIGATOM_UNDERLAYS, which causes the proc to use the underlays list rather than the overlays list.

Version 3 10/30/2007
New Features:
  • Overlay mode BigAtoms no longer depend on the parts list for generating the overlays, so removing parts from the list no longer messes up the display.
  • Several new bigatom_mode flags simplify the display creation process so that undesirable parts are never created, saving resources and improving overall performance. There is a tradeoff though, as collision and targetting detection may not be completely accurate. These flags only work in overlay mode.
    • BIGATOM_PARTS_NONE - No subparts are created. (A single tile atom with a larger icon attached, but no targetting or collision benefits.)
    • BIGATOM_PARTS_CORNERS - Only the corners are created. (At most 5 atoms per BigAtom, very limitted targetting and collision detection)
    • BIGATOM_PARTS_NORTH - Parts at the north edge are created
    • BIGATOM_PARTS_SOUTH - Parts at the south edge are created
    • BIGATOM_PARTS_EAST - Parts at the east edge are created
    • BIGATOM_PARTS_WEST - Parts at the west edge are created
    • BIGATOM_PARTS_EDGES - Parts are created around all the edges. (Only saves atoms if the BigAtom is larger than 3x3 tiles. Provides pretty accurate targetting and collision detection, but you have to be careful that it doesn't get a smaller atom stuck inside the edges.)
  • bigatom_Cull() no longer automatically sets the bigatom_mode BIGATOM_REGENERATEPARTS flag, since it is only practical for overlay mode and overlay mode no longer needs a complete parts list to generate the display.


Version 2 10/22/2007
New Features:
  • New BIGATOM_REGENERATEPARTS flag in the bigatom_mode var will regenerate missing subparts when the display is recalculated in the bigatom_Icon() proc. You should always set this flag when you delete subparts from the parts list.
  • The bigatom_Cull() utility proc will automatically set the bigatom_mode BIGATOM_REGENERATEPARTS flag when any parts are deleted.

Bug Fixes:
  • The map position of the bigatom_src is no longer changed within bigatom_Icon(), unless the BigAtom was placed in the Dream Maker map editor and has not been processed by bigatom_Icon() yet.
  • The base icon_state will be preserved when a BigAtom changes to a single tile atom.


Version 1 09/04/2007
This is the first revamp of the BigAtom library since I actually had a version of BYOND 4 to
play with, so several fundamentals have changed slightly.
  • Added bigatom_get_dist().
  • Added bigatom_ValidTarget().
  • New parts take on the current name and invisibility of their bigatom_src.
  • bigatom_src is now correctly centered when there are an odd number of tiles on an axis. If are an even number of tiles on the axis, it now leans to the left or down.
  • Made bigatom_flick() a global proc and changed capitalization for consistency with the normal flick() proc.
  • Made bigatom_mode default to BIGATOM_NOOVERLAYS for ease of use for beginning developers. If you want to use overlay mode BigAtoms set the atom's bigatom_mode to BIGATOM_ON.
  • Added movement procs: bigatom_step_away(), bigatom_step_rand(), bigatom_step_to(), bigatom_step_towards(), bigatom_walk(), bigatom_walk_away(), bigatom_walk_rand(), bigatom_walk_to(), and bigatom_walk_towards()


Version 0 12/19/2006
Initial unofficial release.
Thank you for creating this resource
^.^