Ok, I've run some test and it looks like it's working: units can reach radius+1 but if they are left there, the next turn they are being pushed back at the nearest valid plot. This trick is also working if one of your cities is razed or conquered (or, as in my experiment, volountarily gifted to another civ) and your units suddenly find themselves too far from the radius of the next nearest city: these units get bumped back to the nearest valid plot again. But there's a catch: until now, I've made possible for units to explore beyond their allowed radius if they travel on paths/roads/etc; but if a unit is traveling on a road when the nearest city is lost, it does not get bumped back because a road IS a valid plot. So it might become stuck there. It might be annoying but it also makes interesting scenarios: in my case I gifted my city to another civ and then I signed open borders with them. So my unit that was stuck on that road had a chance to travel inside other civ's borders, but not to leave them except for those tiles where a road was present.
So here's how it's working right now:
there's a base radius you can set via XML(currently 3), it's centered on your city closest to the unit; this radius increases with mapsize so it's Duel 3, Tiny 4, Small, 5, Standard 6, Large 7, Huge 8, Giant 9, Gigantic 10. Your units can reach radius+1 but when they do so they get bumped back on next turn to the nearest valid plot. When you discover Alphabet, radius is doubled and when you discover Charters radius is tripled. When you reach Navigation, there's no radius anymore (techs can be set via XML). You can move on any tile inside the radius, on any tile inside your empire (regardless of radius), on any tile with paths/roads/etc (regardless of radius), on any tile belonging to a civ you have open borders with (regardless of radius), on any tile belonging to a civ you are at war with (regardless of radius).
While working on this code, I started considering what would happen if I changed the mechanic of the "hard wall" bumping you back to one where you simply take damage if you are outside of the radius. I see some problems with this but maybe they can be solved. First, units that don't take damage like settlers and workers should not be allowed to explore freely, they should still have this kind of hard wall, or they should be killed instantly when crossing the border. I prefer the former solution because you might inadvertently cross the border and lose a settler, which might be quite annoying. Second thing is the interaction with Terrain Damage. If you play with Terrain Damage off, you should still take damage from crossing the movement limit which looks kind of strange, but might be acceptable. Third, there might be issues with AI sending units to death but since AI knows how to deal with Terrain Damage, I'm not too worried. At least I'm not if using both Movement Limits AND Terrain Damage. I don't know what might happen if I use Movement Limits but Terrain Damage is switched off, or if it can be solved with a workaround in the code to make AI aware of the danger of exploring too far even if Terrain Damage is switched off.
So, what do you think? Opinions? Movement Limits as described above is anyway currently working and ready for release, unless I discover some bug in my next test.
Edit: one more thing, should I allow water units to move further? Like doubling their radius for each step? Should caravans or spies or explorers also have their radius doubled? It would be easy to code. On the other hand, I would avoid messing with promotions.