RClick Colonize Planet

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
yandonman
Creative Contributor
Posts: 699
Joined: Thu Aug 30, 2012 12:32 am

RClick Colonize Planet

#1 Post by yandonman »

Here is a patch to right-click on a planet and order a colony ship to move to colonize it. This is merely a FleetMoveOrder(), it does not automatically colonize the planet once the colony ship arrives. Additionally, the selection of the colony fleet is very basic; it just selects the first valid colony fleet with no regard to species or suitability.

Ready to submit unless there is code review feedback.
RClick_ColonizePlanet.png
RClick_ColonizePlanet.png (11.84 KiB) Viewed 2086 times
Attachments

[The extension patch has been deactivated and can no longer be displayed.]

Code released under GPL 2.0. Content released under GPL 2.0 and Creative Commons Attribution-ShareAlike 3.0.

User avatar
MatGB
Creative Contributor
Posts: 3310
Joined: Fri Jun 28, 2013 11:45 pm

Re: RClick Colonize Planet

#2 Post by MatGB »

yandonman wrote:does not automatically colonize the planet once the colony ship arrives. Additionally, the selection of the colony fleet is very basic;
Basic but improvable? Regardless, I like, especially if it can over time be improved on.
Mat Bowles

Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

yandonman
Creative Contributor
Posts: 699
Joined: Thu Aug 30, 2012 12:32 am

Re: RClick Colonize Planet

#3 Post by yandonman »

MatGB wrote:Basic but improvable?
It's intended to be improvable, yes. Some of the potential improvements are controversial, hence starting basic.
Code released under GPL 2.0. Content released under GPL 2.0 and Creative Commons Attribution-ShareAlike 3.0.

User avatar
Dilvish
AI Lead and Programmer Emeritus
Posts: 4768
Joined: Sat Sep 22, 2012 6:25 pm

Re: RClick Colonize Planet

#4 Post by Dilvish »

Vincele recently posted a question regarding implementation of the same kind of combo-travel-colonize order feature, so you might want to double check with him about the status of that before putting time into implementing the combo order aspect.

