- Home /
Grid Movement VS Free Movement
I'm currently in the process of creating a retro 2d map/grid consisting of tile objects each connecting to another, in 8 different directions (north, south, east, west, NW, NE, SE, SW). Player Movement would work just as old school rpg movement had, where a player moves one tile each time, and only takes up one tile. The map locations/tile types would be randomly generated in accordance to a range.
Though as I was creating this, I had a thought - with all that unity offers, why wouldn't one just create a map visually (like a background), and randomly load locations/items on to it. Always making sure two objects don't overlap, and having the player move along the map - kinda like what seems to be the case in Don't Starve.
Basically my question is - in a non tactical RPG where the player moves along a 2d map - what is the advantage to using a grid movement system vs free movement in unity? Is leveraging unity's features in the form of free movement a big toll on performance?
Thanks!
Answer by Bunny83 · Mar 20, 2017 at 04:44 AM
Grid maps basically have one advantage: Simplification! That may apply to both, the development as well as the gameplay.
It mainly simplifies "collision" detection since everything is on a fix-sized grid. In turn it makes certain character animations easier to align to other objects on the map. On an open unrestricted map you would need to use triggers to detect when the player is "near" an object. If you have an animation that interacts with map objects you have to ensure a certain alignment of the player relative to that object. Aligning and moving the player automatically would require some sort of pathfinding / collision avoidance. This can create much more edge-case problems on unrestricted maps. Pathfinding on grid maps is way simpler and 100% predictable. Possible problems on grid maps can usually be easily detected during generation of the map.
If the player movement is restricted to a grid it's usually clearer for players where you can move and where you can't.
Grid maps might use two different grid sizes at once. One larger grid for the map tiles and a smaller grid for movement / object placement. Of course the smaller grid would be a subset of the larger grid (x2, x3, x4, ...)
A lot games that provide "free movement" actually use both. The map and it's objects are usually tile-based but enemies and the player can move freely (typical Mario style).
Performance is usually not much affected by the type of map / movement used. Of course free movement would require the usage of the physics system for collision detection. This could be avoided when using a grid-based movement. However the physics system is quite fast anyways.
Rigidbodies and colliders just work out of the box while a grid system has to be created first. Even they are quite simple and straight forward it will take a while to implement properly.
thank you so much, great explanation :) very much appreciated!
Your answer
Follow this Question
Related Questions
Object Squeezing Between Tiles 0 Answers
How to use the same tilemaps among multiple scenes (e.g. making it a prefab)? 0 Answers
Drag Rigidbody into slots? 2 Answers
Creating a 2D Movement Grid 0 Answers