It is currently Mon Dec 18, 2017 8:58 am

All times are UTC + 9:30 hours




Post new topic Reply to topic  [ 21 posts ] 
Author Message
 Post subject: Converting COs to external data
PostPosted: Wed Dec 24, 2008 2:16 am 
Offline
Main Coder

Joined: Fri Apr 04, 2008 10:50 pm
Posts: 169
Could somebody explain me what this means?
Inside Alexander.java
Code:
        String[] TagCOsx = {"Olaf", "Sasha", "Hachi", "Von Bolt"}; //Names of COs with special tags
        String[] TagNamesx = {"Iron Fist", "Perestroika", "Dual Strike", "Dual Strike"}; //Names of the corresponding Tags


Each co overwrites the tagCOsx value. what does it do?
It seem to link an co with a tagName and a tagName is some kind of action that they can perform?

Another thing what do these do?
String hitx = "Peace"; //Holds the hit
String missx = "Cruelty"; //Holds the miss

holds the hit, what can a co hit, other cos?
or is it when they did something successfully they will display the text 'Peace' and when they fail they say cruelty?

as you may notice, I don't know much about cos, maybe somebody that does should externalize the classes.

It seems that a co has a set of powers it can execute, but what is the relation with the other co(tagCosx)

This is what I got
Code:
<?xml version="1.0"?>
<!DOCTYPE COS [
  <!ELEMENT COS         (CO*)>
  <!ELEMENT CO (ID,NAME,BIO,TITLE,SKILL_DESC,
  POWER_DESC,SUPER_POWER_DESC,INTEL_DESC,
  POWER_QUOTES,VICTORY_QUOTES,ACTIVED_QUOTES)>
  <!ELEMENT ID         (#PCDATA)>
  <!ELEMENT NAME      (#PCDATA)>
  <!ELEMENT BIO          (#PCDATA)>         <!--Holds the condensed CO bio -->
  <!ELEMENT TITLE       (#PCDATA)>
  <!ELEMENT SKILL_DESC (#PCDATA)>
  <!ELEMENT POWER_DESC (#PCDATA)>
  <!ELEMENT SUPER_POWER_DESC (#PCDATA)>
  <!ELEMENT INTEL_DESC (LINE*)>         <!--Holds the CO intel shown on the CO select screen -->
  <!ELEMENT POWER_QUOTES (LINE*)>      <!--Quotes that the CO uses when activating their CO Power -->
  <!ELEMENT VICTORY_QUOTES (LINE*)>     <!--Quotes that the CO uses when victorious -->
  <!ELEMENT ACTIVED_QUOTES (LINE*)>   <!--Quotes that the CO uses when activated -->
  <!ELEMENT LINE (#PCDATA)>   
]>
<COS>
   <CO>
   <ID>0</ID>
   <NAME>Adam</NAME>
   <BIO>A researcher-turned-commander of Jade Cosmos, Adam Deckster is a reclusiven geek who nevertheless is slowly finding a place among the other commanders</BIO>
   <TITLE>Pin-point Dexter</TITLE>
   <SKILL_DESC>Adam's units finish off units that are within luck range. Whenever he destroys an enemy unit, the attacking unit gains a defense boost. However, Adam's units lose firepower as they lose HP.</SKILL_DESC>
   <POWER_DESC>All of Adam's units gains a firepower boost. Whenever Adam destroys a unit, he can choose a unit. That unit gains bonus firepower and bonus movement.
   </POWER_DESC>
   <SUPER_POWER_DESC>
   Each time Adam destroys an enemy unit, the attacking unit loses firepower and can move again, while Adam can select and powerup another one of his units.
   </SUPER_POWER_DESC>
   <INTEL_DESC>
   <LINE>Adam's units gain maximum luck if</LINE>
   <LINE>maximum luck would finish off the</LINE>
   <LINE>enemy. His units also gain defense</LINE>
   <LINE>after destroying an enemy. Adam's</LINE>
   <LINE>powers allow him to grant firepower</LINE>
   <LINE>to specific units</LINE>
   </INTEL_DESC>     
   <POWER_QUOTES>
   <LINE>Get a hobby? This is my hobby!</LINE>
   <LINE>Woo! Watch out for shrapnel!</LINE>
   <LINE>Precision pays off!</LINE>
   <LINE>As my troops approach their limit...you become insignificant!</LINE>
   <LINE>Prepare to have your strategy debunked!</LINE>
   <LINE>I'll blind you with science!</LINE>
   </POWER_QUOTES>
   <VICTORY_QUOTES>
   <LINE>Call it bad luck, if you must.</LINE>
   <LINE>Who said math had no applications in real life?</LINE>
   <LINE>Ha! The revenge of the nerds!</LINE>
   </VICTORY_QUOTES>
   <ACTIVED_QUOTES>
   <LINE>Vector 32 degrees into the wind, velocity at...</LINE>
   <LINE>Clean up your shirt! Brush your hair! Let me take care of things!</LINE>
   </ACTIVED_QUOTES>
   </CO>
</COS>

This file would contain all the static data of a co.
I think the behavior should best be in scripts.


Last edited by stef569 on Wed Dec 24, 2008 2:30 am, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: Converting COs to external data
PostPosted: Wed Dec 24, 2008 2:24 am 
Offline
User avatar

Joined: Tue Oct 28, 2008 8:51 am
Posts: 121
That is their tag power: http://advancewars.wikia.com/wiki/CO_powers
Sometime in the next few weeks you should to get your hands on all the AW games to try them out as you'll obviously have to be very well versed in order to design derivitives :)


Top
 Profile  
 
 Post subject: Re: Converting COs to external data
PostPosted: Thu Dec 25, 2008 5:18 am 
Offline
User avatar

Joined: Fri Jun 23, 2006 5:43 am
Posts: 9754
Location: CW's SQL database
Ah!
I used to fool around with the code inside the CO data - I did a lot of ingame language translations.
Code:
        String[] TagCOsx = {"Olaf", "Sasha", "Hachi", "Von Bolt"}; //Names of COs with special tags
        String[] TagNamesx = {"Iron Fist", "Perestroika", "Dual Strike", "Dual Strike"}; //Names of the corresponding Tags

"Tagging" is a new mechanic introduced in Advance Wars: Dual Strike. Pretty much it's a CO tag-team. This concept is abundant in fighting games but not so much TBS games. Think of a game like Marvel VS Capcom or Tekken Tag Tournament.
When both CO meters were full (as you'd fill one bar, tag out and fill out the other), you could pull off a Tag Break [US: Dual Strike] that allows you to get two turns with each CO, so for example

>Select "Tag" from the menu
Animation plays. OH BOY SCOP, and the two show up on the screen. In Alex and Olaf's case, you'd see "Iron Fist" show up. That's just the name.
Alex uses Peace Demonstrations (his SCOP)
Animation plays, Olaf comes in, all units can move a second time (like Eagle's COP)
Olaf uses Snow White (whatever his SCOP was)
Turn ends after Olaf moves all units.
Additionally, a string is underneath those two
Code:
String[] TagValuex = {"120", "110", "80", "90"};

This is the tag's firepower bonus. A CO has 100/100 (100% attack, 100% defense)
Olaf and Alex, when using their tag power would have an extra 20% firepower during their turns.

Tricky, I guess. >:

So, it works like
"Tagging CO"
"Tag Name"
"firepower bonus"

As for
Quote:
Another thing what do these do?
String hitx = "Peace"; //Holds the hit
String missx = "Cruelty"; //Holds the miss

holds the hit, what can a co hit, other cos?
or is it when they did something successfully they will display the text 'Peace' and when they fail they say cruelty?

In the Advance Wars games (including Days of Ruin, I think), in the CO's profile screen (which shows the bio, a long description of their CO Powers, and firepower bonuses), underneath the CO's biography, there would be
:hit: and :miss: . These are pretty much likes and dislikes.
i.e.
:hit: Peace. Alex hates wartime, so he prefers peaceful conditions after wartime.
:miss: Cruelty. When someone violates the Geneva Convention, Alex gets pissed off.

It's easier with a CO like Lash, a spoiled brat:
:hit: Getting her way
:miss: Not getting it

It's pretty much trivial info that we just loved about the older games. x3

_________________
Image


Top
 Profile  
 
 Post subject: Re: Converting COs to external data
PostPosted: Thu Dec 25, 2008 10:43 pm 
Offline
Main Coder

Joined: Fri Apr 04, 2008 10:50 pm
Posts: 169
Thanks for the full explanation Kosheh!

I had to read that 2 times before I started to understand it, I've only played AW2 the first version. Just 1 co and when the stars are ready you launch the power/super power that is enough for me :D

I never played Marvel VS Capcom or Tekken Tag Tournament :oops:
I see hit and miss is just text not behaviour, but why the trailing x?

We are moving co data outside of the classes, would you like to add some(say 5 of your favourite cos) cos to the xml above? you can keep it simple for now, can always add complex things later(tagging is very complex! :lol: ).


Top
 Profile  
 
 Post subject: Re: Converting COs to external data
PostPosted: Thu Dec 25, 2008 11:41 pm 
Offline
User avatar

Joined: Fri Jun 23, 2006 5:43 am
Posts: 9754
Location: CW's SQL database
ohgeez don't ask me these type of technical questions ;____;

I'm guessing they probably have the trailing x because they're accompanied by an image on the profile screen, which is actually the image used in AW2 lol.

Image

eh Vimes was a pretty efficient coder so I just trust his coding trickery lol

As for moving it, I think you're trying to make a good point that even someone who can't code will be able to make a CO in this game >:3
I'll see what I can do because I actually helped set up the original CO.java classes by plugging in data around the forums. But not today. It's Christmas. ;_;

_________________
Image


Top
 Profile  
 
 Post subject: Re: Converting COs to external data
PostPosted: Sun Dec 28, 2008 9:30 pm 
Offline
User avatar

Joined: Tue Oct 03, 2006 6:00 am
Posts: 320
Location: Scotland
Actually, the trailing x is there so it does not get confused with the variables in CO.java. If you look further down the Alexander class you were looking at, you will find a block of code like this:

CObio = CObiox;
title = titlex;
hit = hitx;
(etc.)

CObio is a variable in CO.java, and has the value of CObiox copied to it. I am not quite sure why the values were not assigned straight to the variables in CO.java, so if you want more info, go ask someone who has been around for longer.


Top
 Profile  
 
 Post subject: Re: Converting COs to external data
PostPosted: Fri Feb 06, 2009 3:18 am 
Offline
Main Coder

Joined: Fri Apr 04, 2008 10:50 pm
Posts: 169
What does a co change in the game:
The final cost subtracted from the moving unit
Fog
Add Extra funds to cities, change costs to buy units, capturing, immune for some weathers, extra terrain defense
Quote:
//deal with perfect movement
if(u.getArmy().getCO().hasPerfectMovement() || u.isPerfectMovement())moveCost = 1;

//COs with piercing vision can see through woods/reefs
if(armies[i].getCO().isPiercingVision())

So we have to pass the active player CO to all these functions and then alter the value it normally would return.

add a multiplier.

Quote:
if(u.getArmy().getCO().hasPerfectMovement() || u.isPerfectMovement())
moveCost = 1;

Could be changed to
Code:
int calcTotalMoveCost() {
  return validateBetweenZeroMax(totalMoveCost + co.getMoveMultiPlier());
}

So all cos return 0 for co.getMoveMultiplier()
a co with perfect move will return -999
validateBetweenZeroMax(50-999) will change that to 0. We want 1 so this won't work.


Last edited by stef569 on Fri Feb 06, 2009 3:25 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Converting COs to external data
PostPosted: Fri Feb 06, 2009 3:24 am 
Offline
Main Coder

Joined: Fri Apr 04, 2008 10:50 pm
Posts: 169
Let the co calculate the value
Code:
int calcTotalMoveCost() {
  return co.getMoveCost(totalMoveCost);
}

The co with perfect movement can now ignore the totalMoveCost and just return 1. Other cos can add a multiplier whatever the co handles it.
The co should do as much of the calculation as possible.

Quote:
tdef = (int)(tdef * u.getArmy().getCO().getTerrainDefenseMultiplier());
tdef -= this.getArmy().getCO().getEnemyTerrainPenalty();

Code:
Could be:
tdef = co.getTerrainDefense(terrainDefense);

where the co checks
if it has a terrainPenalty and if it is within enemy territory
subtract the terrain defense multiplier and then return the result.
Quote:
//COs with piercing vision can see through woods/reefs
if(armies[i].getCO().isPiercingVision()){
fog[x+l][y+k] = false;
}

could be
Code:
boolean isFogged = co.canFog(Location location)

This allows to add a co by adding 1 line.

Conclusion:
Cos change return values of in game functions by adding hooks to their own logic. The default co function will just return the input or a default value. cos overwrite these.
adding a co hook should only need 1 more line. ie
Quote:
tdef = (int)(tdef * u.getArmy().getCO().getTerrainDefenseMultiplier());
tdef -= this.getArmy().getCO().getEnemyTerrainPenalty();
if(tdef < 0)tdef = 0;

Code:
int calcTerrainDefense() {
 int terrainDefense = map.find(u).getTerrain().getDef();
 return co.terrainDefenseHook(terrainDefense);
}


Top
 Profile  
 
 Post subject: Re: Converting COs to external data
PostPosted: Sat Feb 07, 2009 10:09 am 
Offline
Main Coder

Joined: Fri Apr 04, 2008 10:50 pm
Posts: 169
I've been thinking about pulling the cos out of the engine and into a plugin, and the best way seems to dynamically load the cos from a folder, then in the game reference them by name. Where each co implements an interface, somebody actualy proposed this in the releases topic.
the engine should work without a co, so an EmptyCo will be used instead of null it will return default values.

plugin/officers/
Alexander.java
SomeOtherName.java

loading cos:
for each java class in officers
load and store by file name

in the engine:
cos.get("alexander").getDefense(defense);
when they do their power they probably are going to change the game completely
cos.get("alex").doPower(game)

the engine is now decoupled from actualy co inplementations.

This means that each co needs to be compiled, do we want to interpretet the co files instead
Allowing changes at runtime? The changes are minimal.


Top
 Profile  
 
 Post subject: Re: Converting COs to external data
PostPosted: Sun Feb 15, 2009 3:32 am 
Offline
User avatar

Joined: Fri Jun 23, 2006 2:44 am
Posts: 1226
Location: X, Y, Z
Yes.

That way when the game is running at any point I can set Alex's defense bonus to 10000 in the file and change his power to be:

Code:
public void beforeAttack(whatever given parameters it used to have)
{
    if(cop || scop)
    {
        target.damage(target.getHP(), true);
    }
}


Or whatever equivalent there will be for your interpreted language =]


Top
 Profile  
 
 Post subject: Re: Converting COs to external data
PostPosted: Sun Feb 15, 2009 1:47 pm 
Offline
User avatar

Joined: Fri May 04, 2007 3:18 am
Posts: 520
lol... Maybe I'd seriously have to consider just compiling all the important data within the .jar file. Any mod that you'd do to the CO's would be yours only. Of course, you can just recompile the file yourself with your own changes. No matter what, if you want to cheat and make a SUPER CO, you get to cheat regardless. Ah, how I love open source programming....

Maybe we can reduce it to .txt files with another extension, like... (.co) files for CO's or something? However, I think the problem with that was we couldn't write equations within the .txt files... Wait, what am I talking about again?

-JSR...


Top
 Profile  
 
 Post subject: Re: Converting COs to external data
PostPosted: Sun Feb 15, 2009 5:33 pm 
Offline
User avatar

Joined: Tue May 08, 2007 6:19 am
Posts: 1363
While it's not possible to completely eliminate the possibility of cheating a good replay system should mitigate this somewhat.


Top
 Profile  
 
 Post subject: Re: Converting COs to external data
PostPosted: Sun Feb 15, 2009 7:27 pm 
Offline
User avatar

Joined: Fri Jun 23, 2006 2:44 am
Posts: 1226
Location: X, Y, Z
JakeSamiRulz wrote:
lol... Maybe I'd seriously have to consider just compiling all the important data within the .jar file. Any mod that you'd do to the CO's would be yours only. Of course, you can just recompile the file yourself with your own changes. No matter what, if you want to cheat and make a SUPER CO, you get to cheat regardless. Ah, how I love open source programming....

Maybe we can reduce it to .txt files with another extension, like... (.co) files for CO's or something? However, I think the problem with that was we couldn't write equations within the .txt files... Wait, what am I talking about again?

-JSR...

I do believe the Serializable interface of some of the classes are there to make sure that the classes in use are the correct version. If that were not the case, I still believe there is some version checking being done internally for CW one way or another, because (in the past) new versions of CW refused to play games that started from older versions, and old versions of CW refused to play games that started from new versions.

Of course, that was for the java classes portion of CW; when stuff like the damage tables were externalized ppl could screw things up pretty good (if they wanted to).


Top
 Profile  
 
 Post subject: Re: Converting COs to external data
PostPosted: Sun Feb 15, 2009 10:12 pm 
Offline
Main Coder

Joined: Fri Apr 04, 2008 10:50 pm
Posts: 169
JakeSamiRulz wrote:
lol... Maybe I'd seriously have to consider just compiling all the important data within the .jar file. Any mod that you'd do to the CO's would be yours only. Of course, you can just recompile the file yourself with your own changes. No matter what, if you want to cheat and make a SUPER CO, you get to cheat regardless. Ah, how I love open source programming....

Maybe we can reduce it to .txt files with another extension, like... (.co) files for CO's or something? However, I think the problem with that was we couldn't write equations within the .txt files... Wait, what am I talking about again?

-JSR...

You are trying to hide data, to prevent cheating but when are we concerned about cheating when playing against other fellow human players.
using client/server the server validates using it's own data. Server can run on lan/inet. The data is now hidden from the client.
If the client tampered with the data, ie units can move 20 instead of 4 then the server will reject it.

Quote:
While it's not possible to completely eliminate the possibility of cheating a good replay system should mitigate this somewhat.
Narts I don't understand that sentence, replay is just the events that happened during a game, how is that related to cheating?


Top
 Profile  
 
 Post subject: Re: Converting COs to external data
PostPosted: Mon Feb 16, 2009 6:31 am 
Offline
User avatar

Joined: Fri Jun 23, 2006 2:44 am
Posts: 1226
Location: X, Y, Z
stef569 wrote:
You are trying to hide data, to prevent cheating but when are we concerned about cheating when playing against other fellow human players.
using client/server the server validates using it's own data. Server can run on lan/inet. The data is now hidden from the client.
If the client tampered with the data, ie units can move 20 instead of 4 then the server will reject it.

I'm assuming this means you'll be saving complete user mods on the server side, because the server would need that information to validate user inputs. If so I think that's a bad idea because players can make tons of user mods (at most one unique mod per game, but I'm not sure how you plan on storing user mods) and stuff up your server. If the user mods will be saved to the server side, then removed when a game is done, that's no good either because games can still take a long time to finish, and that would still lead to your server being potentially stuffed up. If you require players to finish games in one fully connected session so that user mods don't stay on the server too long, that's no good because players can lose connections at any point or have other things to do at the moment, making games end abruptly or prematurely. And since you are using the server to validate user inputs, what point would there be in allowing changes at run time?

If you were going for a client/server relationship with your main game and not for all potential user mods, then that would make sense because you have specific rules and behaviors you can check, and all you'd have to do is save current game state data per game on the server (instead of unique instances of rules + behaviors + data). If for user mods you were going for a client/server relationship with one of the players (likely the initial game host) acting as the "server" in your above example, and not using some central server for that task, that would make more sense than having a central server deal with user mods.

But, in case I have been making too many assumptions or am not understanding something, please clarify.

stef569 wrote:
Narts I don't understand that sentence, replay is just the events that happened during a game, how is that related to cheating?

If there is any cheating involved then a replay should be able to reproduce the cheating, or the replay will fail to move forward at some point because cheating caused the game to exceed its intended limitations.


Top
 Profile  
 
 Post subject: Re: Converting COs to external data
PostPosted: Mon Feb 16, 2009 8:03 am 
Offline
Main Coder

Joined: Fri Apr 04, 2008 10:50 pm
Posts: 169
I explained the server here we are still discussing mods, but I think I can say that modding will be changing a value in a file in for now 1 directory.
So server handles 1 game type, stores 1 game type.

Quote:
And since you are using the server to validate user inputs, what point would there be in allowing changes at run time?

This would be usefull for debugging purposes on the client only: Like typing co_ALEX.doSuperPower() to test the visual effect, reloading all resources when you edited a file, make a unit orientation north to test the up animation, change an ai state,... like a console in other games.


Top
 Profile  
 
 Post subject: Re: Converting COs to external data
PostPosted: Tue Feb 17, 2009 2:54 am 
Offline
User avatar

Joined: Tue May 08, 2007 6:19 am
Posts: 1363
stef569 wrote:
Quote:
While it's not possible to completely eliminate the possibility of cheating a good replay system should mitigate this somewhat.
Narts I don't understand that sentence, replay is just the events that happened during a game, how is that related to cheating?


Examining a replay of a game is a way of detecting impossible situations that couldn't arise without cheating. While it wouldn't be very useful against moderate RNG or FoW cheating, it would be pretty much failproof in a completely abstract mod (complete knowledge, no luck factors). Though it would be pretty hard cheating in such a game anyhow lol.


Top
 Profile  
 
 Post subject: Re: Converting COs to external data
PostPosted: Tue Feb 17, 2009 6:02 am 
Offline
User avatar

Joined: Fri Jun 23, 2006 2:44 am
Posts: 1226
Location: X, Y, Z
stef569 wrote:
I explained the server here we are still discussing mods, but I think I can say that modding will be changing a value in a file in for now 1 directory.
So server handles 1 game type, stores 1 game type.

So this is what I understand reading your server proposal:
1. The server stores one game mod and one game state per established game.
2. Games do not persist beyond one fully connected session; if one or more players disconnect or leave then the game ends and is deleted.
3. Players can choose to have the game state be saved, and the server will automate this process (if for example, 5 hours of inactivity have passed), but doing so will not extend the life of the game beyond one fully connected session.
4. Game mods only support data modification.
5. Game mods are uploaded once to the server at the start of a game, and do not change for the remainder of the game.

Would the above be correct?

stef569 wrote:
This would be usefull for debugging purposes on the client only: Like typing co_ALEX.doSuperPower() to test the visual effect, reloading all resources when you edited a file, make a unit orientation north to test the up animation, change an ai state,... like a console in other games.

I suspect that you'll have two different implementations for dealing with game mods then? One for the debugging case that you have listed above, and another that reads game mod data from external sources once and does not read again in case the external sources were modified.


Top
 Profile  
 
 Post subject: Re: Converting COs to external data
PostPosted: Tue Feb 17, 2009 8:07 am 
Offline
Main Coder

Joined: Fri Apr 04, 2008 10:50 pm
Posts: 169
Thanks for showing so much interest in my server proposal CoconutTank :wink:
I'll do my best to answer your questions.

CoconutTank wrote:
So this is what I understand reading your server proposal:

1. The server stores one game mod and one game state per established game.
A game state is saved after time out or user request let's refer to that as saved games(map + players, current turn,...)
Each game is for 1 game mod (we used the word plugin).

Storing a plugin for each saved game is going to eat alot of space, if we will have more then 1 plugin then they would be loaded from a dir with the name of the plugin.
plugins/adhocswars/unitData.xml
plugins/dor/unitData.xml
we would store that data once...

Constructing java objects from the xml allows to read any xml that we support I mean we read data but the values may change over different plugins.
Atm that is all that plugins will be able to change.
using xstream mapping an object to xml and back is done in 7 lines

2. Games do not persist beyond one fully connected session; if one or more players disconnect or leave then the game ends and is deleted.
First I try to define 'fully connected session'
A connection would be a client logged in to the server, being in a chat lobby maybe...
Session would be the length of time that a client is on the server, if he drops but the session is still there then the server won't drop the client.

Games are always saved, just as in cw1. But in order to change a game you need to load a saved game from xml - > java objects
when a server model changes then the changes are sent to the connected clients in that game, if they are connected.
When a disconnected client logs in and wants to make his turn then he has an old model so he downloads the saved game(like cw1) and makes his moves.
This allows for
#1 Online play ie 4 people online can play very fast(no downloading of saved games, just tiny network messages)
#2 Disconnected play ie user1 logs in makes moves disconnect, 1 week later....
user2 logs in downloads saved game makes moves disconnect... 5 weeks later....
suggestions for better names then online play and disconnected play?

3. Players can choose to have the game state be saved, and the server will automate this process (if for example, 5 hours of inactivity have passed), but doing so will not extend the life of the game beyond one fully connected session.
see 1

4. Game mods only support data modification.
To simplify things Yes but we'll keep mod support(external java code) in mind while coding.

5. Game mods are uploaded once to the server at the start of a game, and do not change for the remainder of the game.
if you mean data changes in the files(ie giving a unit more vision) then that is uploaded once when the server starts. Server define the rules not the clients.

I hope your questions are answered


Top
 Profile  
 
 Post subject: Re: Converting COs to external data
PostPosted: Tue Feb 17, 2009 9:07 am 
Offline
User avatar

Joined: Fri Jun 23, 2006 2:44 am
Posts: 1226
Location: X, Y, Z
stef569 wrote:
Thanks for showing so much interest in my server proposal CoconutTank :wink:
I'll do my best to answer your questions.

Glad to see you are enjoying my questions thus far.

stef569 wrote:
A game state is saved after time out or user request let's refer to that as saved games(map + players, current turn,...)
Each game is for 1 game mod (we used the word plugin).

Pardon my terminology then.

stef569 wrote:
Storing a plugin for each saved game is going to eat alot of space, if we will have more then 1 plugin then they would be loaded from a dir with the name of the plugin.
plugins/adhocswars/unitData.xml
plugins/dor/unitData.xml
we would store that data once...

So would the following plugins be possible? And I'm assuming the plugins will be saved on the server?

plugins/adhocwars_0.0.1/unitData.xml
plugins/adhocwars_0.0.2/unitData.xml
plugins/adhocwars_0.1.1/unitData.xml
plugins/adhocwars_1.0.3/unitData.xml
plugins/dor_v1.A.001/unitData.xml
plugins/dor_v1.A.002/unitData.xml
plugins/dor_v1.A.003/unitData.xml
plugins/cts_bad_game001/unitData.xml
plugins/cts_bad_game002/unitData.xml
plugins/cts_bad_game512/unitData.xml
plugins/cts_super_bad_game/unitData.xml
plugins/aw_tower_defense/unitData.xml
plugins/aw1_campaign/unitData.xml
plugins/aw2_hard_campaign/unitData.xml
plugins/server_spam_mod001/unitData.xml
plugins/server_spam_mod002/unitData.xml
plugins/server_spam_mod003/unitData.xml
plugins/server_spam_mod004/unitData.xml
plugins/server_spam_mod005/unitData.xml
plugins/Xq9128ASDAffa/unitData.xml
plugins/faHS147t900193/unitData.xml
plugins/ASD19goas409HLK/unitData.xml

stef569 wrote:
Constructing java objects from the xml allows to read any xml that we support I mean we read data but the values may change over different plugins.
Atm that is all that plugins will be able to change.
using xstream mapping an object to xml and back is done in 7 lines

Oh that sounds pretty nifty I guess =) I think objectOutputStream still has some use though, specifically because the files it produces are mostly unreadable by humans, therefore mostly uncustomizable for humans, which I would think is a preferred quality for saved games.

stef569 wrote:
First I try to define 'fully connected session'
A connection would be a client logged in to the server, being in a chat lobby maybe...
Session would be the length of time that a client is on the server, if he drops but the session is still there then the server won't drop the client.

Sorry, what I meant by 'fully connected session' is that all players are present and connected online for the game they are playing. So saved games will persist, even when the players are not online to actually play? (I guess that question is answered in the next paragraph)

stef569 wrote:
Games are always saved, just as in cw1. But in order to change a game you need to load a saved game from xml - > java objects
when a server model changes then the changes are sent to the connected clients in that game, if they are connected.
When a disconnected client logs in and wants to make his turn then he has an old model so he downloads the saved game(like cw1) and makes his moves.
This allows for
#1 Online play ie 4 people online can play very fast(no downloading of saved games, just tiny network messages)
#2 Disconnected play ie user1 logs in makes moves disconnect, 1 week later....
user2 logs in downloads saved game makes moves disconnect... 5 weeks later....
suggestions for better names then online play and disconnected play?

So would it be unreasonable to believe that players would return to a game within:
5 hours time?
2 day's time?
1 week's time?
1 month's time?
Half a year?

Assuming server model means whatever information it had stored for a game, including its related plugin...

Why would the server's model change? So can an APC get attack damage values while a multiplayer game is in progress? Could damage against infantry change to 0 for all units that fire on infantry while a multiplayer game is in progress? Would that mean I can change the plugin that a multiplayer game is using?

I don't think any names need to be given for differentiating online play and disconnected play, unless you mean online multiplayer and local single player or something.

stef569 wrote:
To simplify things Yes but we'll keep mod support(external java code) in mind while coding.

Ok, that sounds fine I guess.

stef569 wrote:
if you mean data changes in the files(ie giving a unit more vision) then that is uploaded once when the server starts. Server define the rules not the clients.

Uh, right, that's exactly what I mean. That only happens once right? Refer to the question I have about why the server's model should change for why I brought that question up.

stef569 wrote:
I hope your questions are answered

Somewhat. I have some more questions now though.


Top
 Profile  
 
 Post subject: Re: Converting COs to external data
PostPosted: Tue Feb 17, 2009 10:43 am 
Offline
Main Coder

Joined: Fri Apr 04, 2008 10:50 pm
Posts: 169
CoconutTank wrote:
Pardon my terminology then.

It's ok,I'm trying to keep word definitions over at the glossary.

CoconutTank wrote:
So would the following plugins be possible? And I'm assuming the plugins will be saved on the server?

plugins/adhocwars_0.0.1/unitData.xml
plugins/adhocwars_0.0.2/unitData.xml
plugins/adhocwars_0.1.1/unitData.xml
plugins/adhocwars_1.0.3/unitData.xml
plugins/dor_v1.A.001/unitData.xml
plugins/dor_v1.A.002/unitData.xml
plugins/dor_v1.A.003/unitData.xml
plugins/cts_bad_game001/unitData.xml
plugins/cts_bad_game002/unitData.xml
plugins/cts_bad_game512/unitData.xml
plugins/cts_super_bad_game/unitData.xml
plugins/aw_tower_defense/unitData.xml
plugins/aw1_campaign/unitData.xml
plugins/aw2_hard_campaign/unitData.xml
plugins/server_spam_mod001/unitData.xml
plugins/server_spam_mod002/unitData.xml
plugins/server_spam_mod003/unitData.xml
plugins/server_spam_mod004/unitData.xml
plugins/server_spam_mod005/unitData.xml
plugins/Xq9128ASDAffa/unitData.xml
plugins/faHS147t900193/unitData.xml
plugins/ASD19goas409HLK/unitData.xml

Well, your fantasy about plugin names has been proven I haven't seen illegal chars, your point?
If you are trying to show a list of dirs that have been added by a spam bot/user -> There will be no user upload plugin to the server functionality, it's restricted to admins.
Yes they are possible and y on the server.

CoconutTank wrote:
stef569 wrote:
Constructing java objects from the xml allows to read any xml that we support I mean we read data but the values may change over different plugins.
Atm that is all that plugins will be able to change.
using xstream mapping an object to xml and back is done in 7 lines

Oh that sounds pretty nifty I guess =) I think objectOutputStream still has some use though, specifically because the files it produces are mostly unreadable by humans, therefore mostly uncustomizable for humans, which I would think is a preferred quality for saved games.

lol, if you've been parsing xml files using dom(even with helper methods and using XPath) then you appreciate the 7 lines conversion.
It does put fields to null when you leave it out of the xml, while my custom xml parsing would put it on "" oh well.

You are probably right about the saved game should not be human readable, not able to read the wrong 'game save version' might even be useful
But if I change a field name in the Map class then it's a new version right? So we have to add a VERSION_UID to each class(related to saved games -> all classes) and change the number when the old saved games should no longer work.

Sorry, what I meant by 'fully connected session' is that all players are present and connected online for the game they are playing. So saved games will persist, even when the players are not online to actually play? (I guess that question is answered in the next paragraph)
Yep.

CoconutTank wrote:
So would it be unreasonable to believe that players would return to a game within:
5 hours time?
2 day's time?
1 week's time?
1 month's time?
Half a year?

any time span < 8 months will do
> 5 hours -> server requires a login(because session time out)
> 8 months -> purge game(s)

CoconutTank wrote:
Assuming server model means whatever information it had stored for a game, including its related plugin...
Why would the server's model change? So can an APC get attack damage values while a multiplayer game is in progress? Could damage against infantry change to 0 for all units that fire on infantry while a multiplayer game is in progress? Would that mean I can change the plugin that a multiplayer game is using?

Assuming server model means whatever information it had stored for a game, including its related plugin...

No! plugin data is Static and is only stored in a plugin directory Once, it cannot be Changed it's Final =)


CoconutTank wrote:
Why would the server's model change?

Each game has a live representation using java objects == server model, so in a game there is a APC unit, the active client can change that server model. When the game is not live it needs to be loaded from the saved game file.

CoconutTank wrote:
So can an APC get attack damage values while a multiplayer game is in progress?

'get attack damage values' ie can an apc unit in multiplayer mode be attacked? receive damage?
Yes, that's the idea
if the client sends ie /attack 0 0 1 1 and 0 0 contains an infantry and 1 1 an apc unit then it will get attacked(if it's valid of course)

CoconutTank wrote:
Could damage against infantry change to 0 for all units that fire on infantry while a multiplayer game is in progress?

co's can do that in 1 game(but please don't start about those), for all games -> not unless somebody changes the plugin data+reloading them.

If a game is saved then we won't store all the attributes
stuff like (name, description, vision) are static the game won't/can't change them
so we just load those using the unit ID from the plugin data ie a unit data file might contain
Id = 1
name = 'Tank'
vision = 5
desc='very fast'
Id=2
name='Inf'
vision = 1
desc'needed to expand our land'

Quote:
stef569 wrote:
if you mean data changes in the files(ie giving a unit more vision) then that is uploaded once when the server starts. Server define the rules not the clients.

Uh, right, that's exactly what I mean. That only happens once right? Refer to the question I have about why the server's model should change for why I brought that question up.

I'll try to write it down better:
A plugin dir contains game data, this is uploaded once(by an admin)
If the server starts, it reads the data and stores them into memory(don't want to parse them over and over)
When we need info about a unit we reference it by using the unitID to retrieve the unit in memory loaded from the plugin.
When we need a new unit, we create a deep copy of the unit in memory

stef569 wrote:
I hope your questions are answered

Somewhat. I have some more questions now though.[/quote]
Lol that's ok, keep em coming, I may of repeated myself in answering above... as long as it is not a contradiction...


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

All times are UTC + 9:30 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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:  
Blue Moon by Trent © 2007
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group