So I started implementing the encounter system I wanted described here and ran into a couple issues.
The first most apparent issue is battler placement. I can't come up with an algorithm that will allow me to "spread" the monsters out in an orderly fashion.
Attached is a visual example of what I mean.
It is an extreme example (I generated 16 enemies to appear on the map), but it illustrates the problem.
What kind of algorithms can I use to try to position the battlers in "good" spots? Realistically there will be at most say 5 or 6 enemies on the screen at the same time, although they can be large.
Here is the script I am using. Instructions are same as described in the other thread: just write numbers into the map's note box to determine which enemies should be in the draw pool. The note I wrote is
enemies
CODE
1 30 2 50 3 20 4 10 5 10 6 10 7 10 8 10 9 5 10 17
Script
CODE
class Game_Map
def note @map.note end end
class Game_Player < Game_Character
def make_enemy_count #return [1, rand(8)].max return 16 end
for x in 0 .. numEnemies value = rand(weight_sum) enc_list.each_with_index do |enemyIdx, i| value -= enc_weight[i] if value < 0 list.push(enc_list[i]) break end end end return list end