I have seen Nytir's battle system on the vault but never played with it. Can it do this? If not, has anyone written any code to make this happen? If so, are you willing to share or explain how you did it?
Thanks.
Scripting soldiers marching in formation...
Débuté par
M. Rieder
, avril 22 2011 03:47
#1
Posté 22 avril 2011 - 03:47
#2
Posté 22 avril 2011 - 05:52
I've thought about it, using vector math to create locations relative to a squadleader, but in the end decided that just painting down waypoints for each NPC made more sense.
The Danaan Unvanquished mostly uses more open, skirmish-line style formations, with each NPC advancing towards a placed waypoint. Patrols advance behind a leader in a loose column formation, but once I use a tight march column formation, with each NPC forcefollowing the next NPC in the file. Defensive formations are easy, because you can just use pre-placed waypoints.
As for true formations, this is as much thinking as I got done:
You have a Squad Leader, upon which the rest of the formation is formed.
Each squadmember has a number that indicates their postion in the formation, and when a squadmember dies or otherwise falls out of formation, you have to sort through the remaining squadmembers and reassign their position numbers.
Every heartbeat, each squadmember finds the location of their squadleader, and uses their position number to determine their place in the formation (i.e. #3 is 4.5 meters directly to the right of the squadleader), and tries to move to that location (the location should be adjusted if the squad is moving forward).
If the location is invalid, they try something else, like simply keeping within X meters of their squadleader.
The problem I had is that is this kind of formation only makes sense on a broad, fairly flat battlefield, with few to none obstructions in the way. So in the end I decided to use placed waypoints to control the formations, as then I could place them by hand to follow the contours of the land and take advantage of cover and concealment. The Dana'an Unvanquished has one big set-piece battle that's essentially two lines charging at each other, but it quickly turns into a confused melee. The same sort of code, though, could be used to make a battle that looked more like a semi-orderly scrum.
The Danaan Unvanquished mostly uses more open, skirmish-line style formations, with each NPC advancing towards a placed waypoint. Patrols advance behind a leader in a loose column formation, but once I use a tight march column formation, with each NPC forcefollowing the next NPC in the file. Defensive formations are easy, because you can just use pre-placed waypoints.
As for true formations, this is as much thinking as I got done:
You have a Squad Leader, upon which the rest of the formation is formed.
Each squadmember has a number that indicates their postion in the formation, and when a squadmember dies or otherwise falls out of formation, you have to sort through the remaining squadmembers and reassign their position numbers.
Every heartbeat, each squadmember finds the location of their squadleader, and uses their position number to determine their place in the formation (i.e. #3 is 4.5 meters directly to the right of the squadleader), and tries to move to that location (the location should be adjusted if the squad is moving forward).
If the location is invalid, they try something else, like simply keeping within X meters of their squadleader.
The problem I had is that is this kind of formation only makes sense on a broad, fairly flat battlefield, with few to none obstructions in the way. So in the end I decided to use placed waypoints to control the formations, as then I could place them by hand to follow the contours of the land and take advantage of cover and concealment. The Dana'an Unvanquished has one big set-piece battle that's essentially two lines charging at each other, but it quickly turns into a confused melee. The same sort of code, though, could be used to make a battle that looked more like a semi-orderly scrum.
#3
Posté 22 avril 2011 - 06:42
Technically it's doable, as there is code for things like following leaders, chasing designated npcs, scattering when an enemy approaches. Strict formations may not be.
One way to represent large groups of individuals or critters or whatever is to have a single critter that represents a group. The Cityscape sourcebook takes this approach for animal and vermin swarms as well as mobs of commoners.
One way to represent large groups of individuals or critters or whatever is to have a single critter that represents a group. The Cityscape sourcebook takes this approach for animal and vermin swarms as well as mobs of commoners.
#4
Posté 22 avril 2011 - 09:34
There are functions for NPCs in a Group to set themselves up in a formation/shape. Groups are hugely useful and a tool underused by many.
Look for the functions (in the include file "ginc_group"):
GroupSetBMAFormation
GroupSetCircleFormation
GroupSetLineFormation
GroupSetRectangleFormation
GroupSetSemicircleFormation
And perhaps some other useful functions.
Look for the functions (in the include file "ginc_group"):
GroupSetBMAFormation
GroupSetCircleFormation
GroupSetLineFormation
GroupSetRectangleFormation
GroupSetSemicircleFormation
And perhaps some other useful functions.
Modifié par _Knightmare_, 22 avril 2011 - 09:35 .
#5
Posté 22 avril 2011 - 11:51
Hey, that's some really good information there! I'm going to experiment with this. My goal is to have two colums of soldiers marching side by side. Once battle is joined, it's okay if they fall apart. I just want things to look tidy until the first fireball hits them...





Retour en haut






