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 have a world made of floating islands that are procedurally generated. I would like to spawn enemies or the player in logical-non-falling-into-space spawn points. Ideas on how to accomplish this? My thoughts were this:

  1. Drop a bunch of spawn checking items and if they fall for too long then that is a bad spawn point.

  2. Build logic into how the randomly generated world is built so that there are regions pre-recongnized as the place to place NPCs, baddies, player, etc.

If anyone has links to some blogs or reports concerning this or your own ideas on this please post!

share|improve this question
3  
How are you storing or querying your procedural world? Is it a voxel grid, a collection of meshes, a mathematical function, or what? This will significantly affect which method is more efficient. –  Kevin Reid May 21 '12 at 22:09
    
voxel world. made of procedurally generated primitive shapes and then noised up. –  theprojectabot May 21 '12 at 23:36
    
My instinct is to say that #2 can be tuned to play better based on feedback from play testing, which is gooderer, while #1 you're kind of at the mercy of god playing with dice and that's badderer. You could even start building #2 using the #1 technique and improve it over time, but not the other way around; which is nicerer. –  Patrick Hughes May 22 '12 at 1:53
    
2b: Build the logic into the code which generates the floating islands. If you have floating/flying creatures then logic for generating spawn points for them can be put into the non-island world generation code. –  Matthew Cline May 23 '12 at 3:25

1 Answer 1

Number 1 would work, but a lot depends on your world. If it is huge, and the islands are far apart, you will spend a lot of time with "misses". Also, can one island be over another? If so, you might end up with just spawns on the upper islands, and nothing on the lower ones.

Number 2 is the right idea. Assuming your islands aren't totally featureless blank shapes, I'm guessing you will be putting other items on the islands beyond spawns, which leads to my suggestion below...

Assuming your world generator has some way to create and place entities on the islands (sprites, NPCs, paths, trigger points, items, what have you), you can just generate a "spawn point" entity as well. It is just an invisible placeholder with a coordinate on your world.

When you want to place (spawn) an enemy or the player, pick one, and put them there. If you want, you can do things like invalidate a spawn point once used so two items won't spawn on top each other. Also, you can filter further to regulate spawns. For example, pick a spawn point, and then search all existing used spawn points. If the new one is closer than some distance to an existing one, reject it. This could be as simple as just keeping your spawners from being too crowded, or even monster distribution - i.e., don't put big strong enemy close together, don't put enemies within X distance of the player, etc.

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.