6
\$\begingroup\$

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!

\$\endgroup\$
4
  • 3
    \$\begingroup\$ 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. \$\endgroup\$
    – Kevin Reid
    Commented May 21, 2012 at 22:09
  • \$\begingroup\$ voxel world. made of procedurally generated primitive shapes and then noised up. \$\endgroup\$ Commented May 21, 2012 at 23:36
  • \$\begingroup\$ 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. \$\endgroup\$ Commented May 22, 2012 at 1:53
  • \$\begingroup\$ 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. \$\endgroup\$ Commented May 23, 2012 at 3:25

1 Answer 1

4
\$\begingroup\$

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.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .