Random Spawn Points

Everything todo with programming goes HERE.
Post Reply
User avatar
Graphic Artist
Posts: 6319
Joined: Wed Jan 23, 2008 3:37 am

Random Spawn Points

Post by sinewav »

I've been working in this problem for a while and I'm interested in hearing theoretical solutions. For a long time I've wanted Armagetron to have randomized spawn points to break up the monotony of default local games. Obviously you can't script a local game, so I made a server that does this (thanks to Z-man for the map suggestion!). It works well and I've gone through 4 different iterations, starting from something that was fully random to the current version which is quite restrained. The question is, what is the optimal implementation of randomized spawn points?

The image below is a diagram showing the possible outcomes of my current script, which does the following:
  1. Create a grid of starting points at 100m intervals (on a standard 500m map).
  2. Randomize the spawn point orientation, making sure they generally point inward instead of directly at the Rim Wall.
  3. Add "jitter" to each point, offsetting it by up to 32m.
  4. Make sure each jitter value is unique so no two spawn points share the same axis.
My code also has an overall "density" value that makes the spawn points either closer or further apart, and that value is also randomized.

I feel like this solves some problems I had with early iterations, such as cycles spawning extremely close together in some cases, cycles on the same axis and driving inside each other's walls, and cycles not being distributed in way makes play challenging.

Can this be better?
(3.39 KiB) Not downloaded yet

Post Reply