Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I want to make a terrain for a RPG game that I'm developing. I started modeling the surface and implementing it to my game, but now I realized that i might be doing everything wrong. So I would like to ask a few questions:

  • How should I make the surface Model?

I'm developing my game without an engine, so I have to do coding for everything (Java, LWJGL). I use Blender to model the surface, and I export it to an .smd model file.

  • How to detect intersections between the surface and other models?

I guess I need to detect intersections, to make the terrain walkable. The problem is that I don't know the best and easiest way to do that. I tried making a triangle-triangle intersection detection algorithm, but it was to hard for me, and I guess I need something faster and simpler.

share|improve this question

2 Answers 2

up vote 4 down vote accepted

You can generate your surface as height map (2D table of heights, regular grid). It might look like this

http://mrdoob.github.com/three.js/examples/webgl_geometry_terrain.html

You probably don't need physical simulation, so you just find the height at certain coordinate and check, if your model is above it /under it. That is only the basic idea and I am sure you can extend it.

share|improve this answer
    
That's also what I would recommend: Create a heightmap for the ground and then use separate 3d models for more complex objects like trees or buildings. When actors are supposed to walk on top of them, they could have a simplified invisible shape which modifies the heightmap for game logic purposes but not for rendering (in most cases a simple box will do - such a box around an object is called a "bounding box" and can also be used for collision detection). –  Philipp Jan 22 '13 at 14:13

One solution is to create a navigation mesh which defines walkable surfaces. This mesh can also be used for pathfinding for AI. There is a C++ library to automatically create a navigation mesh called Recast & Detour.

Recast has been integrated into Blender. Switch the renderer to "Blender Game". In the Scene properties panel you can then find a "Build navigation mesh" button, which creates a navigation mesh for the currently selected objects.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.