[MODCOMP] Construction Sets

Jean Elcard

The Flavournator
Joined
Feb 26, 2006
Messages
1,008
Location
Leipzig, Germany
Construction Sets

That's my first "real" mod, so please be nice when it comes to critcising it. The reason for making it, was, that it always bothered me, that you are unable to get yield bonuses for sea plots in the city radius, if the city is not a coastal one. I could have just allowed lighthouses for every city, but that would have been too easy and strange looking, too. So I got the idea of construction sets, which are applicable in many ways. To solve the mentioned problem above ist only one of these ways.

What the mod does:

The main idea is, to allow the player to build improvements, which count as buildings in nearby own cities.
To build such an improvement, you need to build a special unit, which is kind of a construction set for the building you want build. It will be lost after building the improvement they are made for. As long as you stay in control of the improvement, you will notice a building in the city marked with an "(e)" for "external", which can give you various bonuses.

Lighthouse Example:

This mode contains the lighthouse example for demonstrating it's capabilities. The sailing tech allows you to build the "Lighthouse Kit" unit. This unit costs you 60 hammers (the same as a lighthouse) and is able to build once the lighthouse improvement on any plot, as long as the plot is a coastal land plot. If the lighthouse improvement is built, it counts as lighthouse for all your cities in city radius range around the improvement. If it becomes pillaged or culture flips to your enemy, your cities will lose the ability to use it. Furthermore it obsoletes, if you build a real lighthouse.
Notice: Besides it's capabilities to build the lighthouse improvement, you can use the lighthouse kit also for constructing a real lighthouse in a different city.

(See the picture below for visual impressions. And yes, that's a real flickering fire in the lighthouse. Was quite a pain to make it work. I made the screenshot of the lighthouse in the bottom left when I was a bit too optimistic regarding how big the flames should be.) :)

Other changes:

- Added XML tags for restricting improvements to coastal land plots.
- Marginal obsolete buildings functionality (was necessary; only one layer deep)
- Modified the lighthouse model to really light
- fiddled around with the PlotLSystem to make the forest go away and to place the lighthouse more dynamically

How to use it:

Even if I called it a mod component you can run it as a standalone vanilla mod. To add more buildings you just have to manipulate XML. The important tag is <CanPassForBuildings> in CIV4ImprovementInfos.xml. If you want to make a building obsolete by another building change <ObsoleteBuildingClasses> in CIV4BuildingInfos.xml. An example I made for the latter is, besides the lighthouse replacing the external lighthouse, the supermarket replacing the grocery.

All changes I made in the SDK or in XML are marked with comments.

The files:

Mod+Source: Download (Version: 0.1.1 for Vanilla)

Changelog:

Spoiler :

Version 0.1.1
- Fixed a CTD as a result of a broken art link when reaching the modern era.
- Fixed a possible abuse. You have to meet the requirements for a building to get its external version granted in a nearby city. (no university (e) without a library for example)


Ideas for a possible small modpack:

- an external hydroplant and some more external buildings
- using the flame effect for forest fires or so. it looks really cool.
- let ships see the lighthouse from far away
- implement TheLopez Upgradeable Buildings modcomp

Credits & Thanks:

- thanks to all the forum members for helping wherever they can
- thanks also to the writers of the great tutorials you can find here in the forum
- special thanks to jojoweb for the lighthouse model I was using as a base for the lighthouse model with burning fire
 

Attachments

  • Construction-Sets-010-web.png
    Construction-Sets-010-web.png
    448.3 KB · Views: 387

GeoModder

Deity
Joined
Nov 29, 2005
Messages
7,512
This looks good. A few questions though: if you use the unit to construct its facility in another city, does the city needs to meet the requirements for this facility?
For instance, would the unit be able to construct a lighthouse in an inland city, or as another example a university in a city without a library?

And works this modcomponent only in Warlords, or could it be used in BtS (as far as you can imagine, of course) or Civ4 Vanilla?
 

Psycadelic_Magi

Hippie/Philosopher/Peanut
Joined
Apr 13, 2006
Messages
237
Location
Northeast England
This is a real good idea... How about a harbour that, if linked by roads to a city within its radius; provides sea trade routes and possibly shipbuilding?
 

Jean Elcard

The Flavournator
Joined
Feb 26, 2006
Messages
1,008
Location
Leipzig, Germany
If you use the unit to construct its facility in another city, does the city needs to meet the requirements for this facility?
For instance, would the unit be able to construct a lighthouse in an inland city, or as another example a university in a city without a library?

It does check all the requirements before it allows you to push the button in another city. So no inland lighthouses or an university without a library. But I realized just something else. It doesn't work this way for external buildings atm. I will take a look at this tomorrow.

And works this modcomponent only in Warlords, or could it be used in BtS (as far as you can imagine, of course) or Civ4 Vanilla?

It works only with Vanilla so far, but I will probably convert it to BtS if possible, as soon as I can get my hands on its source code. There will be very likely no Warlords version. Sorry.

This is a real good idea... How about a harbour that, if linked by roads to a city within its radius; provides sea trade routes and possibly shipbuilding?

Shipbuilding in external harbors would be cool, I have to admit. Sea trade routes would be easy to add with an external harbor using the current version.

The biggest problem with the external harbor is, though, you have to align it with the coastline to make it look decent. That's a rather difficult task. There is a special function doing this for city harbors, but it's implemented in civ4's unmodable graphics engine. Atm there is no way to use it, when placing buildings on external plots.
 

GeoModder

Deity
Joined
Nov 29, 2005
Messages
7,512
But I realized just something else. It doesn't work this way for external buildings atm. I will take a look at this tomorrow.

Glad I brought you on track of a possible abuse of the system. ;)

