ISOMAP GENERATOR v4.6 With A* Pathfinding (Check it out!)
Posted: Tue Oct 04, 2011 6:04 am
This is Version 4.6 of my Isometric map generator. I will be updating it as I get more done. Including better AI path finding, and more.
Soon to come:
Explanation of Nodes:
Explanations of Tile Placement and Setting up maps:
The tile I used was from Isometric Experiment created by GrimmDingo. His tile made it very easy for me to make this. Thank you.
ISOMETRIC MAP GENERATOR v2:
Simple Follow AI
Automatic Isometric Tile Placer
Isometric movement
Map from Array
Tile Sorting (Just name your tile animations tile0,tile1,tile2,tile3, ect...) Tile255+ is unwalkable.
Renamed some functions and variables
UPDATE 2.1
Removed Ghost Node number 99
UPDATE 2.2
Unwalkable tiles start at 255
UPDATE 2.4
Lava Tile
Mouse Click Movement
Better Commenting
Cleaned up script
UPDATE 4.3
Moved all the script into a single section, added heavy commenting
Semi-Functional A* Pathfinding (It works...)
AI STATES
Larger map to show cripplingly stupid AI
New screenshot
UPDATE 4.5
BETTER A* Pathfinding
New Movement Function (Still working on getting it smooth)
New Functions
Does not use MoveTo()
Orphaned view
BOTH AI's Move
New AI Sprite
More function text
Updated node placement so that it doesn't change when view is moved
More that I can't remember.
UPDATE 4.6
Smooth Movement
New Map
New Screenshot
Soon to come:
- Better A* Pathfinding
Wall Tile Placer (with auto-transparency if player behind wall)
Stairs Tile Placer
Level Start Node
Teleport/Level Change Node
Level Load Activation Regions
Read Map From File
Screen Nodes (for menus)
AND MORE
Explanation of Nodes:
The map is a 2 dimensional array which is stored as map[][]. A for loop runs through the map placing nodes (map positions) at specific Game Coordinates. Then saves the game coordinates into arrays. The map nodes are just stored numbers which can be iterated through by looping functions and used for simpler movements and easier finding of points on the level. The node coordinates then become "World Coordinates" (coordinates of the entire level used for movement). So we end up with 3 types of coordinates.
GAME COORDINATES: These are the coordinates of Game Editor. 0,0 starts at the + in the game editor.
WORLD COORDINATES: Also can be called Node Coordinates, these are the x,y of each node in relation to the first node (0,0).
SCREEN COORDINATES: Are not used yet in this demo. These are the Coordinates of the View. Later I will make screen nodes to place menus.
Movement in the game is done by three functions (for now). These functions do different things. One uses the node number and goes to node number. The second uses the node's x,y and goes to the node. The third is the MoveTo() function, which takes: the actor to move, the node's X game coordinate, and the node's Y game coordinate, then moves the actor. The last thing these functions do is set the Actor's node x,y variables to match the node's x,y that it was move to in World Coordinates. This way we just have to increase the Actors' node X and Actors' node Y to find the next node to move to.
That's all for now.
NOTE: Unwalkable/Unused nodes are given NODE COORDINATES -1,-1. Later this will change and nodes will be given a score, score -1 will be unreachable.
Explanations of Tile Placement and Setting up maps:
To start, the map is stored in a 2D array of integers. This array holds the data of: Where to place the tile and Which animation to use.
The tiles start at ANY number you want them to start at. The unwalkable tiles start at 255. (This can be changed in CreateMapIso() function, just look for the number 255 and change it to any number you wish, but make sure that its not 0 or there will be no nodes placed and all tiles will be unwalkable.)
For sake of simplicity and use with this demo, all tile animations start at 0 and unwalkable tiles start at 255.
When making your map, you just change the number in the position you want to set your tile from 0-9999 (not actual limit). That's it.
Tiles:
When making your game tiles, the only actor you need is ISOTILE. Then name your animations "tile#" without quotes and where "#" = the tile number. For an example look at the tile actor in the demo. Check animations.
Then any tiles from 0-254 will be considered walkable and will have nodes created for those tiles. Any tiles 255+ will be considered unwalkable and no node will be created.
The tile I used was from Isometric Experiment created by GrimmDingo. His tile made it very easy for me to make this. Thank you.
ISOMETRIC MAP GENERATOR v2:
Simple Follow AI
Automatic Isometric Tile Placer
Isometric movement
Map from Array
Tile Sorting (Just name your tile animations tile0,tile1,tile2,tile3, ect...) Tile255+ is unwalkable.
Renamed some functions and variables
UPDATE 2.1
Removed Ghost Node number 99
UPDATE 2.2
Unwalkable tiles start at 255
UPDATE 2.4
Lava Tile
Mouse Click Movement
Better Commenting
Cleaned up script
UPDATE 4.3
Moved all the script into a single section, added heavy commenting
Semi-Functional A* Pathfinding (It works...)
AI STATES
Larger map to show cripplingly stupid AI
New screenshot
UPDATE 4.5
BETTER A* Pathfinding
New Movement Function (Still working on getting it smooth)
New Functions
Does not use MoveTo()
Orphaned view
BOTH AI's Move
New AI Sprite
More function text
Updated node placement so that it doesn't change when view is moved
More that I can't remember.
UPDATE 4.6
Smooth Movement
New Map
New Screenshot