As said earlier, I'm now attempting to implement dynamic enemy formation placement, and I must say I've done some progress on the question
Here are the specifications I made so far:
(If you're against something, please flame now!!)User-side:
* The enemies shall have predefined battle position preference. Like warriors will go to the front, mages and archers to the back, boss usually in the middle, whatever order the enemies are added in the roaming party.
* The enemies can have different predefined formation placement:
- Square like (or simple line if not enough enemies.)
- Cross like
- Quincunx like
- Offensive arc (just as this '<')
- Defensive arc (just as this '>')
* if necessary, enemies sprites below others should be partially displayed over them to gain space but also to render the perspective.
* The formation type, and order should be overridable, especially for boss battles.Technical:
* The enemies are sprites drawn in a specific portion of the battle screen which so far seems to be :
600 pixel wide and 300 pixels high, beginning at the position: 314, 168.
* Speaking of that (and this is a note for others: The origin X=0;y=0 is bottom left of the screen, above the action bar, at least in battles. I had the surprise myself
* There is a curve (seen on heroes) attempting to render the scene perspective of y=3x. I'll have to apply on monsters, too
* Each predefined formation can be set randomly, or later using a parameter but will only accept a maximum surface (yes, width*height) of actors, falling back to the square formation.
The square formation will draw (first statically) the sprite partially on each other based on the space needed, with a minimal of 4/5th of the sprite, for every formation. The 4/5 will be applied for the sprite height but also the width as the current images margin is taking some space atm.
* Enemies with a front preference will be drawn the most left possible, the middle ones after that, and the back ones, after the middle ones.
I've made a patch implementing this:
- Front placement
- square formation
- static 4/5 of the image drawn over the one above.
- Accept any number of enemies but draw them too far to the right, when there is too much of them.Note that the patch isn't meant to be pushed!!
Here are two screenshots of what is done so far (Excuse the jpg format but I had a file size problem otherwise):
What do you think of it?