It works only with Vanilla so far, but I will probably convert it to BtS if possible, as soon as I can get my hands on its source code. There will be very likely no Warlords version. Sorry.

Oh, I thought it was for Warlords. Not a problem then since I thought this component usefull for a mod-in-progress in Vanilla. Hope you can port it to BtS in due time.

Shipbuilding in external harbors would be cool, I have to admit. Sea trade routes would be easy to add with an external harbor using the current version.

The biggest problem with the external harbor is, though, you have to align it with the coastline to make it look decent. That's a rather difficult task. There is a special function doing this for city harbors, but it's implemented in civ4's unmodable graphics engine. Atm there is no way to use it, when placing buildings on external plots.

What if you modded it so that external harbours can only be put in sheltered bays? Meaning most of the surrounding plots would be land thus the chances of this harbour being oriented in the right direction would increase? In any case, I suppose that such a harbour creating unit would be a sea unit, thus at least one proper coastal city would be needed to create it.
 

Jean Elcard

The Flavournator
Joined
Feb 26, 2006
Messages
1,008
Location
Leipzig, Germany
New version uploaded and linked.

Version 0.1.1
- Fixed a CTD as a result of a broken art link when reaching the modern era.
- Fixed a possible abuse. You have to meet the requirements for a building to get its external version granted in a nearby city. (no university (e) without a library for example)
 

Jean Elcard

The Flavournator
Joined
Feb 26, 2006
Messages
1,008
Location
Leipzig, Germany
I revamped the mechanism controlling the obsoleteness of buildings by building another building in the city, today. The result is a very nice recursive method as its central part. Mabe I'm going to release it as a stand-alone spin-off of this modcomp. Recursive methods are really fun. It's unavoidable, that you get a knot in your brain, when trying to imagine what this thing is actually doing. But hey, it works!

What if you modded it so that external harbours can only be put in sheltered bays? Meaning most of the surrounding plots would be land thus the chances of this harbour being oriented in the right direction would increase? In any case, I suppose that such a harbour creating unit would be a sea unit, thus at least one proper coastal city would be needed to create it.

I would probably make it a land unit. It's possible to make land plots passable by ships. I wouldn't like to force the player to found a coastal city first. After all a harbor is built mostly on land not in the water. But I'm not sure how to make it look decent.

- The shelterd bay you suggestet (similar to the Lanun Pirate Cove from Fall from Heaven II) would be an idea, but even the Pirate Cove looks sometimes kind of strange. The real Civ4 harbor too, to be honest. I saw it occasionally the wrong way around.

- Another idea would be to work around this problem by creating multiple Harbor improvements with different rotations and choose the one which fits best at runtime. I heard BtS might allow to manipulate meshes with C++. If that's true, I would just need one improvement and could rotate it later.

- There is a third way for doing it, but it's maybe to enthusiastic. It would allow the player to build a harbor in the water without the need to found a coastal city first. Something like the targeted spells (also an idea fromthe Fall from Heaven Team) would come in handy for this. No idea how difficult to implement it is. Furthermore, I would still have to rotate the Harbor properly.

Oh, and I shouldn't forget. Somehow I have to find a way, that the ships, built in the city, appear at the harbor plot, not in the city.
 

Dom Pedro II

Modder For Life
Joined
Apr 3, 2002
Messages
6,811
Location
Exit 16, New Jersey
Oh, and I shouldn't forget. Somehow I have to find a way, that the ships, built in the city, appear at the harbor plot, not in the city.

That's not terribly difficult. I've seen stuff like that done in other mods. The other thing is that the harbor could have to be adjacent to the city and adjacent to the Coast giving max distance for the city from the ocean of 1 tile... then the unit could be built in the city and pass through it into the harbor and then out into the coastal waters.
 

Jean Elcard

The Flavournator
Joined
Feb 26, 2006
Messages
1,008
Location
Leipzig, Germany
That's not terribly difficult. I've seen stuff like that done in other mods.

You don't remember by any chance which mods this were exactly. Could save me a lot of time.

The other thing is that the harbor could have to be adjacent to the city and adjacent to the Coast giving max distance for the city from the ocean of 1 tile... then the unit could be built in the city and pass through it into the harbor and then out into the coastal waters.

That would work, but I would prefer the other way.
 
Top Bottom