Luyren's Map System

Luyren

  • *
  • Posts: 2337

This is a standalone metroidvania-style map and mini-map system. It works with any game genre and is compatible with my other resources.

What it supports:
-Multiple player actor icons.
-Multiple objective markers.
-The Map display is highly customizable.
-Customize the size of each map cell in-game.
-Scroll through a list of visited areas.
-Scroll through maps bigger than the display.
-Cell data: specify icons for specific cells on the map based on their state, and alter that cell's state. Used for bosses and defeated bosses, items and collected items for example.
-Map Opacity: you can specify the opacity of the map on screen, and the mini-map has features to change its opacity in-game.

When is it available?
You can download it here.

In the following days I'll post more in-depth about the features and how you will customize the map system in your game.

« Last Edit: January 07, 2020, 03:42:53 pm by Luyren »
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter

Luyren

  • *
  • Posts: 2337
How does it work?
You start by creating a full map image, in the state your map would be when fully explored, except for changing elements. So if you have markers for bosses or items, you would not include those in your full image.

Internally, the map is organized in cells on a grid. Each cell has an explored state and a data point. The explored state determines if you've never visited that cell, have visited it or "heard of it." An example of"heard of" are the map stations in Super Metroid. When displayed, the map is fully covered, and each cell is uncovered based on the explored state. Data points are arbitrary numbers that you can use to mark bosses and items for example. The system already comes with a few suggested values, but you can have as many as your game requires.

You can alter the map image with actors or swapping colors based on the explored state and data point in each cell. These can also be changed in-game.

You don't have to design your map image with squares and sharp angles, but beware that it will be uncovered based on the cells grid. It can also be as big or as small as you want.

How do you assign a scene to a part of the map?
Each scene must be configured with two things: the name of a global value that stores the map's data, and its cell origin on the map. Each "area" must have a unique global value.

For the cell origin, you pick the Y (row) and X (column) cells on the map grid that correspond to the top-left corner of the room that scene corresponds to.

You can configure the real game size of each cell for that scene. By default, one full screen sized area on a scene correspond to one cell on the map grid, but you can change the width and height individually.

How do you assign data points to each cell?
You do so by configuring a maps database. That is a game attribute of type "list" which stores the map's dimensions, number of explorable cells and all the cells with data points in them. It also contains display information for it.
Code: [Select]
Island Caves/IslandCaves/22/6/45/IslandCaves/Center/ArcadeWhite/Caves of the prison island./5,15,2;3,20,4
Prison/PrisonFortress/18/7/57/PrisonFortress/Center/ArcadeWhite/Prison for heretics./2,5,2;5,1,2;0,7,2;1,14,2;4,15,2;2,14,2
The map or mini-map display will read that information and change the map based on your settings.

« Last Edit: December 26, 2019, 05:44:36 am by Luyren »
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter

squeeb

  • Posts: 1616
I love it!  Great job. Cant wait to try it out

Luyren

  • *
  • Posts: 2337
I love it!  Great job. Cant wait to try it out
Thanks squeeb!

The sample game for the map system is now up. You can play the flash version here or you can download the attached Windows version.

Feedback, suggestions and questions always welcome.

« Last Edit: December 29, 2019, 07:59:36 pm by Luyren »
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter

Luyren

  • *
  • Posts: 2337
Using this pack you are encouraged to have several scenes in your game. The sample game alone has 51 scenes, so I included save, load and scene switching features.
Saving and Loading
This pack comes with a behavior to store the player's actor type, the scene where the game was saved and the player's X and Y position on that scene. You can also specify a scene or position to save instead. Saving is done with an actor designated as a save point, by attaching the behavior “Save Point” to it. You have the following save options:
  • Collision: automatically saves when the player collides with this actor.
  • Control: saves when the player presses a key while colliding with this actor.
  • Region: automatically saves when the player enters the specified region.
  • Scene: automatically saves when the player enters the scene.
  • None: can only save by receiving the "Save" trigger.
"Player" is defined as any actor of the specified "Player Group" in the behavior. You can also save by calling the trigger “Save” for the save point actor, which will automatically retrieve the player actor using a “for each actor of [actor of group]” loop if no player was detected previously. This also calls the trigger “Save”for the "Save Status" behavior for the player actor (from my other resource packs) , saving its configured attributes and actor values.

Loading is done with the “Load Game” scene behavior. To make use of it, you must use the trigger “LoadGame” for that behavior during a moment appropriate for you game. The load will register a fail if the game wasn't saved previously. In the sample game, an actor calls the “LoadGame” trigger when clicked on.

Scene Switching
I included a simplified version of the behavior used for switching scenes from the Cutscene Pack. It comes with the relative position feature when switching scenes using regions, which makes the player's position in the next scene change based on where in the region the player entered (works for both horizontal and vertical scene switch). You can also use this for door-like scene transitions, but it does not include an open/locked state like in the Cutscene Pack.

For the sake of having this resource pack completely stand alone, I also made the "Preserve Momentum" behavior. It's a super simplified version of the Save Status behavior that only saves the actor's momentum and layer. If you plan on using this with any of my other packs, you can use Save Status instead.

One important thing to know about scene switching is that your player actor should not be placed in the scene designer. Instead, it should be created at runtime. Otherwise, you will end up with two instances of your player actor in the same scene.

Cutscene Pack Integration
There are pre-made block combinations in a specific behavior that you can quickly copy and paste into the Cutscene Pack behaviors to have script events to alter map data in your game. These can be used to easily mark an item as collected on the map, or a boss as defeated.

Progress Report
Written documentation, behaviors and sample game are all done. Some unplanned features were also added as I compared what I have with other games. Next I'll start making video tutorials for all my resources, and the video for the map system is the third one I have planned. This pack will be released once that video is done.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter

Luyren

  • *
  • Posts: 2337
Turns out making videos is way more work than I anticipated, who'd have thought! So I'll just hope the provided documentation is enough, and get the tutorial video done when it is done.

That means the pack is now available. Download it here and have fun!
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter

Luyren

  • *
  • Posts: 2337
​​​​In recent weeks I've found out there were some memory mismanagement going on in my resource packs, and I just finished the work to fix that. This is more of a "better safe than sorry" fix, as the previous version worked just fine, and it would probably only be an issue in very rare cases.

For the map system, I've revamped the documentation with a table of contents, small fixes and some new images. For the pack itself, beside the memory optimizations, there were some changes in how you determine the position of each character in a map (using a list now), the ​Menu Map ​behavior now can set arbitrary conditions for drawing menu information, and the map changes based on cell data and discover state have been made easier to customize, using now a (fittingly) map attribute instead of a list.

You can download this pack here to get the updated version.

I'm planing on making a tutorial video for this pack in the next month or so.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter