[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4752: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4754: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4755: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4756: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3887)
Master of Magic - Implode's Multiplayer Edition • View topic - thoughts on program design

thoughts on program design

Place to report bugs in MoM IME and suggest ideas for enhancements (please read rules before posting)

thoughts on program design

Postby Virm » 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.
Virm
 
Posts: 63
Joined: Sat Sep 23, 2006 3:54 pm

Re: thoughts on program design

Postby Implode » Mon Sep 22, 2008 1:15 am

User avatar
Implode
Site Admin
 
Posts: 432
Joined: Fri Feb 24, 2006 3:35 am
Location: Newfoundland, Canada

Re: thoughts on program design

Postby Virm » Fri Sep 26, 2008 5:11 am

you're right, I'd totaly spaced off the idea of 'memory' from the fog.

In that case, would it be cheaper (in terms of memory/processing) to just keep a different stack/list/set/hashmap/etc. listing units, cities, and other dynamic map info for each player? then you could just update that structure whenever a player actually sees something new or different and just read from it for the fog areas. Areas not explored wouldn't be a problem because the player hasn't seen anything there yet so there's nothing added to the 'memory' structure in those areas. Similarly, this would prevent a player from 'seeing' a new city appear in the fog, as the city was never in actual sight and was never listed in the 'memory' structure.

Immediately prior to this sentance I was going to suggest that each item in the 'memory' structure could just be a reference/pointer to the unit involved, but then I ralized that that would allow a player to track the experience/health/growth of arbitrary field units of the enemy, regardless of their real position. I suppose that means that the 'memory' structure would need to contain actual copies of the objects from the time they were actually seen at that location. And to properly implement such a structure would mean allowing the possibility for a single actual unit to appear multiple times within the structure. This may mean using that last bit-combination in the aforementioned map structure being used to determine if a unit/object/other was seen at that location and must be looked up in the 'memory' object.

having such a 'memory' construct would also (I think) be a very efficient way for the AI to do a lookup for any potential threats/targets based on the last known forces in a particular place or direction. The only tricky bit in that regard may be inventing a heuristic to have the AI inteligently 'guess' at what location a unit is actually at when an identical unit shows up multiple times in the same general area of the 'memory' map.

one possible way to cut down on the memory used by the addition of object clones to the 'memory' structures would be to make something like a memory_item structure and only keep info in it that would actually be available when trying to look at those remembered objects. Again though, I don't know if this is actually a reasonable thought or if persuing it would be pure folly at this point.
Virm
 
Posts: 63
Joined: Sat Sep 23, 2006 3:54 pm


Return to Bug reports and ideas for enhancements

Who is online

Users browsing this forum: No registered users and 1 guest

cron