As far as what you've got here, the primary code review comment that comes to mind is that I'm pretty sure you'll need to filter out known destroyed objects, or get the object map and then use ExistingFleetsBegin() and ExistingFleetsEnd(). Also, in addition to checking suitability as you mention, you'd also want to check availability (that it's not already in the midst of a colonize or similar combo order).
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0

yandonman
Creative Contributor
Posts: 699
Joined: Thu Aug 30, 2012 12:32 am

Re: RClick Colonize Planet

#5 Post by yandonman »

Dilvish wrote:filter out known destroyed objects,
!fleet->Empty() apparently works just as well, as I ran into this defect while testing an earlier version.
Code released under GPL 2.0. Content released under GPL 2.0 and Creative Commons Attribution-ShareAlike 3.0.

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

Re: RClick Colonize Planet

#6 Post by Geoff the Medio »

To pick a ship, you can check if there is any suitable ship in system and then pick which to use by using the same code as the existing colonize button that appears of the planet panel.

The menu text should probably specify that it is ordering a fleet to move to the planet, not just colonizing immediately... But I'm generally quite hesitant about something like this because it's very unclear what the command will do. It will find a colony ship somewhere, somehow, and then somehow get it to move to the planet... but which should it pick, given not only the issues that go into picking one from those in system, but also additional issues regarding which is safe / best to move to the system, and how to handle ships that are already in a fleet with other ship (split fleets automatically? should solo ship fleets be preferred over multi-ship or mixed-ship-type fleets?). Should it automatically enqueue a colony ship somewhere if it can't fine one, or even default to enqueuing rather than doing remote fleet manipulations? I don't think there are good answers to these questions...

User avatar
em3
Vacuum Dragon
Posts: 630
Joined: Sun Sep 25, 2011 2:51 pm

Re: RClick Colonize Planet

#7 Post by em3 »

It could display a list of available colony ships with suitability and jump distance (or projected travel time) to select a ship from.
https://github.com/mmoderau
[...] for Man has earned his right to hold this planet against all comers, by virtue of occasionally producing someone totally batshit insane. - Randall Munroe, title text to xkcd #556

yandonman
Creative Contributor
Posts: 699
Joined: Thu Aug 30, 2012 12:32 am

Re: RClick Colonize Planet

#8 Post by yandonman »

but which should it pick, given not only the issues that go into picking one from those in system,
The "best" one, meaning the one that (in order) has the highest max population, has the highest starting population, and has the shortest route.

But this is not needed for this patch. It is arguable whether or not the first (most suitable / will give highest max population) is needed for this patch.
but also additional issues regarding which is safe / best to move to the system,
The move system already maps out routes and highlights danger areas. So, with this patch, the player indicates they want a planet colonized, the route system indicates there is danger and now the player can make adjustments to the route easily.

and how to handle ships that are already in a fleet with other ship (split fleets automatically?
Leave it in the fleet. AKA don't override the players fleet building decisions.
should solo ship fleets be preferred over multi-ship or mixed-ship-type fleets?).
Edge case, not relevant.

This is not needed for this patch.
Should it automatically enqueue a colony ship somewhere if it can't fine one,
No (at least not right now). Building a colony ship is a PP spend, and that is a separate significant player decision. Perhaps if there are no colony ships, a popup could ask the player if they want to en-queue one.

But this is not needed for this patch.
or even default to enqueuing rather than doing remote fleet manipulations?
No. See above.
Code released under GPL 2.0. Content released under GPL 2.0 and Creative Commons Attribution-ShareAlike 3.0.

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: RClick Colonize Planet

#9 Post by vincele »

Hello, I'll answer in your thread, and not mine

Yes, I have a patch that I'm using, which does exactly that.
yandonman wrote:The "best" one, meaning the one that (in order) has the highest max population, has the highest starting population, and has the shortest route.
My patch does this, and add :

Code: Select all

0 - from the best (wrt suitability) race having an unassigned colony ship in your empire.
and how to handle ships that are already in a fleet with other ship (split fleets automatically)?
Leave it in the fleet. AKA don't override the players fleet building decisions.
My patch properly split the chosen ship from its actual fleet.
Should it automatically enqueue a colony ship somewhere if it can't fine one
I'd say no, we only want a fairly basic "choose a ship and send it there", I don't think anything more than that will be really useful.
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

User avatar
Vezzra
Release Manager, Design
Posts: 6102
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: RClick Colonize Planet

#10 Post by Vezzra »

Given the fact that the colonization mechanics might undergo some serious revision (see here), do you really want to spend the effort patching the current system? Revising the mechanics seem to be the better approach to me than implementing some automations to fix what looks like a design flaw.

yandonman
Creative Contributor
Posts: 699
Joined: Thu Aug 30, 2012 12:32 am

Re: RClick Colonize Planet

#11 Post by yandonman »

@Vezzra - actually, we should since discussions could literally take years. vincele's patch (have you posted it somewhere?) sounds like it solves one of the immediate problems. Additionally, I don't see colony ships going away, just having an additional (better) mechanism, so vincele's patch would still have value.

Also, "perfection is the enemy of done" :)
Code released under GPL 2.0. Content released under GPL 2.0 and Creative Commons Attribution-ShareAlike 3.0.

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: RClick Colonize Planet

#12 Post by vincele »

yandonman wrote:@Vezzra - actually, we should since discussions could literally take years. vincele's patch (have you posted it somewhere?) sounds like it solves one of the immediate problems. Additionally, I don't see colony ships going away, just having an additional (better) mechanism, so vincele's patch would still have value.

Also, "perfection is the enemy of done" :)
I just posted the patch (quickly rediffed against trunk), if you want to try it... This is only the menuitems, not the objwnd enhancements to display suitability, which nicely complements it. But which isn't currently acceptable as suitability is too expensive to compute.

The French saying is more like "The best is the ennemy of the good" (approximative translation of : Le mieux est l'ennemi du bien)
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

User avatar
Vezzra
Release Manager, Design
Posts: 6102
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: RClick Colonize Planet

#13 Post by Vezzra »

yandonman wrote:@Vezzra - actually, we should since discussions could literally take years.
Yeah, I know, we have a tendency for that. However, currently I'm determined to get this streamlining colonization thing done for 0.4.5. And Geoff seems determined not to have an entire year between releases again, more in the 4-5 months range. So we're hopefully talking about months, not years this time ;)
Additionally, I don't see colony ships going away, just having an additional (better) mechanism, so vincele's patch would still have value.
I still wouldn't count on it, as I'm still trying to make my case why colony ships should be thrown out...

Post Reply