Recent Additions

Here, various developers can tell you all about what they're up to, so you can yell at them for being idiots. "... and there was a great rejoicing."
Message
Author
User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Recent Additions

#1 Post by Geoff the Medio »

I thought I should let people know that I've started a FreeOrion Python AI Interface documentation page on the wiki, here: http://freeorion.org/index.php/AI_Python_API

It currently describes the basics of FreeOrion AI scripting, but only covers a few functions and classes that are exposed to Python that AIs might want to use. Most (all?) classes and functions are listed, but most don't have a description of how they work or what parameters they takes or values they return. The page isn't terribly useful yet, but I thought it might be of interest anyway... It gives a sense of how complicated things can get to produce what might seem like a relatively simple game so far, and perhaps why development can take a long time to produce visible results.

I've also recently been adding some new effects and conditions to FreeOrion. These include:

* Homeworld and Capitol conditions - These let effects target only homeworld or capitols of empires. They were quite simple to add and an obvious omission.
* SetEmpireCapitol effect - This lets an effect set the location of an empire's capitol. This should probably be used to make the Imperial Palace building determine the capitol location.
* MoveTo effect - This lets an effect move objects around the universe. It has a bunch of special cases for ships, fleets, planets and buildings being moved to the location of other objects... whenever the target object (that's being moved) is moved to a location object (where the target is moved to) that is of an appropriate type, the target is inserted or added to the target. For example, buildings moved to a planet are put onto the planet, and buildings moved to other buildings are added to the building the planet is on. If a building is moved to a fleet, however, then nothing happens, as there is no planet associated with the fleet to add the building to, and all buildings need to be on planets. This could be used to make stargate buildings or warp rifts of that move ships or fleets around the map.
* CreatePlanet effect - This lets an effect create a new planet, specifying its size and type.

There's also a CreateBuilding effect almost completed.

Some of these have been tested, and others not, so anyone able to do so is encouraged to.

I've also mostly updated the wiki Effects page to describe these new effects and conditions.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Recent Additions

#2 Post by Geoff the Medio »

I've started reworking how victory and defeat are determined. First thing was to rip out the old defeat code, that just dropped any player who has lost all owned planets. Instead, I've made a distinction between being defeated and being eliminated.

Being defeated means you lose, perhaps due to another empire winning, or perhaps due to being eliminated. Being eliminated means (or rather, will mean once I've finished reworking the relevant code) you've lost all your fleets and planets, so essentially can't play the game anymore, as you have nothing to control. The server drops connections players in this situation, and stops sending turn updates to them. This might be changed in future, though, if we allow diplomacy to resurrect players who have lost their whole empire, or add a new variety of client connection such as observers, into which an eliminated player might be changed, allowing them to keep watching the game they were previously in (should this be enabled at game start).

Victory means you win, perhaps due to defeating or eliminating all other empires, or researching the game-winning tech, etc. Now you can keep playing after victory, including after defeating all AIs. Previously winning ended the game.

I also added a Victory effect. This new effect lets a tech or building cause an empire to win the game. This will allow game-winning techs or buildings or combinations thereof to be added as victory conditions.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Recent Additions

#3 Post by Geoff the Medio »

I just modified how resource supply lines are shown. Now starlanes are coloured with the colour of an empire that can exchange resources between systems along that starlane. Currently this is limited to only show one colour per starlane, and future work is to make multiple empires colours appear on a single line. Other future work is to half-colour a line on the side from which an empire could exchange supplies if the other end of the starlane wasn't blocked.

I also did some client-side trickery to allow clients to predict where other empires supply lines (resource and fleet) go. Previously, clients (players) didn't know what systems other players had explored, so couldn't predict where their supplie lines would go, so only the client's player's supply lines were being drawn. Now the client uses its own list of explored systems, which happens to be all the systems and starlanes the player can see, to predict where other empires supply lines will go. The server updates still use each empire's actual explored systems, however, which is the one that actually determines what happens in the game.

The range to which systems can exchange resources now depends on planets' construction meters. Range = floor(construction / 20). This necessitated givin the homeworld special a big boost to construction, as otherwise the homeworld had a construction meter of less than 20 at the start of the game, meaning no inter-system resource sharing was happening. This might actually be how we'll want things at the start of the game, but for now, and for testing and display purposes, it was helpful to have single-jump resource exchange from the start.
Attachments
Mulitple empires' supply lines (solid = resoure, dotted = fleet) all being shown in-game (some predicted).
Mulitple empires' supply lines (solid = resoure, dotted = fleet) all being shown in-game (some predicted).
FO_Resource_Starlane_Colours.png (82.02 KiB) Viewed 13755 times

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Recent Additions

#4 Post by Geoff the Medio »

It took less time than expected to get basic half-length starlanes working. Currently only one empire's colour can be shown, just like the full-length lane limitation.
Attachments
galaxy map with half-length coloured starlanes indicating obstructed supply flow
galaxy map with half-length coloured starlanes indicating obstructed supply flow
FO_Resource_Starlane_Colours2.png (43.55 KiB) Viewed 13715 times

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Recent Additions

#5 Post by Geoff the Medio »

I recently reworked how food distribution is done. It now takes into account which systems are connected and able to exchange resources (as can be seen on the galaxy map above), and only systems connected to the stockpile system are able to take from or put resources into the stockpile of food.

It's probably go a few bugs, so if anyone can compile and test an up-to-date version of FreeOrion, some testing would be helpful.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Recent Additions

#6 Post by Geoff the Medio »

Similar changes have also been applied to the production queue. Production points (PP) should be allocated within limits of which systems can exchange resources, and mineral stockpile updates should take this into account as well.

This update is even less tested than the last, so I expect to need to make some fixes to it.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Victory Online

#7 Post by Geoff the Medio »

kroddn set up a server on a webserver he has access to, and we just played an internet game. I thought I'd share my glorious victory:
kroddn is defeated
kroddn is defeated
Geoff_wins_kroddn_falls.png (60.55 KiB) Viewed 13139 times
(The missing empire name in the sitrep is a known bug.)

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Recent Additions

#8 Post by Geoff the Medio »

I've been working on making the GUI layout a bit more flexible. The latest set of changes have made the SidePanel size adjustable. A few quirks remain, particular at small sizes, where it can be quite unusable below certain widths, but most of the layout updates reasonably. Currently this can only be done by editing config.xml or passing a command-line parameter, but it could potentially be done in-GUI eventually.

I've also enclosed the planet renders with boxes after repeated suggestions that this would be best.
Attachments
Variable Width SidePanel
Variable Width SidePanel
SidePanel_Resize.png (312.72 KiB) Viewed 13161 times

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Recent Additions

#9 Post by Geoff the Medio »

I have added a map scale indicator. It resizes and update when the map is zoomed, adjusting the distance displayed to show the biggest nice round number while fitting in the available space (200 pixels, currently). I used the units uu for lack of a better idea of what to measure distance with in-game.
Attachments
map scale indicator
map scale indicator
Map_Scale_Indicator.png (150.35 KiB) Viewed 12921 times

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Recent Additions

#10 Post by Geoff the Medio »

I've added some ETA indicators for the selected fleet's move line and projected fleet move line. The selected fleet's icon is also surrounded by an indicator. It's kind of hard to see, but it's the green fleet at Peel.

Remaining to do is make the move lines use moving dots instead of the current stippled lines, and to figure out why the project fleet lines won't render if the selected fleet also has an already-ordered fleet move line (not illustrated in this image). Art people are encouraged to replace default/data/art/icons/fleet/fleet_selection.png with something better.
Attachments
projected fleet move lines in white
projected fleet move lines in white
Map_Update.png (40.19 KiB) Viewed 12764 times

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Recent Additions

#11 Post by Geoff the Medio »

And now I've switch fleet move lines to be rendered with a dot texture...

This somehow fixed the missing projected move line issue mentioned earlier.

The dots are a texture, default/data/art/misc/move_line_dot.png, which should probably be replaced.

Also, the animation of the dots is a bit jerky, unforutnately, likely due to integer round-off issues. It's not particularly horrible unless you're looking for it, though.
Attachments
move lines shown with dots
move lines shown with dots
Move_Line_Dots.png (56.8 KiB) Viewed 12749 times

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Recent Additions

#12 Post by Geoff the Medio »

I've added scanline-style fog of war indicators over system icons on the map. These can be turned on or off in the options, and the spacing between them can be adjusted.
Attachments
latest map with everything turned on
latest map with everything turned on
map_with_fog_scanlines.png (232.09 KiB) Viewed 12675 times

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Recent Additions

#13 Post by Geoff the Medio »

Some aspects of the game start conditions are no longer hard coded!

The file preunlocked_items.txt specifies the ship hulls, ship parts and building types available to empires at the start of the game without researching anything. Techs can also be granted to empires at the start of the game in this file, using "type = Tech" and the tech name from techs.txt, although this isn't yet done in the SVN version of the file.

The file premade_ship_designs.txt specifies the ship designs that empires start out with at the start of a new game. Ship designs in this file can also be referenced in the following file...

The file starting_fleets.txt specifies the names and ship designs contain in fleets that empires are given at the start of a new game. The ships in the starting fleets are listed by design name, which refers to names given in premade_ship_designs.txt.


Anything defined in any relevant content files can be added in the appropriate places to these files to change the game start conditions. Hopefully the formats should be evident from the current examples / content in the files...

One thing to note is that the names of things are all looked up in the stringtable, so they can be translated without editing the actual content descriptions. This can be disabled for ShipDesign definitions by setting "lookup_strings = false" but it's always on for the FleetPlan and ItemSpec entries.

Another possibly confusing point is the four empty "" in the colony ship design definition. These are there because a colony pod requires an internal part slot, and the only internal slot on a medium hull - the one used in the defintion - is the last slot. The design processing code doesn't try to figure out where it can place parts in slots; it expects the parts to correspond to the slots in which they will go, so if a part needs an external or internal slot, it needs to be put in the right place to line up with such as lot in the corresponding hull definition. It's acceptable to omit trailing empty part names though, so if you only want a part in the first slot of a five-slot hull, and the part can go in the slot type of the first part, you can just put parts = "PART_NAME" and leave off the other four "".

This resolves a long-standing request to be able to modify the starting set of fleets without recompiling for AI development purposes.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Recent Additions

#14 Post by Geoff the Medio »

Fun Fact: Writing out these release notes took about 40 minutes of transcribing from the SVN commit logs. And I didn't even give any details of the combat system changes.

We really need to release more often...

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: Recent Additions

#15 Post by Geoff the Medio »

One can now order buildings or ships to be scrapped, using a right-click menu options. The same menu updates to allow cancelling scrapping if an ordered-scrapped building or ship is right-clicked.

Buildings or ships that have been ordered scrapped are indicated with an icon, which is currently a big red X, as in this screenshot of the FleetWnd and sidepanel.
Attachments
Ship and building have been ordered scrapped, and user has right-clicked the unscrapped building.
Ship and building have been ordered scrapped, and user has right-clicked the unscrapped building.
Ordering_Scrapping.png (75.05 KiB) Viewed 12117 times

Locked