Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! 2.6/7 » The Bar » Stars 3
Re: Stars 3 Sun, 08 June 2014 11:33 Go to previous messageGo to next message
skoormit is currently offline skoormit

 
Lieutenant

Messages: 665
Registered: July 2008
Location: Alabama
mrvan wrote on Sun, 08 June 2014 03:41
Interesting! Now why would they do that...?

Is that a behaviour we would want to mimic?


They do that most likely because storing actual floating point values came at a premium cost 20 years ago, and this was a reasonable compromise. Its a fine shortcut for things that cost more than 100 resources.

I see no reason to mimic it. The Humanoids have gained a couple elec levels in the last 20 years...




What we need's a few good taters.

Report message to a moderator

Re: Stars 3 Sun, 08 June 2014 14:20 Go to previous messageGo to next message
XAPBob is currently offline XAPBob

 
Lt. Commander

Messages: 957
Registered: August 2012
mrvan wrote on Sun, 08 June 2014 15:35
I think the sensible way is to build it using the tech of the level it is finished in. From what I see in the freestars source code, that is also how they do it.

So in your example, you spend 60 res on your scout, next turn it has remembered 60 resources, and you get it for free. We should check to make sure that you don't get free resources, ie cost is minimized to amount spent already.



I'm not so sure (logically)

After all 60 resources spent last year only built half the ship, so no more resources shouldn't magically complete it.

otoh percentages are a bit rough at various points.

Suggesting a fixed price contract of builds isn't too arduous, it only affects things that are left part built between turns (generally only one ship per world, even if in a run of 1000 ships)

Report message to a moderator

Re: Stars 3 Sun, 08 June 2014 14:25 Go to previous messageGo to next message
mrvan is currently offline mrvan

 
Officer Cadet 1st Year

Messages: 220
Registered: May 2014
What does the current stars! code do? Because I'm pretty sure that freestars stores the # of spent resources.

I guess the bugs with percentage rounding as recently reported and the known bug with building an empty starbase to 99% and then editing in the components suggests that stars! does actually store percentage complete.

Then again, this is one of those places where I wouldn't really mind deviating from stars! behaviour, especially because of those known bugs; but maybe storing %complete as a float is good enough, and it certainly seems to be the option with the least amount of representational requirements.

Report message to a moderator

Re: Stars 3 Sun, 08 June 2014 14:57 Go to previous messageGo to next message
mrvan is currently offline mrvan

 
Officer Cadet 1st Year

Messages: 220
Registered: May 2014
I was bored Smile. So I played around with HTML5 canvas / kinetic js (something I have zero experience with) to produce a first stab at an interface:

http://vanatteveldt.com/uploads/stars.html

You can zoom and drag around the 'universe'. Planet pop and owner are indicated. Click on a planet to get planet info. That's all for now Smile

Do any of you have actual HTML5 canvas experience?

