Author Topic: Walls and gates  (Read 861 times)

MirceaKitsune

  • Technician
  • ****
  • Posts: 147
    • View Profile
Walls and gates
« on: 20 May 2013, 18:57:14 »
Glest Advanced added this feature some time ago for Magitech factions. You have the ability to build continuous stone walls, and if I remember right you can also add a gate which only allies can walk through. Walls are harder to destroy but it's possible to attack individual segments. I'd like to see MG and its faction having this ability as well. Maybe it can be ported from Glest Advanced... if not perhaps implemented from scratch. Not sure how difficult it would be, but wanted to drop this suggestion here as well.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Walls and gates
« Reply #1 on: 23 May 2013, 02:32:51 »
GAE didn't actually implement walls. They started it, but no working implimentation was completed. The wall was declared a wall with a new property tag in the XML, but all that did was make the building not count as a building (so you don't have to destroy all walls to win the game) and made the AI ignore the walls (building wise). However, the two most crucial parts of the implementation were never made: the AI does not know how to build walls (can't just be placed at random, they must be built in a direction the enemy will come from) and the AI must know how to deal with walls on the offense (walls should never be attacked unless there are no other enemies nearby and there's no easy way past the wall). Gates were not implemented and would be more difficult.

If walls and gates are implemented, I think the Age of Empires approach would be the best one. That means walls would require an endpiece and centerpiece, and would be built in rows. MegaGlest's tile system doesn't really allow for diagonal units, so walls would be limited to 90 degree angles (which is okay). Gates are a bit harder. They'd need an open state and a closed state, which should be two separate commands. Instead of defaulting to a stop skill, they'd default to either the open or closed skill (depending on which state is currently active). For aesthetics, a transition skill should exist, allowing animations of opening and closing the gate. Alternatively, we could treat the gate similar to the die skill, and play the animation, then keep the model on the last frame of the animation (ie, an open or closed gate).

I would think that the AI would be the trickiest to implement. The AI's pathfinder would have to decide if they can reach the enemies inside of walls within a reasonable number of steps. If that's not the case, then and only then should walls and/or gates be attacked (presumably gates would be weaker than walls, but that's up to the modder's implementation). Teaching the AI to build a gate effectively seems a lot harder. I'd presume they'd have to use the pathfinder to figure out where entrances to their base are and put gates there, then build gates in a line until the pathfinder cannot find ways to escape the base. The pathfinder would also need to be able to understand how to use gates (ie, gates can be opened to pass through).

Overall, it's a feature that could add much in terms of strategy, but it'd also be very complex, requiring modifications to several aspects of the code, not to mention mod support. I personally do, however, think that we should consider implementing walls and gates at some point of time.

On a side note, walls would go well with a garrisoning/carrying units feature (something that GAE did actually implement).
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

MirceaKitsune

  • Technician
  • ****
  • Posts: 147
    • View Profile
Re: Walls and gates
« Reply #2 on: 23 May 2013, 09:13:07 »
Agreed. This would be pretty difficult due to the AI, which would need awareness under complex circumstances. Making gates open and close might be possible rather simply I imagine. As for how to make the walls, the wall system could just loop the wall pattern in a straight line (any of the 4 directions) and use a special model for corners. But yeah, can tell it wouldn't be easy... hopefully someday though.

 

anything