FreeOrion

Forums for the FreeOrion project
It is currently Sun May 19, 2013 2:02 pm

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: XMLEncode visibility
PostPosted: Sun Jun 29, 2003 5:15 pm 
Offline
Space Squid

Joined: Thu Jun 26, 2003 12:09 pm
Posts: 95
Location: Chicago
Just a note, all of the XMLEncode() functions should take an empire ID since universe and empire data will be encoded differently for each empire so the encoder will need to know who this message is going to.

Just to rehash, the visibility rules are:

--At the start only the home system is fully visible to a player. All other systems have a location, a name, and a star type.

--After a player has explored a system, that system is fully visible for the remainder of the game.

--Enemy fleets are only visible when in hyperspace towards a player's planet.

--Empire info will be full for the player's empire, for the others will just show name, color, and control status.

Explored system and visible fleet data for an empire is maintained in the Empire object. They are updated during movement, when the player's fleet explores a new system, and any time a fleet is moving toward a system controlled by another player (this is checked each turn as the ownership of the system may change while the fleet is in hyperspace).

_________________
Programming Lead


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 29, 2003 6:13 pm 
Offline
Creative Contributor

Joined: Thu Jun 26, 2003 4:33 pm
Posts: 226
Location: Baltimore, MD
I would suggest overloading XMLEncode.
One overload can take no parameters and do a complete encoding,
the other can take an empire ID parameter.

_________________
Empire Team Lead


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 29, 2003 6:15 pm 
Offline
Programming Lead Emeritus
User avatar

Joined: Thu Jun 26, 2003 1:33 pm
Posts: 1092
jbarcz1 wrote:
I would suggest overloading XMLEncode.
One overload can take no parameters and do a complete encoding,
the other can take an empire ID parameter.


I agree. This sounds like the way to go.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 29, 2003 6:16 pm 
Offline
Space Squid

Joined: Thu Jun 26, 2003 12:09 pm
Posts: 95
Location: Chicago
Will do.

_________________
Programming Lead


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 29, 2003 7:05 pm 
Offline
Creative Contributor

Joined: Thu Jun 26, 2003 4:33 pm
Posts: 226
Location: Baltimore, MD
Actually, since the Emipre manager is not a singleton,
you will probably want to just pass a const reference to an empire.
If you just send an ID you need a manager to look up the empire object in.

_________________
Empire Team Lead


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 29, 2003 7:15 pm 
Offline
Space Squid

Joined: Thu Jun 26, 2003 12:09 pm
Posts: 95
Location: Chicago
I'm just doing the universe side of things. I'll leave that to you :D

_________________
Programming Lead


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 29, 2003 8:05 pm 
Offline
Space Squid

Joined: Thu Jun 26, 2003 12:09 pm
Posts: 95
Location: Chicago
Ok, I just committed all of the default (full encoding) XMLEncodes for universe. For your enjoyment you can drop the following code into server/ServerApp.cpp in the GameInit() function, then build and run the server:

using GG::XMLElement;
ServerUniverse* uni = new ServerUniverse();

uni->CreateUniverse(ClientUniverse::IRREGULAR, 50, 4, 2);

XMLElement element = uni->XMLEncode();

GG::XMLDoc uni_upd;

uni_upd.root_node.AppendChild(element);
Message * mes = new Message(Message::TURN_UPDATE, 1, 2, Message::CLIENT_UNIVERSE_MODULE, uni_upd);

Logger().debugStream() << mes->GetText();


I'm hoping to do the to do the overloaded version tonight, but I've got a lot of crap to do today, so tomorrow might be a better bet...

_________________
Programming Lead


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 30, 2003 1:19 am 
Offline
FreeOrion Lead Emeritus
User avatar

Joined: Thu Jun 26, 2003 6:23 am
Posts: 883
Location: Australia
The system being fully visible...what does that mean regarding colonisation of planets? If another player colonises a planet in a system I've explored but am not present at, does that mean that I will know and be able to see?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 30, 2003 3:03 am 
Offline
Space Squid

Joined: Thu Jun 26, 2003 12:09 pm
Posts: 95
Location: Chicago
tyreth wrote:
The system being fully visible...what does that mean regarding colonisation of planets? If another player colonises a planet in a system I've explored but am not present at, does that mean that I will know and be able to see?


That is correct. You won't see fleets stationed there, but everything else is visible. This is probably not optimal, but it's awfully easy to code, and we can let the designers decide whether we want some more complicated fog of war system... Incidentally I believe this is the same system moo3 uses.

_________________
Programming Lead


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 30, 2003 3:46 am 
Offline
FreeOrion Lead Emeritus
User avatar

Joined: Thu Jun 26, 2003 6:23 am
Posts: 883
Location: Australia
Ultimately I think we will want it to only provide an update when you have a scout there.

Since the client stores its own local copy of what it knows this shouldn't be hard should it? The server simply doesn't send an update of the system unless the empire has a valid scout in the system (or proper radar if we have such a technology). Not too important for 0.1, but maybe worth keeping in mind.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group