Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! Clones, Extensions, Modding » Stars! Extensions » Stars Core Engine
Stars Core Engine Thu, 30 October 2014 04:05 Go to next message
Shadow Whist is currently offline Shadow Whist

 
Chief Warrant Officer 2

Messages: 167
Registered: August 2003
Location: Vancouver, WA
This is a project I have been working on for a few months.

https://github.com/jurlaub/StarsCoreEngine



Revised StarsCoreEngine Internal Structure:
https:// docs.google.com/drawings/d/1rE61lFW4LO713llX9rlSGZ4sUVmTcOb8 _4Co501PzH0/edit?usp=sharing

Possible Stars! game structure that includes the StarsCoreEngine
https:// docs.google.com/drawings/d/1aE9Fp3Aul-DSjEzRmPvZQcCKjugAvtQS Q83G45UGQnA/edit?usp=sharing




While I hate the idea of 'abandoning' the other stars! efforts and beginning (yet Another!) stars project, it seems like it needs to be done. (Hopefully, it is not too late! Shocked ) Considering the past, I believe a new approach is needed. I really liked a number of ideas from the Stars 3 topic found in the Bar. From that discussion, I derived the following:


  • Developer time is at a premium so use Python for development
  • Build the core engine (i.e. limit project scope)
  • Use JSON to communicate outside the core engine



