There are two scripts available that allow the developer to change part of a map:
Tsukihime's Tile Swap (
http://himeworks.wordpress.com/2013/02/17/tile-swap/) and
Fomar0153's Region Map Loader (
http://cobbtocs.co.uk/wp/?p=334).
Both were limited in their intentions and thereby fall short of the options needed for a truly dynamic map - which is basically needed to provide random map options.
I have thought of a script that may allow such a map in an RM-Game, but I don't know enough of RGSS3 and the internals of the RM-Engine to make such a script myself. I'm describing the idea here as a request to learn if it is possible and if some scripter would be interested enough to make such a script available to the public.
The script needs several commands or options described as following:
1) A way to designate one or more of the editor's maps as "dynamic"
This will basically tell the engine that this map needs to be saved and loaded when saving the game, instead of using the default map file from the editor.
This will also tell the script about the general map data - the size set for the map in the editor should be the maximum size, and all map properties like tileset will be taken from this map.
2) Maps as dynamic Mapparts to be made by the game developer
This is not directly part of the script, but the script has to have a way to get that data based on the map-ID used in the script's functions
3) Scriptcall to copy data from one map (mappart, see 2) into the dynamic map (see 1)
Input data for the function:
ID of the dynamic map (most probably the current map, but might be another ID if called before a transfer)
X,Y Koordinates on the dynamic map (1) to specify where to place the new part (2)
ID of the map used as mappart (2)
Then, beginning on the specified coordinates and going to the size of the map to be copied, for all positions on that area the following sequence should be prozessed:
- coordinate check for target outside dynamic map, skip if target coordinate has already left dynamic map
(if the selected mappart is larger than the size available from the specified coordinates, anything outside the dynamic map will be ignored)
- If the bottom map layer of the current tile on the mappart is set, that tile is copied/placed to the bottom tile on the current coordinates of the dynamic map
(this is to allow for non-regular mapparts - wherever the parallax would show on the source map for the mappart, the previous data on the dynamic map will be retained)
- if the top map layer of the current tile on the mappart is set, then that tile is copied/placed to the top tile on the current coordinates of the dynamic map.
(again to allow irregular source forms, or to place different decorations on the bottom layer of the dynamic map)
- if there is an event on the coordinates of the source map, that event will be copied to the coordinates on the dynamic map (replacing a previous event there if neccessary)
These steps should be repeated for every tile on the source map, until that has been copied to the dynamic map.
Previous data on the dynamic map is always deleted/overwritten.
When saving a game, the last/current structure of all dynamic maps is always saved (to be loaded again when the game is loaded or when the player enters the map again later
(If neccessary, I can make a flowchart for this - but it's basically only a loop over all tile coordinates)
4) script call to reset the dynamic map to the original editor structure
If several dynamic maps exist, this need the MapID to prevent loosing other dynamic maps.
This would allow a developer to use a map for a random dungeon, later clearing it and using it for a different random dungeon without worrying about which parts of the dynamic map were changed and which not.
----------------------------------------------------
It should be clear that in all cases, the dynamic map and the smaller maps used as sources for the mapparts need to be set to the same tileset. That is one of the reasons I consider the option of allowing several dynamic maps, so that different tilesets might be used with different sets of dynamic maps.
----------------------------------------------------
Intention:
Such a script could be used for several types of random or non-random maps. The examples I can think of:
- random dungeon grid
Make an empty dynamic map of 105x105, and partial maps of 15x15 each containing one room with possible exits NSWE and different contents. An autorun event on the dynamic map can fill it with a random selection of 7x7 of those "dungeon rooms" with different content.
It would even be possible (with a bit more tricky eventing) to have the randomization not upon entering the dynamic map, but have the next room appear when the player gets to the exit of the room he currently is in (make the event with the script call for copying the next room into the dynamic map on the mapparts near the exit areas).
- changing world
Make the dynamic map with the beginning town/castle, and later call in smaller mapparts to reflect changes done on the map, like burned down parks or new construction like a player's home.
- mission specific maps
In an XCOM-Type game where the player has to clear an UFO crash-site, have the dynamic maps different parts of earth (town, forest, etc) and make just one scriptcall to place the UFO wreck at a more or less random position on that map. If there are several possible wrecks and several basic earth maps, the result will be a multiply of possible mission maps (is it a small or a big UFO that crashed, and was it placed on a town or forest map etc).
- different mapping type
Instead of using random placement, the entire game world might be created with fixed copying of premade smaller structures into the player's maps. That way is an alternative to copying the maps in the editor and perhaps some developers might choose this way instead of manually copying the tiles in the editor.
This would have some advantages in teamwork (people can work on different parts of the map without needing coordination) or when the developer doesn't have good mapping skills and might commission the parts.
---------------------------------------------------
If no scripter is interested in such a request, I would appreciate a few comments on possible problems or advice to improve the description or idea