thoughts on program design
Posted: Sun Sep 21, 2008 12:15 am
With absolutely no intention to tread on toes, Implode, I suddenly had a few thoughs on the design of IME (based on the last information in the forums about it that I remember) and wanted to run them by you to take, shoot down, or to do with whatever you please.
overland map and fog-of-war:
Quite some time back when you were rewriting everything to make the work right, there was a lot of discussion on how best to store the data and how it should be handled by the server and clients. I can't for the life of me recall what (or if) you said was the design you used for the current product and I can't seem to find it on the forums now.
It occured to me that what might be most efficient and secure (vs client-side hacking and the like) would be to maintain exactly one full copy of the world map and some structure holding the units and cities (and other things not part of the landscape) in a map-position indexable way. An alternative to the structure containing all units would be having a matrix or array of shorts or ints, the array/matrix being 1-to-1 in size with the map, and the values being a reference to a list of unit stacks/cities/etc. roaming the world. You could then have a bitfield or byte array/matrix assigned to each player, where each map square only need 2 bits to be represented.
0 = not explored
1 = explored, fog-covered (send map data only)
2 = currently visible (also send unit/stack data)
3 = (not used, possibly treat as 0? or use for additional option I may have forgotten)
Doing this would (I think) reduce memory overhead from needing to store the complete map multiple times, and would let the server send to the clients only those parts of the map which each client should receive, without any possibility for client-side tamper.
Having now typed all of that, I'm sure there was something else I'd though of, but I can't remember it at the moment. Will post it later if I think of it again.
overland map and fog-of-war:
Quite some time back when you were rewriting everything to make the work right, there was a lot of discussion on how best to store the data and how it should be handled by the server and clients. I can't for the life of me recall what (or if) you said was the design you used for the current product and I can't seem to find it on the forums now.
It occured to me that what might be most efficient and secure (vs client-side hacking and the like) would be to maintain exactly one full copy of the world map and some structure holding the units and cities (and other things not part of the landscape) in a map-position indexable way. An alternative to the structure containing all units would be having a matrix or array of shorts or ints, the array/matrix being 1-to-1 in size with the map, and the values being a reference to a list of unit stacks/cities/etc. roaming the world. You could then have a bitfield or byte array/matrix assigned to each player, where each map square only need 2 bits to be represented.
0 = not explored
1 = explored, fog-covered (send map data only)
2 = currently visible (also send unit/stack data)
3 = (not used, possibly treat as 0? or use for additional option I may have forgotten)
Doing this would (I think) reduce memory overhead from needing to store the complete map multiple times, and would let the server send to the clients only those parts of the map which each client should receive, without any possibility for client-side tamper.
Having now typed all of that, I'm sure there was something else I'd though of, but I can't remember it at the moment. Will post it later if I think of it again.