Considering that a project like this is similar to undertaking one to three large universe stars games - (say 12 Gates, Rabid Weasels in a Box II-b, and Diadachi Wars II Rolling Eyes ) - I want to make it as simple and easy as possible. I think Python allows for this. I also enjoy developing in it. (Whereas I looked at the Freestars code ~5 separate times in the last few months and wasn't very excited about it.)

Creating the core engine with a standard interface allows other projects to complete the UI and any other components. Those other projects could include: Android, iOS, and/or web browser based UI. The core engine is also a smaller chunk to swallow by one's self (if necessary).

The structure makes extensive use of Python objects and dictionaries. It is still early in the project but I think the internal design (above link) is solid. Almost everything in the game is a Space Object and inherits from that primary object class. Many of the Order of Event actions can be written as functions inside the class. The others will do stuff to the Space Objects.

The initial project objectives are laid out in the wiki https://github.com/jurlaub/StarsCoreEngine/wiki (actually two lists - I like "The other list" better. Very Happy ) My first focus was to create a outline to work within. And then to prove that the pickle module will work and build a test framework. That was finished last week. I am now working on creating support for generating a game universe (or 2+ Twisted Evil Twisted Evil ) from a standard template (basic part is done) and then modifying that standard template. After the basic structure is finished, it will be easier for others to contribute (at least that is my hope). (Oh, and I am in the "close enough" "& lets get into the ball-park" camp. Because we need to get this done! Cool )

Let me know what you think,

Thanks!
SW




[Updated on: Thu, 30 October 2014 04:10]




Rapid Weasel News Agency, We've got the Rabid!

Report message to a moderator

Re: Stars Core Engine Thu, 30 October 2014 11:45 Go to previous messageGo to next message
skoormit is currently offline skoormit

 
Lieutenant

Messages: 665
Registered: July 2008
Location: Alabama
This looks like a great project with a very savvy approach. Very promising so far. I only wish I could devote some development time to it.

All I can really offer is moral support, and perhaps also testing. Smile



What we need's a few good taters.

Report message to a moderator

Re: Stars Core Engine Sun, 09 November 2014 03:59 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 Thu, 30 October 2014 09:05
This is a project I have been working on for a few months.

https://github.com/jurlaub/StarsCoreEngine

Very interesting! Cool

It still looks different to what I have in mind, but the "mix-and-match-your-own-from-assorted-components" approach stills seems the way to go. After all, it's one of the main beauties of the game itself. Rolling Eyes

I have some perhaps useful components (in C/C++), and plenty of ideas for others if you need them. Work at computer



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Stars Core Engine Tue, 11 November 2014 01:39 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
Thanks! (to both of you)

I am sure that 'testing feedback' and the various components will be helpful in the future. Right now, my focus is create the 'infrastructure' to support Game Generation, the Order of Events & Turn processing (not necessarily in that order).
I would like to be able to

  • generate a game object : (Basic game object is started. Universe(s) can be attached. Twisted Evil )
  • from a standard template or custom file : (Basic universe template is done. Custom file is generated using a command line prompt.)
  • using basic race files : (Working on player / developer race currently)
  • save to file : (Partially Done -.hst file )(can be 'pickled' and 'unpickled')
  • load from file : (partially Done. Can 'unpickle' the .hst file. Can load a JSON Custom Universe file)
  • generate a .m file equivalent
  • generate a .xy file equivalent
  • import a .x file
  • generate a new turn


While that might sound awesome, note that much of the details are glossed over. They will be filled in once the infrastructure works. I imagine its like putting together a puzzle - the outsides are usually put together first. However, I think those details are going to be the fun parts. (Almost like running battle simulations (100x) to forecast future strategy Rolling Eyes Embarassed Rolling Eyes ) Or maybe like playing the game itself.

This weekend I started thinking a bit too hard about the interaction between the Player object, a Player Race design, and a player's fleets. (see: https:// docs.google.com/drawings/d/1rE61lFW4LO713llX9rlSGZ4sUVmTcOb8 _4Co501PzH0/edit?usp=sharing ) The fleets part was (still is) bugging me but it will have to wait. The Player Object + basic race template is next.

Ideas are welcome!

SW

Report message to a moderator

Re: Stars Core Engine Tue, 11 November 2014 16:21 Go to previous messageGo to next message
skoormit is currently offline skoormit

 
Lieutenant

Messages: 665
Registered: July 2008
Location: Alabama
Shadow Whist wrote on Tue, 11 November 2014 00:39

This weekend I started thinking a bit too hard about the interaction between the Player object, a Player Race design, and a player's fleets.


Maybe it's less ambiguous if the model uses "Race" rather than "Player" to refer to the in-game entity. I.e.:

"Players" create race designs.
The game creation engine, to create a game, requires a race design for each player. (These can all be different, or all the same, etc.)
The game creation engine creates a "Race" for each player, based on the race design for that player.
A Race has
  • a PRT (determined at game creation time from the race design)
  • 0 or more LRTs (determined as above)
  • Hab settings (determined as above)
  • Econ Settings (determined as above)
  • Tech Settings (determined as above)
  • 0+ Fleets
  • 0+ Tech Levels (and 0+ resources of credit toward the next level of each of the 6 research fields)
  • 0-16 Ship Designs
  • 0-16 Starbase Designs
  • Intel: current info on currently scanned objects (planets, fleets, wormholes, salvage, packets, MT), old info on planets previously scanned but not currently scanned, memory of last ship design seen for each enemy ship slot


That approach makes it seem natural that the Race object owns the Fleet objects, rather than the "Game" object, since all fleets have exactly one owner.
(I am considering the MT a space object rather than a fleet. Tomato, tomahto, perhaps.)

Since a planet has 0 or 1 owners, the Game object owns the Planet objects. Races always have current perfect info on Planets that they control. (The Order of Events engine, when it creates the current turn's intel for each Race, knows this.)

Just my top-of-head, back-of-napkin thoughts. Use, discard, ignore, etc., at your preference.



[Updated on: Tue, 11 November 2014 16:21]




What we need's a few good taters.

Report message to a moderator

Re: Stars Core Engine Wed, 12 November 2014 03:05 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
In the current structure, the game object holds all the other objects. Its like the root node of a tree (i.e. data structure).

Player Object:
It appears the way I am thinking of using the Player object is similar to the way you describe the Race object.

Fleets:
My original thought was that a Universe Object held all the Space Objects located inside. And the Player Object held the other player related stuff that was not a Space Object.
Now I am leaning toward the Player Object holding its fleets and the Universe Object having a dictionary where:

  • key = (x,y) coordinates
  • value = list of fleet id numbers at that respective (x,y) location. (all object will need a unique id, separate from player visible id)



BTW - in the stars_engine_core_structure link posted earlier there is a purple box. Inside describes the space object hierarchy and a rough inheritance structure.

Colonized Planets:
Colonized planet objects will be stored in the Player Object. Each Colonized planet will 'point' to the respective planet object. A Colonized planet will not inherit from Planet or Space Object - it will just use the existing values.

Thanks for the thoughts!
SW

Report message to a moderator

Re: Stars Core Engine Sun, 16 November 2014 05:23 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
Ugh, objects, inheritance, hierarchy... (me)just->wants = exploding.stuff(this,other); 2 Guns Fire bounce


So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Stars Core Engine Wed, 19 November 2014 11:24 Go to previous messageGo to next message
skoormit is currently offline skoormit

 
Lieutenant

Messages: 665
Registered: July 2008
Location: Alabama
m.a@stars wrote on Sun, 16 November 2014 04:23
Ugh, objects, inheritance, hierarchy... (me)just->wants = exploding.stuff(this,other); 2 Guns Fire bounce


LOL.

You either love it or you don't. Most don't. Which is fine by me; that's why it pays so well.



What we need's a few good taters.

Report message to a moderator

Re: Stars Core Engine Sat, 22 November 2014 14:30 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
skoormit wrote on Wed, 19 November 2014 17:24
Which is fine by me; that's why it pays so well.

They're nice enough moneymakers in my professional work too. Twisted Evil But for fun? For coding something as simple and flexible as Stars! Hit Computer



So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

icon5.gif  Re: Stars Core Engine Sat, 22 November 2014 20:59 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 have a couple of questions that I was hoping someone could confirm for me. (They are rather basic but I don't have a running copy of Stars at the moment.)

When a player intentionally vacates a colonized planet - what items are 'left behind' or would remain unchanged if recolonized? There are a few items that I cannot remember - specifically the last two.

  • CA - hab variables revert to original.
  • other PRT - Terraforming modification remain.
  • Mines remain.
  • Factories remain.
  • Surface minerals remain.
  • Orbital goes away.
  • Question Defenses remain? - if so and a new race recolonizes the planet they must have the same # of defenses but the tech is at their current max defense rating?
  • Question Scanner does not remain?



Thanks!


[Updated on: Sat, 22 November 2014 21:00]

Report message to a moderator

Re: Stars Core Engine Sun, 23 November 2014 18:34 Go to previous messageGo to next message
skoormit is currently offline skoormit

 
Lieutenant

Messages: 665
Registered: July 2008
Location: Alabama
Quote:

CA - hab variables revert to original.


--yes, but the "original" values may have changed due to CA permaforming

Quote:
Question Defenses remain? - if so and a new race recolonizes the planet they must have the same # of defenses but the tech is at their current max defense rating?


--IIRC, defenses do not remain

Quote:
Question Scanner does not remain?


--correct, scanner does not remain



What we need's a few good taters.

Report message to a moderator

Re: Stars Core Engine Sun, 23 November 2014 20:31 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
Thanks! that confirmation helps me know where to put some of the variables.

Right now I am working on generating a HW for each player. The process occurs after normal planet generation. Eventually, there will be a way to relocate HW's and/or all planets.

Report message to a moderator

Re: Stars Core Engine Sun, 30 November 2014 02:30 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
Update:

I have made some progress.
Here are some of the activities that could be tried from the command line if someone wanted to play around with the project.

(on Linux)
>python coreengine.py -h
>python coreengine.py -c_setup <new_setup_filename>
>python coreengine.py -n rabid_testgame -g <new_setup_filename>
(and others)


Very Happy Completed Items:

  • A custom setup .json file can be generated from the command line
  • A new game & new game file can be generated (with or without a custom file)
  • The .xy file with basic planet info is generated with a new game
  • Players are generated (requires using the custom setup file)
  • Player HW's are generated (added to the universe planet total)
  • A game can be loaded (generates 1 to n) turns (based on user input).
  • Currently the population grows on the HW. (Negative growth is not implemented)
  • more... Razz


While the .m file could be generated, I am holding off until later. My next priority is the standard technology structure. Technology is next because a Fleet requires a ship design, which requires tech.



Help would be appreciated Very Happy .

I believe there are a number of items that should be of minimal time investment. (Or at least, there is no need to grok the whole project code Rolling Eyes )

  • Generating random planet values (currently in universe.py ~ line 112 )
  • Negative population growth (in planet.py -> ~ line 141 )
  • Planet value calculation (in player.py: Player.planetValue() ) (uses Planet hab values in planet.py file)



Let me know if there are questions,
Thanks!

-SW


[Updated on: Sun, 30 November 2014 02:32]

Report message to a moderator

Re: Stars Core Engine Sun, 04 January 2015 21:47 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
Update:

The technology tree structure and its use in the game structure was more complicated then anticipated. In the end, it seemed that the suggestion made by JeffMC in a Freestars post was most reasonable as far as 'structure' and 'approach.' While I wanted to do some awesome "OOP" design, in the end a single object for all technology components seemed to be the way to go. I still think a composite design pattern will work. In the end, I needed something implemented, that works. OOP-Awesome was not necessarily a requirement.

So now, a host can generate a custom tech tree from the command line, save the entire standard tech tree to a file (thanks to mikeford1 for his work on the standard technology and the template_tech.py file). A host can also save 1-n 'blank' components to the tech file. This would allow the Host to edit the technology values (as long as they don't alter the key). The file can then be used to generate a game.

The ShipDesign object was a byproduct of working on the technology tree. I will be working on fleets and associated 'how fleets and players interact' design as soon as I clean up a few things in the player object.


Happy New Year!
-SW

Report message to a moderator

Re: Stars Core Engine Tue, 06 January 2015 12:08 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
Updated diagrams:

Version 3 StarsCoreEngine Internal Structure
https://docs.google.com/drawings/d/1SYeF5Nqv9q2Qbz7fi8CSOla2 k0hb4tVKVT_i5oyf0yw/edit?usp=sharing

Hopefully this provides some insight into some of the object inheritance.
https://docs.google.com/drawings/d/1yL6nYDkCPafbsbJY0jreaKzP b1zfNLJQuAxSHbmPFhI/edit?usp=sharing

Report message to a moderator

Re: Stars Core Engine Wed, 21 January 2015 15:38 Go to previous messageGo to next message
quatch is currently offline quatch

 
Crewman 1st Class

Messages: 21
Registered: April 2003
Location: Ontario, Canada

Weird, I was just thinking about doing something similar, but starting from the general interface. I was planning on using python, wxwidgets, and sqlite, with the intent of doing everything from a GIS/database perspective. Should I actually get my project underway, I'll report back Smile

Good luck on the project, and I appreciate your documentation.

Report message to a moderator

Re: Stars Core Engine Sat, 31 January 2015 13:55 Go to previous message
Shadow Whist is currently offline Shadow Whist

 
Chief Warrant Officer 2

Messages: 167
Registered: August 2003
Location: Vancouver, WA
@quatch: Thanks!

Part of the reason for my approach was that I wanted to do something more then an exact replica of the original. I wanted the data model part to be expandable/modifiable and it was unclear how to do that without capturing some of pieces first. I also wanted to make sure that the effort would 'achieve' a 'step forward' rather then be another failed attempt. I think there has been a lot of progress. In fact, the pieces are much clearer in my mind now - as compared to when I started. So much so that I have been working on the x-file JSON structure. This is now starting to inform how the classes interact.

If one considers that I am 'drawing' an outline - then I feel pretty close to connecting the ends. This is the essentially Production and Fleets. Once 'connected' its a matter of 'filling' in the outline (the details like mineral depletion and all the other behaviors) OR stacking things on top of the outline ( Scanning/Intel, Battleboard, etc). These are the things that interact with the space objects but are not space objects themselves. There is still a long way to go but still doable. (I feel like I am in year 30 of a 10-12 player game in a medium size universe - the fun stuff is just about to happen Very Happy Twisted Evil Very Happy )

-SW

Report message to a moderator

Previous Topic: Should Stars! files structures be publically available?
Next Topic: Stars! github organization
Goto Forum:
  


Current Time: Thu Mar 28 09:14:00 EDT 2024