In my opinion this would spice up the gameplay quite a bit, and add more suspense and strategy to the mix. But on the technical side, it might be complicated to find a correct implementation. Here's my idea:
Each faction would have the ability to train spy units. Such units would have a special feature: They can appear as an own unit to the faction they're spying for. For instance, if Player 1 (red) trains a spy against Player 2 (blue), P2 and all enemies of P1 see it as P2's unit (blue color) and will attempt to attack / not attack it accordingly, while P1 and his allies see it correctly (red color) or have another way of knowing it's P1's spy. Covered spies must never auto-attack the enemy they're spying for, but right clicking any enemy unit should attack as normal. Spies can be used to enter the enemy's territory and explore it, allowing the player to see their enemy's setup. Also, when a spy is ready to blow its cover (more on that below) they can do some damage and take the enemy by surprise.
Obviously, there should be ways to blow a spy's cover. This should happen if the spy gets in a fight with the faction they're spying for (regardless of who attacks first). Additionally, there could be anti-spy buildings or units. If a covered spy gets too close to one his cover is blown. Blown cover means the spy turns back into a normal unit which can be seen and attacked like all others. I'm not sure when and how spies should be infiltrated / masked... this should probably work similar to morphing but under more strict conditions. A spy that's been deconspired should also be unable to re-disguise itself for a few minutes.
Sadly there would be a lot of technical difficulties to making this possible. Those are the ones I'm aware of:
- What happens when the player who sends the spy is of a different faction from the player being spied? If for instance P1 is Magic and P2 is Tech, P1 would quickly notice one of their units is a magic unit although they are tech. Only solution is for each faction to have their infiltrated spies look like one of their units (have the same model). For magic that could be the mage, for tech that could be the worker or swordsman, etc. They should look the same but not have the same abilities... so if a covered spy looks like a mage it doesn't mean it can gather resources or attack with magic.
- What if a faction clicks an enemy spy and tells it to go somewhere? Even worse, what if it tells it to attack or gather resources? If the spied player notices an unit (seemingly theirs) won't respond to commands, it's obvious they're a covered spy. We could allow masked spies to be controlled by both their real owner and the faction they're infiltrated with, in which case the owner has priority (if both factions click for the spy to go somewhere). But what if the spy looks like a worker yet is visibly unable to gather resources and build... or looks like a soldier but can't attack? I guess this could be another way to deconspire them.
- Considering that Player 1 is on one side of the map and Player 2 on the other side. P1 sends a spy over to P2, which means he has to walk all the way from one end to the other. Unless P2 is really stupid or not paying attention, he notices an unit of their own walk from one point to the other, either on the minimap and in the world. They know they haven't sent anyone there, so it would raise obvious questions. This too would need some thinking.
Due to those difficulties I'm not hoping we'll see this happening, at least not anytime soon. But it would be really fun if it could. I'm reminded of a very old RTS game I used to play back when I had my first modern computer, which I think was called Populous. At some point you could produce spy units, which were able to enter the enemy's base and set fire to buildings (but once they did they were deconspired).