# Creating a room

This topic is 1830 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

What would be the easiest method of creating a cylinder and turning it into a room for a video game? Its going to be a dungeon and all the rooms are going to be circular like a cylinder. I have no idea how to approach this though...any help?

##### Share on other sites

you could make the rooms (sounds like caverns) in a 3d modeling program, then import them into your game

##### Share on other sites

How would I set up collision for the room?

##### Share on other sites

if your just doing a simple project, you can just do collision on your own without a 3rd party physics engine.

There are many ways to do collision detection. If your rooms happen to be perfectly round like the cylinder you mentioned in your first post, you could get the radius of your cylinder, and just make sure that nothing gets further from the center of the room than the radius, that way you won't be able to walk through the cylinders walls. That's not a very flexible design though, as it would only work well for perfectly round rooms, and if you wanted the rooms to connect, you'd have to find a way to let the player walk to the next room by letting him go further from the center of one room than the radius of that room, if that makes any sense.

Otherwise, you can do bounding volume collision tests. There are a lot of different volumes you can use, but common ones include bounding spheres and bounding box's (AABB for an Axis-Aligned Bounding Box or OBB for Oriented Bounding Box). Put your main character or whatever in one of these bounding volumes, and check for a collision between the room and the bounding volume. You could also do triangle to triangle collision tests, Which is the most accurate collision test, however it also takes the biggest performance hit, especially if you have a lot of triangles in your scene to test against, which is why there is bounding volumes. Start with a bounding volume, and if you need to get more accurate, do triangle to triangle collision tests. if you have a lot of things to check for collision with, you might want to do some sort of spacial partitioning, such as a quad tree or octree, so that only an object in a section will check for collision with other collidables in that section and the surrounding sections.

Bounding volumes can also include a "collision mesh", which is a representation of the object you want to check for collision with, but many less triangles, and usually convex, so you can use collision test techniques that perform better than collision test techniques using concave objects.

if your room is complicated, you'll probably want to create a collision mesh for the room, but if its simply a cylinder, or a box, or some simple shape, you can use it by itself as a collision object with whatever is in the room.

Since collision detection is such a common thing in games, you can easily find many many sites that will teach you about collision detection. just use google and you'll find them

Edited by iedoc