Deprecated: Creation of dynamic property wpdb::$categories is deprecated in /home/atzok/atzok.com/wp-includes/wp-db.php on line 760

Deprecated: Creation of dynamic property wpdb::$post2cat is deprecated in /home/atzok/atzok.com/wp-includes/wp-db.php on line 760

Deprecated: Creation of dynamic property wpdb::$link2cat is deprecated in /home/atzok/atzok.com/wp-includes/wp-db.php on line 760

Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /home/atzok/atzok.com/wp-includes/comment-template.php on line 1745

Deprecated: Creation of dynamic property Yoast\WP\SEO\Main::$helpers is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/lib/abstract-main.php on line 65

Deprecated: Creation of dynamic property WP_Block_Type::$skip_inner_blocks is deprecated in /home/atzok/atzok.com/wp-includes/class-wp-block-type.php on line 357

Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/conditionals/third-party/elementor-edit-conditional.php on line 22

Deprecated: Constant FILTER_SANITIZE_STRING is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/conditionals/third-party/elementor-edit-conditional.php on line 28

Deprecated: Creation of dynamic property WP_Term::$object_id is deprecated in /home/atzok/atzok.com/wp-includes/class-wp-term.php on line 198

Deprecated: Creation of dynamic property WP_Term::$object_id is deprecated in /home/atzok/atzok.com/wp-includes/class-wp-term.php on line 198

Warning: Cannot modify header information - headers already sent by (output started at /home/atzok/atzok.com/wp-includes/wp-db.php:760) in /home/atzok/atzok.com/wp-includes/feed-rss2.php on line 8
<br /> <b>Deprecated</b>: Creation of dynamic property Yoast\WP\SEO\Surfaces\Classes_Surface::$container is deprecated in <b>/home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/surfaces/classes-surface.php</b> on line <b>20</b><br /> <br /> <b>Deprecated</b>: Creation of dynamic property Yoast\WP\SEO\Main::$classes is deprecated in <b>/home/atzok/atzok.com/wp-content/plugins/wordpress-seo/lib/abstract-main.php</b> on line <b>65</b><br /> <br /> <b>Deprecated</b>: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$page_type is deprecated in <b>/home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php</b> on line <b>43</b><br /> <br /> <b>Deprecated</b>: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Term_Archive_Presentation::$pagination is deprecated in <b>/home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/archive-adjacent-trait.php</b> on line <b>29</b><br /> <br /> <b>Deprecated</b>: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Term_Archive_Presentation::$source is deprecated in <b>/home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php</b> on line <b>64</b><br /> <br /> <b>Deprecated</b>: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Term_Archive_Presentation::$title is deprecated in <b>/home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php</b> on line <b>64</b><br /> Enterprise Archives - ATZ OK https://www.atzok.com NO CARRIER Thu, 14 Apr 2016 22:21:08 +0000 en-US hourly 1 https://wordpress.org/?v=5.9.9 Layered Board Structure for 2D Games https://www.atzok.com/2009/07/07/layered-board-structure-for-2d-games/?utm_source=rss&utm_medium=rss&utm_campaign=layered-board-structure-for-2d-games Tue, 07 Jul 2009 14:58:39 +0000 I’ve found that in more complex 2D games, I end up maintaining several “boards” containing 2D arrays of objects. Generally I have a base board to hold the floor, a terrain board for walls and other structural objects, a feature or object board for smaller items, and an actor board. The feature and actor boards…

The post Layered Board Structure for 2D Games appeared first on ATZ OK.

]]>
I’ve found that in more complex 2D games, I end up maintaining several “boards” containing 2D arrays of objects. Generally I have a base board to hold the floor, a terrain board for walls and other structural objects, a feature or object board for smaller items, and an actor board. The feature and actor boards are generally kept in parallel with flat feature and actors arrays, as a convenience to either access them with an iteration or by board position.

This can make pathfinding and drawing to the screen become cumbersome, so I’ve begun implementing a Layer class to help. The layer holds a basic board, a link to its parent (if any), and an array of children. Children may be added with different scale from the parent board, so for instance a 25×25 terrain grid may actually be broken down into a 100×100 grid to contain the actor positions.

One advantage of this breakdown is that multi-pass pathfinding can be seamlessly integrated. This means I can run my initial pathfinding algorithm against the topmost layer to get a basic path, then drill down to find the detail. Since the basic path will usually be representative of the final travel, this means the bulk of the work will be done against the smaller grid.

To allow for data stored at this level, the layers will additionally need to be composed of a MapNode class, to support additional functionality beyond simply holding a variable. These nodes need to be aware of which neighboring nodes they have an accessible edge to, because even if they are both empty a child layer’s node may block the path between them. By caching this data in the topmost layer, we prevent too much backtracking when sharpening our route.

Another advantage is that the base MapLayer may itself be treated as a MapNode, and vise-versa. This means that the world can be fractally expanded to organically grow the map as needed. Simply add the current topmost layer to a newly created layer which contains the rest of the world, and procedurally generate its contents at that time.

The post Layered Board Structure for 2D Games appeared first on ATZ OK.

]]>