Territory effects and movements

classic Classic list List threaded Threaded
26 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Territory effects and movements

crystalct
I'd like to resurrect an my old project, but.... now... is there a way to prevent tanks to enters into a mountains territory, or that it loses a point movement?
---------
Droid Rulez
Reply | Threaded
Open this post in threaded view
|

Re: Territory effects and movements

eurofabio
I think yes, but not sure.

I found this property on POS2:

movementLimit - values: only affects normal movement. count equal to the maximum number of units allowed in a territory. value must start with "owned", "allied", or "total", then after that is a colon delimited list of units or the word "all".

You may have multiple instances of this, per player. example: <option name="movementLimit" value="owned:Battleship:Battlecruiser:Cruiser:Destroyer:Submarine:Transport" count="4"/>

So you may try something like this:

<option name="movementLimit" value="owned:tank" count="0"/>

Reply | Threaded
Open this post in threaded view
|

Re: Territory effects and movements

eurofabio
Wait this is a player attachment, which means if you use this you can have zero tanks in the whole game.

There is another property you might use

  the following options are allowed for "territoryEffectAttachment"

combatOffenseEffect values: the name of the unit, and the count of how much offense you want to give this unit

combatDefenseEffect values: the name of the unit, and the count of how much defense you want to give this unit

noBlitz values: the name of the unit that can't blitz through this territoryEffect, can be multiple units
                       
       
<attatchment name="territoryEffectAttachment" attatchTo="mountain" javaClass="games.strategy.triplea.attatchments.TerritoryEffectAttachment" type="territoryEffect">
                                        <option name="combatOffenseEffect" value="infantry" count="1"/>
                                        <option name="combatDefenseEffect" value="armour" count="-2"/>
                                        <option name="noBlitz" value="armour"/>
</attatchment>
Reply | Threaded
Open this post in threaded view
|

Re: Territory effects and movements

Zim Xero
Territory effect development never got as far as reducing movement values, except for blitz disable.  This would be useful for other things besides tanks.
'thats the way it is' makes it neither desireable nor inevitable
Reply | Threaded
Open this post in threaded view
|

Re: Territory effects and movements

crystalct
A reduction of movement when there is an territory effect is hard to develop, i know it. However, to ensure that a certain unit can not come into a territory with certain effect should be more simple to develop and very useful.
---------
Droid Rulez
Reply | Threaded
Open this post in threaded view
|

Re: Territory effects and movements

Veqryn
Administrator
edwin made a terrain movement cost thing, i'm not sure if it is usable yet though
it should be easy to prevent movement into specific territories based on terrain
Please contribute to the TripleA 2013 donation drive:
http://tripleadev.1671093.n2.nabble.com/2013-TripleA-Donation-Drive-tp7583455.html
Reply | Threaded
Open this post in threaded view
|

Re: Territory effects and movements

Rolf Larsson
I requested movement restriction based on units instead of per player already, if it is easy/easier with territoryeffects, that would be great, too.
We now have custom dice!
Reply | Threaded
Open this post in threaded view
|

Re: Territory effects and movements

Veqryn
Administrator
what do you mean by movement restrictions?
Please contribute to the TripleA 2013 donation drive:
http://tripleadev.1671093.n2.nabble.com/2013-TripleA-Donation-Drive-tp7583455.html
Reply | Threaded
Open this post in threaded view
|

Re: Territory effects and movements

Rolf Larsson
In reply to this post by Veqryn
Veqryn wrote
it should be easy to prevent movement into specific territories based on terrain
if movement is prevented, I would call this restricted for certain units.
We now have custom dice!
Reply | Threaded
Open this post in threaded view
|

Re: Territory effects and movements

crystalct
What do you think about a Territory Effect Attachment like "unitNotAllowed values: the name of the unit not allowed in this territoryEffect, can be multiple units...." ?
I could try to develop it if it's not too complex.
---------
Droid Rulez
Reply | Threaded
Open this post in threaded view
|

Re: Territory effects and movements

Veqryn
Administrator
unitsNotAllowed sounds fine
should be a Very easy patch to make
you could put the check into the movement validator in validate basic, or where-ever the current movement limit (player rule version) check is
Please contribute to the TripleA 2013 donation drive:
http://tripleadev.1671093.n2.nabble.com/2013-TripleA-Donation-Drive-tp7583455.html
Reply | Threaded
Open this post in threaded view
|

Re: Territory effects and movements

crystalct
Yes... it's seemed easy.....
Into TerritoryEffectAttachment.java
         /**
	 * Adds to, not sets. Anything that adds to instead of setting needs a clear function as well.
	 * 
	 * @param unitsNotAllowedUnitTypes
	 * @throws GameParseException
	 */
	@GameProperty(xmlProperty = true, gameProperty = true, adds = true)
	public void setUnitsNotAllowed(final String unitsNotAllowedUnitTypes) throws GameParseException
	{
		final String[] s = unitsNotAllowedUnitTypes.split(":");
		if (s.length < 1)
			throw new GameParseException("unitsNotAllowed must have at least one unitType" + thisErrorMsg());
		for (final String unitTypeName : Arrays.asList(s))
		{
			final UnitType ut = getData().getUnitTypeList().getUnitType(unitTypeName);
			if (ut == null)
				throw new GameParseException("No unit called:" + unitTypeName + thisErrorMsg());
			m_unitsNotAllowed.add(ut);
		}
	}
	
	@GameProperty(xmlProperty = true, gameProperty = true, adds = false)
	public void setUnitsNotAllowed(final ArrayList<UnitType> value)
	{
		m_unitsNotAllowed = value;
	}
	
	public ArrayList<UnitType> getUnitsNotAllowed()
	{
		return new ArrayList<UnitType>(m_unitsNotAllowed);
	}
	
	public void clearUnitsNotAllowed()
	{
		m_unitsNotAllowed.clear();
	}
	
	public void resetUnitsNotAllowed()
	{
		m_unitsNotAllowed = new ArrayList<UnitType>();
	}

