Sign in to follow this  
knonk

Manage Map and Forbiden Region in Game

Recommended Posts

knonk    122
Hey Guys, Normaly,a game will have a map and some regions where player can move, some forbiden regions where user can't move to there such as rivers,mountains,... In my game, I have river,mountain,houses,streets,....and I want player only move on the street, don't move through houses or river,...That's also mean I have a map and I want to forbid moving's player in some regions. Are there some technologies about Map Management and Forbiden Region help me can do this ? Does somebody can tell me about that technologies or some methods ? Thank you so much !

Share this post


Link to post
Share on other sites
wodinoneeye    1689


If you have a tile (or heighmap witha regular grid) you can have an array of flags corresponding to the map array (as small as 1 bit each tile/square) to flag terrain that cannot be entered (preferably being obvious terrain types so the player can see a reason he cannot enter/pass).

A variation of that is to have lookup table for tile terrain type which there has a flag (for each type) indicating if the player can move into that kind of tile. If water is to be used as a boundry then the water tiles will have their flag set to CANNOT_MOVE_THRU (true) while land surface tiles have it set to false and each time a player gives the command to move into the tile the flag is tersted and the move halted.

If you have a free flowing 3D terrain mesh then you could do something similar by having flags imbedded in the terrain vertices OR have a seperate 'NAVMAP' mesh which the player is not allowed to move off of (see point on triangle meth to see how to test movement against the mesh).

Share this post


Link to post
Share on other sites
knonk    122
I used a tile in my 2D game.Actually,That's mapping from 2D SCENE to Forbiden Binary Matrix, Example I have :

Matrix A= [
0 0 0 0 0 0 0
0 1 0 1 0 1 0
0 1 0 1 0 1 0
1 1 1 1 1 1 1
0 0 0 0 0 0 0
0 1 0 1 0 1 0
0 1 0 1 0 1 0
0 0 0 0 0 0 0
]

A POSITION from real Scene will be mapped to an ELEMENT in matrix A,if that Element is 1, player can move to that position. It's posible in 2D game,but in 3D , it's different. We can't use that method to manage map and region anymore.

I think the your idea was the same,so Im still finding an other way to manage the map and region in 2,5D and 3D game.

Im verry apreciated some ideas can help me now !
Im also still waiting for your idea wodinoneeye,Thanks so much!

Share this post


Link to post
Share on other sites
hplus0603    11347
In 3D games, typically this is done through collision detection. Create collision meshes for your buildings, and walk meshes for your streets, and then use regular 3D simulation to update the positions of players.

Share this post


Link to post
Share on other sites
wodinoneeye    1689



In 3D games you can still use the flag method if you have your scenery represented as a grid mesh. The heightmap (altiutudes) is used to supply the Z value for a regular grid (like tiles) and you could have a corresponding flag array mapped into the same coordinate system (many games use heightmaps for fairly plain outdoor scenery.


As hplus0603 said some games use collision detection to check impacting parts of the irregular 3D mesh (you still probably have to have special terrain types checked like water if it is supposed to be impassible(.

Another way was the Navmesh I mentioned which is a preprocessed mesh (also an irregular 3D or 2D mesh, though sometimes simplified from the actual rendering mesh) where the player is only allowed to stay on the mesh and will be stopped if their motion take it one step off the surface. Many games dont let you leave the ground (flying) so that only the XY traversals need to be checked against the Navmesh.

Share this post


Link to post
Share on other sites
knonk    122
Some Scences in my game are verry complicated, they include:many houses,Streets,Mountains,Rivers,Trees,.... Designer just make a Scene as bitmap or vector image in Flash. So I have to cut into tiles, It's seem not posible. I mean it's so hard and take the time to make the tiles for all scenes in game, so there might be some tools or methods help us make tiles from design.
Doese anyone have some ideas ?
I also thanks Wodinoneeye and HpPlus0603 gave me some good ideas, Im waiting for your ideas,guys!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this