Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! Clones, Extensions, Modding » Stars! Nova - Development » ClientState and .intel files
ClientState and .intel files Thu, 23 June 2011 16:54 Go to next message
Aeglos is currently offline Aeglos

 
Chief Warrant Officer 1
Stars! Nova developer
Stars! Nova developer

Messages: 142
Registered: May 2011
Location: Chile
I'll pioneer the first dev discussion thread to get this forum going.

This is a continuation of the discussion on the SF forums. The summary is that the client state shouldn't keep the input turn variable as it has access to a lot of things it shouldn't know. In fact, the server shouldn't even send all that information to the client in the first place, but only what the client should have access to each turn

At some point the client will also need a new mechanism of generating order files with order commands, instead of simply sending it's updated state to the server. This will probably be done later on though.

For now I will focus on reorganizing the ClientState and what the server sends to it as the longer this is unresolved, the harder it will be to correct later on. This is my last quote/proposal on the matter:

Quote:

I just renamed the RaceData class to EmpireData, as it seems more apropiate considering it doesn't hold any race data at all, but rather empire wide information such as relations and tech.

Now the more that I think about it, the more I'm convinced that we should add to the EmpireData all the relevant datastructures that the client should know about: Star Reports, Known Fleets/Fleet Reports, Met enemies&icons, designs, available components, etc. and replace all of the redundant collections in ClientState with a single EmpireData object.

This would acomplish a bunch of things which we desire; since both client & server would share this structure (Server already uses it), the server simply assembles it on turn generation with what the client has to know and nothing else and sends it through the intel file, instead of sending a rather full game state and the client cherry picking what it needs; the client would simply read it's new EmpireData and update it, no calculations at all. This also allows the Server to actually keep track of what the client knows. Currently it keeps a full global state and assembles intel files when they need to be written on a per-case basis, but it is clueless about the valid state of each client unless it does a lot of silly lookups because the data is all scaterred in 10 collections. This allows the server to know everything, and also to know what the clients should know at the beggining of each turn generation, so it can check for potential cheats and mistakes.


I think I'll just go ahead and implement this, unless someone has any remarks, ideas or objections... which if you have, please do share it so we can make the best choice and get the ClientState sorted out and move on to the server turn generation generalization.

Report message to a moderator

Re: ClientState and .intel files Thu, 23 June 2011 17:00 Go to previous messageGo to next message
Musmuris

 
Master Chief Petty Officer
Stars! Nova developer
Stars! Nova developer

Messages: 96
Registered: June 2011
I just don't know enough about how it works yet really.

I'm trying to work out if there's going to be multiple copies of the data in ServerState from what you're suggesting?

I think having this for Intel and ClientState is a plan. ServerState can write a current version into Intel from what it knows - and the client can then read and overwrite it's own state from the Intel (i.e. merge the new Intel into what it knows already)

Report message to a moderator

Re: ClientState and .intel files Thu, 23 June 2011 17:13 Go to previous messageGo to next message
Aeglos is currently offline Aeglos

 
Chief Warrant Officer 1
Stars! Nova developer
Stars! Nova developer

Messages: 142
Registered: May 2011
Location: Chile
Multiple copies to an extent, yes.

For example, the ServerState currently holds all the fleets in the game on AllFleets and seends them ALL to each player each turn. Ideally each EmpireData object (one for each player) would hold a separate collection of KnownFleets which the server populates from AllFleets during turn generation depending on what each player owns and sees with scanners, so the data would be duplicated to an extent; but the difference is that EmpireData.KnownFleets should contain FleetReports (FleetIntel? there is a naming conflict with a dialog) instead of Fleets, just as the KnownStars collection should contain StarReports instead of Star objects.

The EmpireData(s) would be assembled during turn generation for each player and sent out with what each player needs to know only, and the local copy can then be used on the next turn to check for valid orders. For example if a nasty player edits his .order file to include designs with tech he doesn't own, or magically adds a fleet of Nubians, the server just checks if those tech/fleet/star/resources were available to that player on his last sent EmpireData and validate the orders or flag as scum Twisted Evil before processing his turn.

Report message to a moderator

Re: ClientState and .intel files Thu, 23 June 2011 17:37 Go to previous messageGo to next message
evild00d is currently offline evild00d

 
Crewman 2nd Class
Stars! Nova developer
Stars! Nova developer

Messages: 14
Registered: July 2009
Location: Norway
Quote:

I just renamed the RaceData class to EmpireData, as it seems more apropiate considering it doesn't hold any race data at all, but rather empire wide information such as relations and tech.


I very much like the naming you came up with. Using empire, race and player as separate concepts makes a lot of sense to me. In theory different empires could be using the same race.

I'm just thinking out loud here, but this is how I see the relationships between these concepts and how they might work in the context of a game:

  • A game contains one or more empires.
  • An empire has exactly one race.
  • A race can be used by one or more empires.
  • An empire has zero (AI-controlled or human-controlled, but idle), one or more players (cooperative online gameplay in large scale games).
  • A player can only belong to one empire at a time.