and into MoveValidator.java (validateBasic)
// check units individually
for (final Unit unit : moveTest)
{
	for (final Territory t : route.getSteps()) // <- Start here not allowed unit check
	{
		for (final TerritoryEffect e : TerritoryEffectHelper.getEffects(t)) {
		    if (TerritoryEffectAttachment.get(e).getUnitsNotAllowed().contains(unit.getType())) {
							result.addDisallowedUnit("Not all units are allowed into " + e.getName() + " territory", unit);
		    }
		 }
	}  // <- End here not allowed unit check
	if (!Matches.UnitHasEnoughMovementForRoute(route).match(unit))
		{

Of course into map XML
<attatchment name="territoryEffectAttachment" attatchTo="mountain" javaClass="games.strategy.triplea.attatchments.TerritoryEffectAttachment" type="territoryEffect">
		<option name="combatOffenseEffect" value="infantry" count="1"/>
		<option name="unitsNotAllowed" value="armour"/>
</attatchment>
---------
Droid Rulez
Reply | Threaded
Open this post in threaded view
|

Re: Territory effects and movements

Veqryn
Administrator
I am wondering if we should do this per territory, or per territory effect

doing it per territory would allow more control i think

while doing it per territory effect might make more sense for players, and easier for map makers.  and it might also be easier to have it by territory effects if you want to change it later using triggers.

Please contribute to the TripleA 2013 donation drive:
http://tripleadev.1671093.n2.nabble.com/2013-TripleA-Donation-Drive-tp7583455.html
Reply | Threaded
Open this post in threaded view
|

Re: Territory effects and movements

crystalct
i tested that code and works correctly. It works per territory effect:
<attatchment name="territoryEffectAttachment" attatchTo="mountain" javaClass="games.strategy.triplea.attatchments.TerritoryEffectAttachment" type="territoryEffect">
		<option name="combatOffenseEffect" value="infantry" count="1"/>
		<option name="unitsNotAllowed" value="armour"/>
</attatchment>
And the check into validateBasic was easy:
if (TerritoryEffectAttachment.get(e).getUnitsNotAllowed().contains(unit.getType())) {
							result.addDisallowedUnit("Not all units are allowed into " + e.getName() + " territory", unit);
		    }
as you wonder it
---------
Droid Rulez
Reply | Threaded
Open this post in threaded view
|

Re: Territory effects and movements

Edwin van der Wal
the basic infrastructure for TerritoryEffect movement cost is there.. didn't fully implement it yet because we wanted to stabilize/test the movement-code further, which now, a year later should be fine.

Biggest difficulty is the automovementpicker-thingy (basically dragging a unit to a territory a while away and the engine calculating the optimal route) -- this is very hard to do with territory movement costs. However plotting the movement territory per territory should work fairly easy.
Reply | Threaded
Open this post in threaded view
|

Re: Territory effects and movements

crystalct
That code "unitsNotAllowed" for Territory Effect Attachment will be perfectly compatible with your work of TerritoryEffect movement cost, cause it ceck only that units  "not allowed" to enter into a a territory with a a particular effect adding them to "DisallowedUnit".

If Veqryn wants, he can add this new feauture "unitsNotAllowed" into Territory Effect Attachment.
---------
Droid Rulez
Reply | Threaded
Open this post in threaded view
|

Re: Territory effects and movements

Veqryn
Administrator
i am still debating whether it should be added to territory, or territoryeffect

i will DEFINITELY add this after the next release (next release is a stable, so we can't change game data for this release)
Please contribute to the TripleA 2013 donation drive:
http://tripleadev.1671093.n2.nabble.com/2013-TripleA-Donation-Drive-tp7583455.html
Reply | Threaded
Open this post in threaded view
|

Re: Territory effects and movements

Edwin van der Wal
Two reasons for TerritoryEffects influence movement:

1) Since territoryEffects can be added and removed with triggers it really should be on territoryEffect in my opinion.

Snow = +1 movement
NuclearWasteland = +1 movement

2) Since in most wargames Terrain = movement -- and in TA we use territoryEffects for terain it should be on territory Effect:

Mountain = +2 movement
Hills = +1 movement
Forest = +1 movement

----

Also it we probably should have a territoryConnectionEffect to influence connections between territories (Alpine-Hex-Sides, Rivers, Bridges, Fortified Borders) -- which could influence movement, attack, defense... but definately for another unstable :)

Reply | Threaded
Open this post in threaded view
|

Re: Territory effects and movements

Zim Xero
I agree.  It is still possible to negate movement to a specific territory using Edwins system:

Create a territory effect named Switzerland, for example.

Switzerland can also have any other natural territory effects, but...

Switzerland effect can then negate movement by certain units using Crystalcts method
or effectively negate movement by requiring 10 extra movement points to enter for selected units using Edwins undeveloped add-on method.

'thats the way it is' makes it neither desireable nor inevitable
Reply | Threaded
Open this post in threaded view
|

Re: Territory effects and movements

hepster
Great work

I love where this is going.
“A man can never have too much red wine, too many books, or too much ammunition”― Rudyard Kipling
12