This is probably the biggest post I've ever made.
Clarification: All these special things do not affect how you move your units around; any special instances for the AI are only guidelines that make up for the fact that it cannot make decisions as you and I do. This is to say that if you want to, for instance sit your unit on quicksand until dead, you can and it will not attempt to escape, but the AI will never stop a unit on anything that can hurt them. Also, none of these entities can be attacked with any unit.
Quicksand
Quicksand doesn’t necessarily have to be called quicksand; I would probably rather call it muck. But you get the general idea. The idea is that you can only stand on it a certain amount of time before you will be sucked in completely. I would recommend that a unit of height value of 1 take 3 seconds to be sucked in, and by the way, once you are sucked in it should count as a death. Also the amount of time it takes to be sucked in should be multiplied by the unit’s height value. For instance a unit with height value of three should take 9 seconds to die in the quicksand, height value of 2 takes six seconds, etc. There should also be an animation for the ground so it looks kind of like quicksand. This could be similar to what open ocean looks like, but a bit less obvious, so the waves and ripples should be smaller. Another feature of this quicksand or muck, whatever you want to call it, is that every second, until the maximum amount of time the unit could be in the quicksand, the unit’s move and animation speed is only 90% of what it was the second before. This is to make it a bit more realistic, and so the only way quicksand or muck would hurt you is if you stopped your troops on a patch of it. In addition, time in quicksand carries over to the next tile, so if you walk into a patch of quicksand, your speed degenerates per second until you get out. Another thing is that a unit whose size value is greater than the size of the patch of quicksand is immune to any quicksand patches smaller than it. For instance, if a unit is size value 2 (2x2) then a patch 1x3 or 1x2 should not even effect it. This is to add a bit of realism; if you were standing on a half a 100 cm squared of quicksand, you would not fall in would you? Also, the AI pathfinding algorithm would have to change a bit (or is it just the AI in general?) that a unit would not stop on quicksand; this applies to situations where the unit is being attacked. Thus when a unit is on quicksand, the first priority of the unit is to get off ASAP. Second priority then is to ward off attackers. Also, the AI should not build buildings on or closer than 2 tiles away from the quicksand. Since the quicksand is not randomly generated, but is optional to the maker of the map, there should be no problems with quicksand on a base. Another more complicated option would be to set zones where quicksand could occur in the new map editor. Inside the zones, quicksand could occur at set frequency; this way no two maps would be exactly alike. Also, different zones could have different frequencies of it, so maybe along a river it is more common than 50 tiles away, for instance. These zones, of course, would exclude the bases. I personally think the zone option is preferable.
Poisonous Things
Poisonous things would be similar to quicksand in many ways. But the biggest differences are that the poisonous things take away HP per second, (as opposed to quicksand hurting you only once your unit has sunk completely into it) and they only effect mobile units; thus buildings are not affected. There could be various types of poisonous things in the map. They would have specific models that they could be, similar to how a tree can be various different, but similar, models. Most would probably look like bushes though. The way they work is for every second you are standing on them, they take away certain amounts of your HP, until you are at 0 HP, when your unit dies. This is not to say that an object will attack the same way as another unit; armor only helps you half as much as it would against a normal unit, and different types of armor all behave in the same way. The algorithm for this is: ((damage-(armor/2))*seconds). Hopefully that makes it clearer; you may observe that the type of armor is not factored in, and the damage is lessened by the amount of armor you have, but less than against a normal unit. These poisonous things would be walkable, and thus only affect you if you are standing or walking over them. Different ones could be varyingly poisonous too. For instance one almost harmless plant may take away a raw amount of 50 per second; (raw meaning that it hasn’t had any armor subtractions from it) a more dangerous plant may take away 150 or 200 per second, but these would be rarer. This goes back to the zones I spoke of earlier because you would manually input the rarity or frequency of any said type of poisonous thing. I’m leaning towards most, if not all of the poisonous things being plants; this is because I cannot think of any other type of poisonous thing at the moment. The AI for poisonous things would act very similar to that for quicksand. But since the poisonous things only effect mobile units, the AI should probably feel free to build buildings on the poisonous things, except the builder/worker unit has to make sure not to be standing on any while building! If the unit has no other choice other than to stand on the poisonous things while building, then the building cannot be built. If the building does somehow get built though, a unit’s first priority is to get off the poisonous things and second priority is to carry out the action it would have carried out before. While moving, the unit should do everything it can to avoid the poisonous things. While the unit is attacking, though, if to get to another tile it is 5 or fewer tiles out of the way (extra distance) then the unit should take the long route. But any distance greater than 5 tiles, the unit just goes over the poisonous things. I think the ratio 5:1 is good for this instance while attacking.
Enchanted Plants
Enchanted plants are most similar to the poisonous things. The difference is that they behave (attack) more similar to a unit because they have a range, and have attack types. For instance a “whipping willow†might have a range of 2, and be slashing type. Also, they do not take HP away per second, but they attack just like a normal unit. I should say that the fashion that the attack is calculated is exactly the same as the way damages are calculated in unit v. unit fights. Enchanted plants would always be immobile though. Since you could not attack them, there would be no reason to give them any armor type either. I think it would be most appropriate to have these enchanted plants placed on maps using the zone method. We need a new map editor anyways. The way that the AI would behave would be very similar to that of poisonous things, except to stay at least five tiles away from them if possible, and never to stop while you are being attacked by one. Enchanted plants would be similar to poisonous things also because they cannot affect buildings. The pathfinding would be the same as with poisonous things in that they would avoid moving within 5 tiles of any enchanted object while simply moving. While attacking, we have to use the ratio again. But since enchanted plants can hurt you more than poisonous things could, the ratio would be more like 10:1. That is moving within the range of the enchanted plants only if it will save you ten tiles per enchanted plant there is. For attack types, there could be emanations as well, which behaves exactly the same as in GAE. One more thing about enchanted plants is that they are not passable or walkable.
Healing Objects
Healing objects are the exact opposite as with poisonous things. These can emanate with a greater range though, because poisonous things can only hurt you if you are standing on them. Unlike poisonous things, healing objects are not walkable. They are placed on the map in exactly the same manner as with the enchanted plants, poisonous things, and quicksand. This is using the top feature I hope to see in the new map editor: zones. These would also not effect buildings, only units. The AI would take this into account. They would attempt to build buildings no closer than two tiles to the healing objects. This is so injured units can access the healing objects. All injured units would attempt to go to the healing objects, but not in the way that some ultras do it. The ring of units around the healing objects should be no greater than 1 tile thick so that once the unit is healed it can do something else. Also, units shouldn’t go to the healing objects unless they are not doing any other task (that is, stopped) and not unless they are actually damaged. If a unit sees an enemy, they should attempt to get within the healing aura of the healing object and then attack. But if the unit has no attack, then it should move away. Also, if there is resources near the healing object, it would be smart for the AI to start a village there.
Mines
Mines are totally different than the last four. They cannot be attacked, but that’s pretty much the only similarity. They are walkable, and are defined in the faction, so in that case they wouldn’t necessarily be mines unless that is what it was really called. For instance in the Tech faction there could be a bear trap, for my Undeads I was thinking of a hand that pops out of the ground. A mine is built by the player, and is a one-time only thing. They would take a set amount of HP every time they are sprung, and this is independent of any other factors that the unit may have. So if the bear trap takes away 900 each time, then it takes away 900 each time, thus independent of any factors. The question is then whether or not the unit will be killed, or just mangled. I guess I forgot to mention it, but different types of mines may take away different amounts of different stats. Applicable stats are move speed (for move speed, it would also be that much percent slower anim speed), armor, HP, EP, HP regen, (although this would be more of an absolute thing; you would set what you want the regen to be once the unit is a victim. In this way, you could set the unit’s HP regen to negative numbers!) and another move speed one that freezes you in place for 30 seconds. The AI for the mines would be a little more interesting. It would not be able to see mines at all, and would then end up walking over them. The AI would also never build mines anywhere farther than 10 tiles away from any building. In this way, mines are another special type of defense.
Portals
The concept of a portal is pretty simple. Portals take you from one place to another. Portals are another thing totally different from anything previously mentioned. They are not placed using the zone method, but are deliberately placed in places that make for an interesting game. Portals have to be placed in pairs, and there can be a maximum of six pairs of portals per map. This way, portals can be color coded with red, orange, yellow, green, blue, and purple. The color coding makes the game simpler because every portal takes you to its partner. The model of the portal can be defined in the tileset, but all portals are of one tile radius. Again, no portal can be attacked, but they can be blocked. This is very easy, since every portal can only expel units onto one tile in front of it; for this reason, there needs to be a capability in the map editor to rotate these portals. I think that portals add another dimension of strategy to the game because the shortest distance to your base is no longer a straight line. You can guard the portals or ambush units that come through them. A possible bug though would be that even though you can walk through the portals, you cannot attack anything by way of the portals, or it would look really dumb. The AI’s pathfinding would have to have a major revamp too. Because you want the AI to take the shortest path possible, you have to make the AI compute whether it is shorter to take the portal route or the normal route (the one that doesn’t include the portal). A solution to this would be to have the AI access whether or not the distance to travel is more or less than 50 tiles away, because you wouldn’t save that much time by taking the portal route anyhow. If the distance is greater than 50 tiles than it’s OK to access which route is longer. The AI also should be instructed to keep a fraction of its military near each portal of its knowledge, and that’s its more important to keep military near portals that are closer to the base. Another important calculation is that if the portal is more than a third of the map away from any of its bases, then it isn’t important to guard at all. Otherwise, it will continue to send fractions of its military to portals that another AI dominates, or one that a human dominates, which is really lame. Also when leading what is called “huge attack†I think in the AI code, the AI should NOT use portals, because that could easily kill off its entire attack by the units getting picked off.
Cliffs
Cliffs are the biggest reason why a new map editor is absolutely necessary. Cliffs have an interesting behavior in that they create a one-way path; you cannot climb up cliffs, but you can jump down. There is, however, an HP penalty for doing so. The calculation in terms of lost HP is as follows: ((height difference)*100) where the height difference is the distance from the peak of the cliff to floor of the cliff. This is totally different from normal landscape; in normal landscape you can walk everywhere with no penalty on HP as long as your unit is attacked. But with cliffs you can only go in one direction, and with a HP cost. This way you can chase workers off cliffs! There should be a special texture for the sides of cliffs, and for the edge; that way you know it’s a cliff. A map maker will have to watch out for situation in which units will be trapped; these are not preferable! In later versions of Glest and/or GAE maybe there could be a possibility of building ladders so that you can go up the cliffs, and you can go down with no HP sacrifice. The ladder method would be slower to go up and down the cliffs, but again, it has benefits. The AI pathfinding would have to be altered slightly more to accommodate cliffs. The AI would “know†whether it would have to go down a cliff to get to a certain point, and if so, would find the spot which would be the smallest drop, and thus take away the least damage. Otherwise there’s no reason that the AI should have to go down a cliff and take damage if it doesn’t have to. Also, it should be not allowed to build a building half on a cliff and half dangling over the edge. In addition, another feature of cliffs is that you cannot attack “up†the cliff, but you can most definitely attack units down the cliff. This means that the units that can jump down the cliff can attack the units that are below them; those that cannot get at them. Also when at the edge of a cliff, your range is increased by ((difference in heights)*5)% so if the difference is one tile, your range will be increased by about 3%, but if the difference in heights is 10, the unit’s range is increased by a whopping 50%! In the future, there could also be a feature where you can push someone else’s unit off of the cliff, thus they will suffer damages. For now, though, the AI needs to be taught that it should stay away from the bases of cliffs, and that it is better to take the on-the-cliff route instead of the possibly shorter base-of-cliff route, because the units on top of the cliffs can attack you.