Erlend Philip Wood
Chieftain
There are a lot of great new features in this release, Flintlock. Thanks a lot! I will try them out and put them to good use.
Also I keep coming back to the idea of adding Lua scripting to the game.
Among many other applications, it opens up the sort of complex scripted events available in Civ2 and Civ4 (and beyond). TOTPP adds it to Civ2, and modders can now bypass hardcoded mechanics to directly manipulate combat in the sort of detail seen in Civ4. It has single-handedly revitalized the modding scene for an almost three-decades-old game, and I can't even begin to imagine what Civ3 modders could do with it.I had to look up what Lua scripting is and at best I can only understand it superficially.
Flintlock, could you give an example of what you could do with it?
It's not as crazy as it sounds! Getting Lua running from within the Civ 3 process is pretty straight forward, given what C3X can already do. It's not much more difficult than integrating Lua into any C program. (Though it is a bit more difficult since the C source isn't compiled the standard way, in particular there's no linking phase.) The hard part is creating an interface between Lua and the Civ 3 game data & methods. I've been working on automatically generating that interface based on the C interface I already have, but there are a lot of issues to deal with. E.g. methods don't have convenient names, some methods are in vtables, C has no boolean type, ... I haven't even though about memory management yet.
local civ3 = require("civ3")
function CheckHappinessAtEndOfTurn()
local numUnhappyCities, firstUnhappyCity = 0, nil
for city in civ3.mainScreenForm:GetController():Cities() do
city:RecomputeHappiness()
local numHappy, numUnhappy = 0, 0
for citizen in city:Citizens() do
if citizen.mood == civ3.CitizenMood.Happy then
numHappy = numHappy + 1
end
if citizen.mood == civ3.CitizenMood.Unhappy then
numUnhappy = numUnhappy + 1
end
end
if numUnhappy > numHappy then
numUnhappyCities = numUnhappyCities + 1
if firstUnhappyCity == nil then firstUnhappyCity = city end
end
end
if firstUnhappyCity ~= nil then
local response
if numUnhappyCities > 1 then
response = civ3.ShowPopup(civ3.GetC3XScriptPath(), "C3X_DISORDER_WARNING_MULTIPLE", firstUnhappyCity:GetName(), numUnhappyCities)
else
response = civ3.ShowPopup(civ3.GetC3XScriptPath(), "C3X_DISORDER_WARNING_ONE", firstUnhappyCity:GetName())
end
if response == 2 then -- zoom to city
civ3.mainScreenForm.turnEndFlag = true
firstUnhappyCity:ZoomTo()
elseif response == 1 then -- just cancel turn end
civ3.mainScreenForm.turnEndFlag = true
-- else do nothing, let turn end
end
end
end
What got me interested again most recently in integrating Lua is the possibility of custom map scripts. I was playing Civ 4, trying out the Totestra map script for the first time, and I was struck by how much a different kind of map can freshen the experience. Custom map scripts for Civ 3 would be best done through Lua so that way the wider community could contribute them. Technically it would also be possible using C, which all of C3X is already written in, but there's a much higher barrier to entry there.I had to look up what Lua scripting is and at best I can only understand it superficially.
Flintlock, could you give an example of what you could do with it?
Thanks! Right now shared visibility only works in hotseat but I don't see any reason it couldn't be applied to PBEM as well in the future.These new features look wonderful! Does the Hotseat human-player view option apply to Play-by-Email games as well?
I might be the first one who actually test it. I had few attempts with Wars in Medditerrean mod before. It was one of those mods which attracted my attention to modding and this forum more than 10yrs ago. In fact I was not able finish playing this mod because during the turn change the game was slowing down untill completley freezed. I played again this weekend when I read what you added to your recent release and it looks like you finally fixed this horrible issuse which made lots of old mods with large maps unplayable. I haven't finish playing yet but the game is really advanced, 60-70% of map is conquered and time for turn change no more that 1-2 minutes. Without your addon I had to wait 15-20min for a turn to change untill game freeze to death. First time I made a progress in this mod much much bigger than ever before. And it looks I am going to finish it.Fix potential trade net issue in games with a very large number of tiles and resource generating buildings -- I'm not sure if this fixes the "trade net collapse" issue that was reported, but it fixes a bug that might have caused that. The bug would have prevented resource networks from being calculated at all when the sum of map tiles and resource generating buildings equaled 65536 exactly.
Incredible! fantastic!Recently, @Coronel_Civ3 posted the following question, which I thought worthwhile to repost here:
"The Civilization 3 Conquests v 1.22 [...] "ARMY" option cannot be adjusted in naval unit actions or in air units. For this reason, the system does not allow you to complete the create army operation, however you can enable the option to load both ground and naval units and certainly air units and select the ARMY option in functions or skill characteristics.[...] But could this option be unlocked for the naval and air forces? From a special program or an editor that I know there are hidden functions around here, perhaps that option could be added."
My new friend, the purpose of this thread is to ask/see whatever Arcane Magic Flintlock can pull off nextIncredible! fantastic!
Too bad it's not in Spanish! I'll try to see if I can translate at least the TEXT documents.
Thank you so much!.
Thank you! That must be the improvement loop optimization at work. Down to 1-2 minutes from 15-20 is pretty amazing, the most I've seen in my testing is a turn time reduction of about 70%. In general the optimization should be more pronounced for mods that add many city improvements and those that limit how many cities can trade over water (because that shifts the bottleneck from actually computing the trade routes to checking whether cities can trade). There's even more I could do to speed up trade net calculations and a lot more I could say about it. I was planning to post a thread all about that, maybe someday...I haven't finish playing yet but the game is really advanced, 60-70% of map is conquered and time for turn change no more that 1-2 minutes. Without your addon I had to wait 15-20min for a turn to change untill game freeze to death. First time I made a progress in this mod much much bigger than ever before. And it looks I am going to finish it.
Fantastic work you're doing here Flintlock! I will say no more
Scripted events would surely be possible once Lua is integrated into the program, which would be a lot of work but I don't see any real technical limitations there. About spawning in a player in the middle of a game, that might be awkward due to engine limitations. Or maybe not, I've never tried it. Even if it's not possible you could keep a settler for that player on the edge of the map then move it into position at the appropriate date.CivII had scripted events. Is anything like that possible? Am thinking of large timescale historical maps where the events load some civilizations at later times. For example, a bronze age scenario might start the game with Sumeria in 3500BC, allowing the Sumerians to build a number of cities and then later use an event to add Celts in 1000BC in the European portion of the map.
I wonder where the actual limitation is here. Looking at the Unit::can_load function, which determines if one unit can be loaded into another, the condition for armies is only that the two units must have matching classes, not that the passenger must be a land unit. So at least in that way the developers left open the possibility for naval armies. One issue I can think of already with air armies is that air combat involves instant kills, in particular when a ground anti-air unit intercepts a plane, so either that would need to be changed or air armies really wouldn't be desirable."The Civilization 3 Conquests v 1.22 [...] "ARMY" option cannot be adjusted in naval unit actions or in air units. For this reason, the system does not allow you to complete the create army operation, however you can enable the option to load both ground and naval units and certainly air units and select the ARMY option in functions or skill characteristics.
I don't think that Air Armies are necessarily desirable. From my POV, the main issue I have with Armies, in general, of any sort is that Units of any sort can join an Army, whereas some ratio of, e.g., for Land Armies might be 2:2:1, Att : Def : Arty, and might be great.I wonder where the actual limitation is here. Looking at the Unit::can_load function, which determines if one unit can be loaded into another, the condition for armies is only that the two units must have matching classes, not that the passenger must be a land unit. So at least in that way the developers left open the possibility for naval armies. One issue I can think of already with air armies is that air combat involves instant kills, in particular when a ground anti-air unit intercepts a plane, so either that would need to be changed or air armies really wouldn't be desirable.
Sorry but I may be a bit clumsy...Thank you! That must be the improvement loop optimization at work. Down to 1-2 minutes from 15-20 is pretty amazing, the most I've seen in my testing is a turn time reduction of about 70%. In general the optimization should be more pronounced for mods that add many city improvements and those that limit how many cities can trade over water (because that shifts the bottleneck from actually computing the trade routes to checking whether cities can trade). There's even more I could do to speed up trade net calculations and a lot more I could say about it. I was planning to post a thread all about that, maybe someday...
Scripted events would surely be possible once Lua is integrated into the program, which would be a lot of work but I don't see any real technical limitations there. About spawning in a player in the middle of a game, that might be awkward due to engine limitations. Or maybe not, I've never tried it. Even if it's not possible you could keep a settler for that player on the edge of the map then move it into position at the appropriate date.
I wonder where the actual limitation is here. Looking at the Unit::can_load function, which determines if one unit can be loaded into another, the condition for armies is only that the two units must have matching classes, not that the passenger must be a land unit. So at least in that way the developers left open the possibility for naval armies. One issue I can think of already with air armies is that air combat involves instant kills, in particular when a ground anti-air unit intercepts a plane, so either that would need to be changed or air armies really wouldn't be desirable.
I have tried it but I can't get it to work in a coastal city with the Port.Your Naval army -- and specifically the boats you want to put in it -- may need to be in port in order to activate the "Load" action for the boats.