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: 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

Deprecated: Creation of dynamic property Yoast\WP\SEO\Surfaces\Classes_Surface::$container is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/surfaces/classes-surface.php on line 20

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

Deprecated: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$page_type is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 43

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$robots is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$title is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$source is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64
Layered Board Structure for 2D Games - ATZ OK
Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$meta_description is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$canonical is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$rel_prev is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$rel_next is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$open_graph_locale is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$open_graph_type is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$open_graph_title is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$open_graph_description is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$open_graph_url is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$wordpress_site_name is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$open_graph_site_name is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$company_name is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$site_represents is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$open_graph_publisher is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$open_graph_article_publisher is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$open_graph_article_author is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$open_graph_article_published_time is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$open_graph_article_modified_time is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$open_graph_enabled is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$open_graph_image_id is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$open_graph_image is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$open_graph_images is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$twitter_card is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$twitter_card is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$twitter_title is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$twitter_description is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$twitter_image is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$twitter_creator is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$twitter_site is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$estimated_reading_time_minutes is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$canonical is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$main_schema_id is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$site_url is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$schema_article_type is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$site_name is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$site_represents_reference is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$id is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$main_image_id is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$main_image_url is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$schema_page_type is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$title is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$has_image is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Context\Meta_Tags_Context::$description is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$breadcrumbs is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64

Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/generators/schema-generator.php on line 185

Deprecated: Creation of dynamic property Yoast\WP\SEO\Presentations\Indexable_Post_Type_Presentation::$schema is deprecated in /home/atzok/atzok.com/wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php on line 64
Uncategorized

Layered Board Structure for 2D Games

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.


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

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

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

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