trade points for connecting cities

What would you like to see in Freeciv? Do you have a good idea what should be improved or how?
User avatar
XYZ
Hardened
Posts: 189
Joined: Fri Jan 31, 2014 12:00 pm

trade points for connecting cities

Postby XYZ » Mon Mar 05, 2018 12:36 pm

It would be nice if you get some extra trade points for connecting two cities by road and rail.

Lachu
Elite
Posts: 301
Joined: Sat May 04, 2013 2:19 pm

Re: trade points for connecting cities

Postby Lachu » Mon Mar 05, 2018 7:50 pm

In Civilization V, connecting cities with road gives gold to player and connecting cities with railroad gives production to both connected cities.

User avatar
Arbogast
Elite
Posts: 389
Joined: Tue Jul 16, 2013 9:09 am
Location: France

Re: trade points for connecting cities

Postby Arbogast » Tue Mar 06, 2018 6:47 am

In Freeciv you get points for trade, according to distance AND research points. But you must know this so maybe I'm not understanding fully your message.

Caedo
Elite
Posts: 418
Joined: Sun Feb 10, 2013 10:21 pm
Location: Germany

Re: trade points for connecting cities

Postby Caedo » Tue Mar 06, 2018 7:35 am

I believe XYZ is asking about a bonus for a connection with the terrain improvements road and rail; not trade routes. You are of course correct.

As far as I know, at this point, there is no easy way to do this. Freeciv itself has no simple way to do this, so it would have to be done through lua scripting. Now, this is where I'm not sure if it's possible to figure out whether a tile has road or rails in lua script (and I'm too lazy to check right now), but then you could implement a pathfinding algorithm that can figure out whether there's a path, and then connect that to the turn change signal. Of course, if two cities are each connected to a large rail network, but those two networks aren't connected, this pathfinding will take a long time to realize that, so caching will probably be a good idea, but then you'll have to cache a lot of data per city.
Also, that's just for figuring out if two cities are connected. As for how to apply the bonus, I'm not sure. I don't think it's possible to apply stacking bonuses for an arbitrary number of connections, and in order to apply a bonus at all, I think we need to wait for some additional functionalities to be added to the lua scripting interface (which is already planned for a specific one of the currently developed versions, if I'm not mistaken).

User avatar
XYZ
Hardened
Posts: 189
Joined: Fri Jan 31, 2014 12:00 pm

Re: trade points for connecting cities

Postby XYZ » Wed Mar 07, 2018 10:53 am

@Caedo got what I meant.

Probably limiting the bonus to two connections would be sufficient, otherwise its too much micromanagement. But that only an implementation problem not a technical one...