Supply Lines development thread

I have to admit, I'm skeptical about designing decent supply lines for units.

I mean, part of the problem is that a plot in enemy territory is not considered to be connected to your cities. When the game checks if a tile is connected to a particular city or your larger trade network, the game isn't checking the tiles between it and your city to see if there's a route connecting them. Each time a route is built (or destroyed) on a tile, the tile is added to a "plot group" that contains all the tiles that are connected to the trade network. If two tiles are in the same group, they're considered to be connected.

So if you want to have units on foreign plots considered to be connected, then you are going to have to check for valid paths back to your territory. I've toiled over this subject and found it very frustrating because it seems like a good check for a unit's valid supply line is going to eat up a lot of processing time for each unit.

Yeah, I found out exactly what you are talking about there.. but I seemed to have added Zone of Control with no problem.. it works like Blockade does in the game. I just simply added code similar to the Blockade code. If a friendly unit is in enemy territory and has the roads under his ZoC then the plot group of those plots are changed so that player can use them for trade. If the unit moves from that spot or cancels ZoC those plots are removed from that group. It should use no more processor than Blockade does.

The kind of Supply I am working on will have 3 levels.
1st Level. Direct connection to a City by route.
2nd Level. Clear path to a city.
3rd Level. No clear path.

Now checking for just a clear path with ZoC factored in has proved to be a bit of a problem. But what I have on the drawing board to do is two checks. The first checks to see if each city's plot group is connected to the units plot group, if so then it can heal at 1st Level. Then if not, I may can do a "generatePath" check and if that turns up true then thats 2nd Level. If those two checks fail then its Level 3.

Thats what I am attempting to get to work now.

Actually, when you think about it there is already a simulation of "Supply Lines" in the game as units heal different when in friendly, neutral, and enemy territory. We are just trying to add checks to see if the unit is actually connected to a supply source.
 
Well, that could work, but I think that units venturing outside of one's borders are going to end up causing a bit of a drag on game speed. You also have to figure out what really qualifies as a proper path. I mean, if it takes 50 turns to get from the unit to the nearest city, should that really qualify? The game will return a true value since it's technically a valid path... If there are twenty enemy units that sit in between the direct line from the unit to the city, should it still count if a circuitous path around them is possible? And unfortunately, we don't have access to the generatePath function AFAIK, so I don't think we can modify it to take these things (or ZoC) into account.

But don't take my skepticism be interpretted as a lack of support. I do certainly hope you get this to work well.
 
Well, that could work, but I think that units venturing outside of one's borders are going to end up causing a bit of a drag on game speed. You also have to figure out what really qualifies as a proper path. I mean, if it takes 50 turns to get from the unit to the nearest city, should that really qualify? The game will return a true value since it's technically a valid path... If there are twenty enemy units that sit in between the direct line from the unit to the city, should it still count if a circuitous path around them is possible? And unfortunately, we don't have access to the generatePath function AFAIK, so I don't think we can modify it to take these things (or ZoC) into account.

But don't take my skepticism be interpretted as a lack of support. I do certainly hope you get this to work well.

Thanks for the input. The code only checks for heal once every turn for each damaged unit. My code cycles through each of the players cities to see if there is a trade route connection, if not it then checks for a clear path with the "MOVE_SAFE_TERRITORY" argument in the generatePath function. I could simply check for distance to the city if "out of range" that city does not count, as it seems the Function generatePath has an argument called PathTurns, which I would only "assume" means "the path is within so many turns".

I'll test it out when I get it working correctly. I'll add about 100 units all over the place next to barabrians, scatter out some cities, then have the units attack. On the turn they all heal up I see how long it takes the PC to finish the turn.

Also, I found these functions that all tie in to the path finding.. it seems to me they can be edited to act in different ways...

CvGameCoreUtils:

pathDestValid
pathValid
pathHeuristic
pathCost

and some others maybe.

I haven't really check out what I can do but I know like the pathValid function is called when ever you use the Goto command for each space you highlight.
 
I just got done testing my first tests on a large map with lots of cities and lots of damaged units(60 damaged units, 18 cities) and the time between turns was probably less than two seconds so I am not seeing any noticeable delays as of now with that test. The code checked every single city for a trade route connection, if no trade routes it then checked every single city for a Clear Path. I had every unit write its supply level to a text file also.

I can probably add code to simplify the checks even further for stacked units, as stacked units act similar to a single unit. Just have a new variable set as "supply level" and have the Head Unit first check for supply level then adjust his "supply level" variable accordingly. Then all other units in the stack just check the head units "supply level" variable for their final heal rate. Plus there is other things I can do to optimize the code.
 
I'll check this out when I get home. Looks cool!

Cool, look out for anything that doesn't seem to fit with the above rules.

I just uploaded a new version. This version does not stop units from moving into a Zone of Control, it only slows them down.
 
I got a crash when I tried to load the mod. I tried it twice to be sure.

Have you updated to the latest 3.17 BtS patch? Also, you have to take the "Supply Line" folder out of the Supply Line alpha 0.3 BtS 3.17 folder and drop it in your mods folder. Other than that, I don't know what it could be... I just tried the game with the downloaded version and all seems well.
 
Have you updated to the latest 3.17 BtS patch? Also, you have to take the "Supply Line" folder out of the Supply Line alpha 0.3 BtS 3.17 folder and drop it in your mods folder. Other than that, I don't know what it could be... I just tried the game with the downloaded version and all seems well.

Yes, it's patched to 3.17 and I put the right folder in the right place. I'm going to try one more thing and see if I can't get it...
 
Yes, it's patched to 3.17 and I put the right folder in the right place. I'm going to try one more thing and see if I can't get it...


Will the game start without the mod? I had to download new ATI video drivers and update windows XP to service pact 3 before I could get the game to work after the patch.

Also, I just uploaded a 0.31 alpha.. I had left a test file in the game that made the Aztec unique unit unmovable, so I removed this test file.
 
I was unaware of the existence of this Thread ….Your debate is very interesting !!!

However, by taking account of the various debates in progress on the various upgrading capabilities of the game, it becomes impossible of all to read (especially if one is not naturally Anglophone!), and very difficult to answer individually and correctly all Thread which interests us (with the translation, that ends up taking much time!)!
Also, so that its ideas are considered and benefit the greatest number of Threads, it is not always known if it is to better intervene on of Thread in progress, or if it is necessary to launch the new ones… with the inherent risk of dispersion.
So…I thus temporarily will place a long text of general order in CIVILIZATION TAVERN… in double, on the one hand in “A Big Vision for Civilization 4" and on the other hand in “Civ V Ideas & Suggestions Summary".


((Note: PLEASE excuse the probably uncomfortable English generated by my translation system / French Original text available on request))
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
My text names “Game-Design applied to Civilization 4 +/ Dissertations N°1”

It contains the following chapters and paragraphs:

- INITIAL POTENTIAL : - Civilizations and Geography /- Initial Poverty /- Resources
- FEMALE ABSENCE
- RIGHT-OF-TRANSIT
- COMMANDS
- LOGISTICS : - Abstract or Figurative representation /- Evolution of Logistics
- OPERATING SPEEDS & RANGES
- VISIBILITY & GROUNDS
- DETECTION & REACTION
- ZONES OF TACTICAL INFLUENCE

I hope that you will find in this text of the suggestions in relation to your reflexion and which interest you !
 
Back
Top Bottom