Crazy ideas I'm sure. Just had to get it out Smile

Excellent work.

Report message to a moderator

Re: ClientState and .intel files Thu, 23 June 2011 17:49 Go to previous messageGo to next message
Musmuris

 
Master Chief Petty Officer
Stars! Nova developer
Stars! Nova developer

Messages: 96
Registered: June 2011
Ok - I get it. And yes that works for me.

What Evil suggests is also a good plan Very Happy

Report message to a moderator

Re: ClientState and .intel files Fri, 24 June 2011 07:38 Go to previous messageGo to next message
Daniel is currently offline Daniel

 
Chief Warrant Officer 3
Stars! Nova developer
Stars! Nova developer

Messages: 179
Registered: April 2006
Location: Nowra, Australia
I don't hold much store in asking before fixing something that is broken. It just takes too long. If you mess things up we can always revert to a previous version.

Of course it is good to discuss things you do not understand and get the benifit of what the other developers know. I am just saying do not be overly concerned about trying something out. That is what subversion is for.

My 2c is that your plan seems to be a logical fix for the problem.



Have fun.

Report message to a moderator

Re: ClientState and .intel files Fri, 24 June 2011 17:14 Go to previous messageGo to next message
Aeglos is currently offline Aeglos

 
Chief Warrant Officer 1
Stars! Nova developer
Stars! Nova developer

Messages: 142
Registered: May 2011
Location: Chile
On a related matter, I guess Evil or Dan can answer this:

What's the intended difference between a fleet's LongRangeScan and ShortRangeScan properties? I say intended because they are implemented the same, so both are equivalent currently. Was this for some future improvement?

I was looking for a penetrating range property and found those, but no pen range so I implemented one, but was curious nonetheless.

Report message to a moderator

Re: ClientState and .intel files Fri, 24 June 2011 18:49 Go to previous messageGo to next message
Musmuris

 
Master Chief Petty Officer
Stars! Nova developer
Stars! Nova developer

Messages: 96
Registered: June 2011
Isn't one for seeing fleets and the other for planets? (i.e. to get planet stats they must be in the short range scan?) Any fleet in longrange can be seen.

Report message to a moderator

Re: ClientState and .intel files Fri, 24 June 2011 19:24 Go to previous messageGo to next message
Aeglos is currently offline Aeglos

 
Chief Warrant Officer 1
Stars! Nova developer
Stars! Nova developer

Messages: 142
Registered: May 2011
Location: Chile
Well to see planet composition you have to either be in orbit with scanners or have pen-scanners from a distance, so I don't believe so.

They both are exactly the same algorithms based on non-pen scanner range currently.

Report message to a moderator

Re: ClientState and .intel files Fri, 24 June 2011 19:31 Go to previous messageGo to next message
Daniel is currently offline Daniel

 
Chief Warrant Officer 3
Stars! Nova developer
Stars! Nova developer

Messages: 179
Registered: April 2006
Location: Nowra, Australia
Aeglos wrote on Sat, 25 June 2011 07:14

On a related matter, I guess Evil or Dan can answer this:

What's the intended difference between a fleet's LongRangeScan and ShortRangeScan properties? I say intended because they are implemented the same, so both are equivalent currently. Was this for some future improvement?

I was looking for a penetrating range property and found those, but no pen range so I implemented one, but was curious nonetheless.


I think the short range scan == penetrating scan. No good reason I can see that it was not called a penetrating scan. I do not see any other reason for a short range scan to exist.



Have fun.

Report message to a moderator

Re: ClientState and .intel files Fri, 24 June 2011 20:28 Go to previous messageGo to next message
Aeglos is currently offline Aeglos

 
Chief Warrant Officer 1
Stars! Nova developer
Stars! Nova developer

Messages: 142
Registered: May 2011
Location: Chile
Well, removed/renamed it since it was confusing.

For future reference, the algorithm for detecting planets through pen-scans will have to be replaced eventually, as currently it has to loop every star for every fleet that can pen-scan. Late game this can get expensive.

Report message to a moderator

Re: ClientState and .intel files Sat, 25 June 2011 07:33 Go to previous message
Daniel is currently offline Daniel

 
Chief Warrant Officer 3
Stars! Nova developer
Stars! Nova developer

Messages: 179
Registered: April 2006
Location: Nowra, Australia
Aeglos wrote on Sat, 25 June 2011 10:28

Well, removed/renamed it since it was confusing.

For future reference, the algorithm for detecting planets through pen-scans will have to be replaced eventually, as currently it has to loop every star for every fleet that can pen-scan. Late game this can get expensive.


I have raised a bug to track this.



Have fun.

Report message to a moderator

Previous Topic: rev630 - failing on WinXP using MonoDevelop
Next Topic: Amount of Info on scanning enemy fleets
Goto Forum:
  


Current Time: Thu Mar 28 22:28:16 EDT 2024