muffins Posted May 11, 2015 Report Share Posted May 11, 2015 (edited) I've been trying to implement auras to supplement formations, for personal use. Since this feature hasn't made it into the main game yet, I've tried making a quick fix. I've made satisfactory changes with testudo and phalanx formations, but haven't managed to get syntagma changes working. Posted below are the relevant changes I've made; does anyone know why it isn't working or how I could fix it?Testudo and Syntagma changes are posted below: I've changed formation spacing and the auras of individual units.Testudo:I changed the unit width multiplier to 0.3, meaning the units would be 0.9m apart. This was done so that visually all the shields were overlapping and to facilitate adding an aura. I then gave swordsman units an aura that would increase the pierce armor of swordsmen if they were within 1 m meter apart, giving them a bonus against projectiles while in testudo. Something similar was done for the phalanx formation. This application was successful. testudo.xml <UnitSeparationWidthMultiplier>0.30</UnitSeparationWidthMultiplier> <UnitSeparationDepthMultiplier>0.50</UnitSeparationDepthMultiplier> <WidthDepthRatio>1.5</WidthDepthRatio> template_unit_infantry_melee_swordsman.xml <Auras> <testudo> <Type>range</Type> <Radius>1</Radius> <Affects>Unit</Affects> <Modifications> <Armour.Pierce> <Add>16</Add> </Armour.Pierce> <Armour.Hack> <Add>0</Add> </Armour.Hack> <Armour.Crush> <Add>0</Add> </Armour.Crush> <UnitMotion.WalkSpeed> <Multiply>0.7</Multiply> </UnitMotion.WalkSpeed> </Modifications> <AuraName>Testudo</AuraName> <AuraDescription>Overlapping shields negate projectiles</AuraDescription> </testudo> </Auras>Syntagma:I gave pikeman units an aura that was intended to reduce the speed of enemy units if they were within pike range, 8 m meters away. This did not work. template_unit_infantry_melee_pikeman.xml <Auras> <pikes> <Type>range</Type> <Radius>8</Radius> <Affects>Unit</Affects> <AffectedPlayers>Enemy</AffectedPlayers> <Modifications> <UnitMotion.WalkSpeed> <Multiply>0.9</Multiply> </UnitMotion.WalkSpeed> </Modifications> <AuraName>Pike Density</AuraName> <AuraDescription>High density pikes obstruct enemy movement</AuraDescription> </pikes> </Auras>Please help! Edited May 11, 2015 by muffins Quote Link to comment Share on other sites More sharing options...
sanderd17 Posted May 11, 2015 Report Share Posted May 11, 2015 You should probably use the formation type aura for the testudo change, like Iphicrates: http://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/simulation/templates/units/athen_hero_iphicrates.xml Also, don't add zero-changes. It only clutters the template and causes extra values to save for no gain. For the syntagma change, how did you measure it? A range of 8 is really small (it's only 2 tiles). The range of a pike itself is also 8m. Only affecting speed when units are already standing still doesn't help a lot. Besides, you may encounter the range mismatch. The attack range for units is calculated from the unit center to the target boundary. So with big targets (like buildings), it doesn't try to reach the center, but it reaches the side of the building. While for most other ranges, speed is preferred and only both center positions are compared with each other. So if a pikeman attacks a different unit, it can be around 9m away from the unit. Quote Link to comment Share on other sites More sharing options...
muffins Posted May 11, 2015 Author Report Share Posted May 11, 2015 (edited) Thanks for replying!I chose to use a unit aura as a work around because I don't know how to have formation auras only apply to certain formations. Formation auras seem to apply whenever units are in formation, which would mean that swordsmen would be immune to pierce damage when they are standing in any sort of rectangle and only when they are moving. By having unit auras, swordsman only become immune to pierce damage when very close together, which would only happen when they are in testudo formation. This would work whether the units are moving or standing their ground and only when in testudo formation; its been working great for me and I'm happy with the results. However, if there's a way to have formation auras only apply for certain formations, I would gladly use it.The range mismatch is new information to me. However, what I was trying to do was to slow down enemy movement when they are attacked by pikes. If they are within 8 m, an enemy swordsman would have to travel 6 m to get in attacking range. When I made the pike aura, it was with the assumption that the auras would stack, so I used a multiplier of 0.9. If they do stack, then if there are about 15 pikeman within attack range of a swordsman, its movement would be reduced to 0.9^15, which would be about 0.2, or 20% of its base speed. I felt that this would be a good way to simulate the effects of engaging a large number of pikes, which should be very effective in holding up melee infantry. If, they don't stack, I just might change 0.9 to 0.2.However, I couldn't get this movement rate decrease to work; an error message just appears in console when pike units are created. Would you know why? Thanks. Edited May 11, 2015 by muffins Quote Link to comment Share on other sites More sharing options...
niektb Posted May 11, 2015 Report Share Posted May 11, 2015 Just FYI your first aura does apply to every situation soldiers are close together (the formation doesn't matter)What is the error? Quote Link to comment Share on other sites More sharing options...
sanderd17 Posted May 11, 2015 Report Share Posted May 11, 2015 Auras don't stack by design (would have been easier if they stacked, maybe more intuitive too in some cases).And you're right about the formation aura, it counts whenever units are in any formation. Maybe it's time to implement decent formation effects. 1 Quote Link to comment Share on other sites More sharing options...
muffins Posted May 12, 2015 Author Report Share Posted May 12, 2015 Huh. I've just tested it again and its seems to be working; its never done that before. It looks great when enemy units suddenly slow down when reaching the pikes, resulting in bunching up of enemy units trying to make it through the pikes. However, since the aura seems to be circular, enemy units slow down even when running around pikemen; its there a way to make auras directional? Thanks for the helpful comments!@niektb: I was worried about the auras applying outside of formation, but a unit spacing of 0.3 never seems to happen outside of testudo formation out of all the tests I've tried with my brother, so it seems alright. 1 Quote Link to comment Share on other sites More sharing options...
sanderd17 Posted May 12, 2015 Report Share Posted May 12, 2015 Directional checks would be a lot heavier. Checking a distance is easy (just do a dx²+dy²<dist² test), while checking angles requires trigonometric functions and thus are more demanding (those require a lot of higher powers to approximate the value). Quote Link to comment Share on other sites More sharing options...
wowgetoffyourcellphone Posted May 13, 2015 Report Share Posted May 13, 2015 Maybe wayy to make the tips of the spears a entity with an aura? Quote Link to comment Share on other sites More sharing options...
sanderd17 Posted May 13, 2015 Report Share Posted May 13, 2015 The spears are just an animation. That means they're local and cannot be synched for multiplayer. So you can't use it as a centre of some range query. Quote Link to comment Share on other sites More sharing options...
kosmo Posted May 13, 2015 Report Share Posted May 13, 2015 Would it be possible to place an invisible prop (correct term? Something like child actors) in front of the unit (where the spear is)? Quote Link to comment Share on other sites More sharing options...
sanderd17 Posted May 13, 2015 Report Share Posted May 13, 2015 From the moment you enter the "actor" part of the game, it isn't synced again. Like the calculation of the spear position only happens when it's actually visible on your screen and has to be rendered. Having a prop position that should always be calculated will slow down the game. No matter how good you make the actual code to do it. Maybe direction checks would be possible for entire formations (as there aren't that many formations in-game at once), but not on a per-unit base. 1 Quote Link to comment Share on other sites More sharing options...
muffins Posted May 15, 2015 Author Report Share Posted May 15, 2015 I've noticed that units seem to be able to turn instantly, which looks very strange for cavalry and makes pikes ridiculously manoeuverable. Is there anyway to implement turn speeds? Quote Link to comment Share on other sites More sharing options...
sanderd17 Posted May 15, 2015 Report Share Posted May 15, 2015 UnitMotion has a turn speed setting, but it's equal for most units. Only ships have a longer turn speed. But setting the turn speed might not give you the wanted result. When you order them to move backwards, they will turn while moving in that direction, not turn first and then move. Quote Link to comment Share on other sites More sharing options...
muffins Posted May 16, 2015 Author Report Share Posted May 16, 2015 I'm just unnerved with how quickly pikes can rotate a 20 ft stick, horizontally, a full 180 degrees, in milliseconds, especially through other units. Is there anyway to force pike units to bring their pike up, rotate, then lower it back to attack another unit if it is at too great an angle to spin to horizontally? Pike formations or just a group of pikes would have no weakness if they could just swing pikes through other members of their formation quickly, making flanking no longer effective as units that approach from behind would just be attacked as easily as units from the front.Cavalry also accelerate extremely quickly to their max speed; is there any way to have it ramp up more gradually? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.