Another question: I now store planets/fleets in a list in the universe (mainly because dict ('object') keys have to be strings. This makes a lot of lookups necessary, so I'm inclined to move them to a dict, with the id as key (which then becomes a string, but that might be better in some cases, e.g. to guarantee fleet design uniqueness we can use a UUID or player_designid schema. This would drop the "get_planet" etc codes from tools and from the js. What do you think?

Report message to a moderator

Re: Stars 3 Sun, 08 June 2014 14:57 Go to previous messageGo to next message
XAPBob is currently offline XAPBob

 
Lt. Commander

Messages: 957
Registered: August 2012
%age as a fp would be ok, but I wonder if 4 integers (IBGr remaining) isn't more "real" and as easy, or even easier.

Report message to a moderator

Re: Stars 3 Sun, 08 June 2014 15:11 Go to previous messageGo to next message
mrvan is currently offline mrvan

 
Officer Cadet 1st Year

Messages: 220
Registered: May 2014
IBGr remaining is difficult since you would need to rescale that as tech progresses. Otherwise, having completed 1% of an order would actually be a penalty if tech progresses enough to be noticeable (esp. with BET).

So I think the real choice is between % complete (as float or as integer 1 .. 10000 or whatever) or IBGr spent.

Report message to a moderator

Re: Stars 3 Sun, 08 June 2014 15:34 Go to previous messageGo to next message
XAPBob is currently offline XAPBob

 
Lt. Commander

Messages: 957
Registered: August 2012
Yes, that's my point. You buy stuff on a fixed pricecontract when you start. It's certainly easier to deal with than any deltas during construction.

Report message to a moderator

Re: Stars 3 Sun, 08 June 2014 15:40 Go to previous messageGo to next message
mrvan is currently offline mrvan

 
Officer Cadet 1st Year

Messages: 220
Registered: May 2014
Well, since we neither really want to penalize tech gain (fixed price beforehand) nor magnify if (saving towards last-turn price) I guess we should do the percentage complete, storing it as either float or fixed decimal. Agree?

Report message to a moderator

Re: Stars 3 Sun, 08 June 2014 15:49 Go to previous messageGo to next message
XAPBob is currently offline XAPBob

 
Lt. Commander

Messages: 957
Registered: August 2012
That's almost certainly right.

I suggest an accurate percentage, then rounded down to the nearest kT/res each turn?

Report message to a moderator

Re: Stars 3 Mon, 09 June 2014 07:38 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
Sounds good. I'd store percentages as integers later to be divided by 100 or 1000. Sherlock


So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Stars 3 Sat, 19 July 2014 18:55 Go to previous messageGo to next message
Shadow Whist is currently offline Shadow Whist

 
Chief Warrant Officer 2

Messages: 167
Registered: August 2003
Location: Vancouver, WA

I really like a number of the ideas captured in this thread. Especially, using python to build a stars engine, using JSON for interfacing, using Github and open source collaboration + licensing. One thing that I do not think is a good idea is passing (and storing) data within the engine using JSON. I have drawn up a diagram showing the objects within the game engine.

https://drive.google.com/folderview?id=0B71KUAkKytR0NVd3dEtm ZFRJQmc&usp=sharing

I think this might be a better approach, one I am planning on exploring.

- SW

Report message to a moderator

Re: Stars 3 Sat, 19 July 2014 20:08 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
Shadow Whist wrote on Sun, 20 July 2014 00:55
I do not think is a good idea is passing (and storing) data within the engine using JSON.

I'd rather use CSV myself, at least for some large tables, but JSON looks like a good compromise if we want everyone to be able to code for something close to their favorite structures. Teleport

I don't see in your nice little diagram how each object/structure would be stored/passed? Sherlock



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Stars 3 Mon, 21 July 2014 02:00 Go to previous messageGo to next message
Shadow Whist is currently offline Shadow Whist

 
Chief Warrant Officer 2

Messages: 167
Registered: August 2003
Location: Vancouver, WA
As far as CSV vs JSON goes, I am assuming that you don't care too much about how the game engine interacts with the data. Your preference is to see the CSV in the "Client UI" side of things. It seems like translating JSON to CSV would be a fairly straightforward solution.

Regarding storing/passing data:

  • Saving the game files to the host hard disk - my initial thought is to use pickle. This is a standard python module for serializing object data to and from a byte stream.
  • Storing data inside the game file - The diagram doesn't really show the connections so I will make some modifications. My thought was that a 'game object' was closely tied to the "Order of Events: Engine." They work hand-in-hand. The player(n) objects are held in a list; the planets are held in list/dictionary; and the fleet objects are held in a dictionary.
  • Passing data inside the game file -

    • The Host will take the JSON file (the updated player.x file) and update the relevant lists/dictionaries.
    • The order of events/Engine will search the 'game object' where the various object lists are stored. When a relevant object is found, the object's methods or Engine's method could be used to change/update the game state.


        Most likely, there will be a mix of both. For example: movement of a space object (packet) would be defined in the space object class as a method. If it reaches its destination, the packet class information is in a packet class method. The engine or packet class may need to notify the relevant planet instance that it received a packet and update surface minerals or reduce population (which are methods in the planet class).




-SW

Report message to a moderator

Re: Stars 3 Mon, 21 July 2014 12:22 Go to previous message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
Shadow Whist wrote on Mon, 21 July 2014 08:00
I am assuming that you don't care too much about how the game engine interacts with the data.

As long as it's fast and simple, not really. Rolling Eyes


Quote:
Your preference is to see the CSV in the "Client UI" side of things.

I was thinking more about fleet & planet data, which tends to come in large structured lists. Lurking


Quote:
Saving the game files to the host hard disk - my initial thought is to use pickle.

You sure that won't be overkill? Also, it needs to be portable across clients/systems. Teleport


Quote:
My thought was that a 'game object' was closely tied to the "Order of Events: Engine." They work hand-in-hand. The player(n) objects are held in a list; the planets are held in list/dictionary; and the fleet objects are held in a dictionary.

Yeah. Something like that. A 'dictionary' sounds like something JSON could handle well. Sherlock


Quote:
The engine or packet class may need to notify the relevant planet instance that it received a packet and update surface minerals or reduce population (which are methods in the planet class).

That sounds a lot more OO than what I had in mind. But hey, whatever pulls your ship, as long as it can be kept flexible enough for future stages. Cheers


[Updated on: Mon, 21 July 2014 12:23]




So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Previous Topic: Stars! on a tablet ??
Next Topic: Replacement needed.
Goto Forum:
  


Current Time: Tue Apr 23 21:05:39 EDT 2024