I was working on a little dungon crawler, like dungeon master in the early version
beign bored by the cubes for the walls, i have decided to use 3d models, (i import the fbx in blender, then i export it to .obj file, with the normals and the uv coordinates). the obj file are easy to parse.
- I draw the map using the map editor,
- the scene renderer read the map and generate the scene according to the different types of cells (wall, door, stairs, etc...)
- there can be multiple levels of floor, to handle this, i used multiples layers in the map editor (for each floor there is a collision tile map and a tile map for the walls,floor, doors, etc...)
- when the camera is on a stairs cell, it computes the z-position according to the position inside the cell and the direction of the stairs, when it leaves the stairs, it take the nearest floor level, so i know the camera z-position according to the level, and wich collision map to use
- i can also add 3d objects (they use a square as sprite to be displayed in the map editor, when drawn to the scene it use the object files and the associated texture)
- the scene is rendered to a separate surface, so i dont have to have to care about the mode (3D or 2D) when i draw the interface
- for the collision with the wall i use the collision map (tile base collision)
- for the collision with the objects i usethe bounding box of the object. I think i could use "place metting" or something like
- at last but not least: when you have quite close to an object you can click on it, and use the classic "mouse click" event to hande this event (in my example i can click on switches to open/close a door). To do this, it computes the 2d surface on the display and check if the mouse has clicked on that zone. (i think that for a dungeon crawler it should be suffisent)
I used the map editor, to draw the the walls , the doors, and also the stairs. and i can define multiple stairs in the same room (to do this, i use a couple of layers (for the map and for the collision) per floor)
I may publish this demo in the game maker store if you are interested.
YOu can test it at: https://slashio.codinfinity.net/3dtest/
There is the result after 3 days of work:
beign bored by the cubes for the walls, i have decided to use 3d models, (i import the fbx in blender, then i export it to .obj file, with the normals and the uv coordinates). the obj file are easy to parse.
- I draw the map using the map editor,
- the scene renderer read the map and generate the scene according to the different types of cells (wall, door, stairs, etc...)
- there can be multiple levels of floor, to handle this, i used multiples layers in the map editor (for each floor there is a collision tile map and a tile map for the walls,floor, doors, etc...)
- when the camera is on a stairs cell, it computes the z-position according to the position inside the cell and the direction of the stairs, when it leaves the stairs, it take the nearest floor level, so i know the camera z-position according to the level, and wich collision map to use
- i can also add 3d objects (they use a square as sprite to be displayed in the map editor, when drawn to the scene it use the object files and the associated texture)
- the scene is rendered to a separate surface, so i dont have to have to care about the mode (3D or 2D) when i draw the interface
- for the collision with the wall i use the collision map (tile base collision)
- for the collision with the objects i usethe bounding box of the object. I think i could use "place metting" or something like
- at last but not least: when you have quite close to an object you can click on it, and use the classic "mouse click" event to hande this event (in my example i can click on switches to open/close a door). To do this, it computes the 2d surface on the display and check if the mouse has clicked on that zone. (i think that for a dungeon crawler it should be suffisent)
I used the map editor, to draw the the walls , the doors, and also the stairs. and i can define multiple stairs in the same room (to do this, i use a couple of layers (for the map and for the collision) per floor)
I may publish this demo in the game maker store if you are interested.
YOu can test it at: https://slashio.codinfinity.net/3dtest/
There is the result after 3 days of work: