DLL Modding

HolmstN

Chieftain
Joined
Sep 16, 2009
Messages
29
From this thread.

Objectives:

  • Familiarize with the code base and team structure in order to operate smoothly
  • Create a solid code foundation for a Civilization 4 Star Wars mod

High Priority Tasks:
  • Domain-Terrain relationships

Middle Priority Tasks:
  • Promotion Expiration Tag
  • Superweapons AI
  • Python Buttons AI

Low Priority Tasks:
  • Unit Creation on Project Completion
  • Unique Building AI Conquer

Please post any requests for DLL implementations here. Also when posting, place a "rank" of importance for the request. This way, we can go through and logically maneuver into the SDK.
 
Welcome to the mod team! :)

As the person doing the python modding (Python callbacks, if you don't know, are called from the SDK and allows you to make things happen without editing the game core) I have some things that would be better done by making some tags in the SDK or other stuff. The DLL/SDK/C++ runs a lot faster then the Python.

Fall from Heaven 2 has a tag in CIV4PromotionInfos.xml that allows a promotion to have a chance of being worn off each turn. I want to do something similar, and so I've just used onBeginPlayerTurn, a python function, to remove certain promotions, rather then add a tag there. So I think adding the iExpireChance tag to promotions would be something useful to have. Middle Priority.

Less important would be adding some tags to CIV4ProjectInfos.xml to cause units to be created in the city making the project on project completion. (A "UnitClassCreated" and "iUnitsCreated", one getting the unitclass and the other the number of units created). I've used onProjectBuilt in the python to cause superweapons to be built. Low Priority.

There's probably other stuff, but these are the first requests I made in the other thread, so I thought I'd repost them here with a little more detail.
 
Alright thanks! I appreciate the formatting, I work better with a pattern-based format, hehe. I'll start putting some things together and let you know how it's going as soon as I can.

Is there an easy way to contact you, by the way, AIM or xfire perhaps? Some simple questions are better asked through those methods, hehe.
 
The easiest way is to probably send me a PM here, on CFC, if you need anything. I answer those as quickly as possible, usually.

Also, here's a useful tutorial on the SDK, if you need any help (if you haven't already seen this). While I haven't actually done any work with it yet, I've gone through the tutorial and began learning about the SDK side of things, and found it a pretty good help.
 
Ooh, thanks for the tutorial link. The biggest and hardest opponent in coding is having to figure out all the different relationships the original creators decided to use. Of course I'm sure you're at least slightly familiar with this as XML isn't necessarily all that different (but the XML tool really helps! :lol:). This'll speed up the process quite a bit as I don't have to go searching for every blasted little detail, muahaha.

:crazyeye:
 
Do you think you might be able to do AI programming. TC01 has some new game concepts that we'd like the AI to use. These are the python buttons, the superweapons, and possibly later on you could influence them to capture planets with the unique buildings.

Python buttons AI: Middle Priority

Superweapons AI: Middle priority I'd prefer you do this before the python buttons because I think the AI could really use the superweapons. If we don't let them use it iit gives the human too much advantage.

Unique buildings conquer AI: Low Priority This one was just an idea I'd had since a whole bunch of people will naturally go after the unique buildings so they can build themselves a better army. This is probaly something you could do after we release version 1.

Hope I'm not giving you too much to do I have no skill in AI programming so I thought you might be able to do it. There isn't a tutorial to teach you how to do this.
 
The problem with the python buttons is that instead of doing them properly by adding new missions to the SDK (and, I have no idea how to actually make a mission I add to CvEnums.h do anything) I added them in python- the AI has no clue that they exist. So to make them able to do anything, you would need to either:

a. Do some serious python scripting in, well, python. The AI would be made to do use specific powers at certain times in the game.

b. Move the buttons to the SDK.


I don't know how much of an issue the superweapons would be. The AI understands how to make a unit nuke stuff, right? (One issue might be getting them to build the projects that create the superweapons... the AI should be weighted to build projects that generate units).

Again, the issue is that since the different nuke effects are handled in python, getting the AI to understand when to use which one would be challenging. A possible method would be adding tags such as "bSunCrusher", "bDeathStar", "bWorldDevastator" to CIV4UnitInfos. All this would mean is that marking a unit "bSunCrusher" means the AI will handle it in a certain manner (targeting non-space terrain surrounded by lots of units) whereas the bWorldDevastator tag would cause it to target planetary terrain regardless of the number of units or not...


By Unique Buildings AI... you mean the "planetary buildings" thing? This is probably the easiest request, since all you would have to do is make the AI go after cities with specific buildings- i.e, the planetary buildings.
 
Following along with TC01's thought, Superweapons are (ideally) going to be units created from projects, correct? If that's the case, the AI can treat them like any other unit and "special abilities" can be tagged onto the unit. It may even be easier to add a unique trait that can carry through the Superweapons rather than actually do anything too fancy.

Think of it like a Unit Promotion. All Death Stars have the "Look at the pretty green laser and DIEEE" promotion, but differing Death Star units (IE, Death Star I, II) might have different traits (such as attack and defense power). With this line of thought, just like a nuke, the AI should be able to catch on. Additionally, it makes coding the Superweapons at that much easier. Oh, and also they could all be tagged with some sort of "Threat" tag that makes AI more inclined to attack said unit.


Now, you'll have to excuse my idiocy here. Which python "buttons" are you referring to? Having not played the build, I'm working a bit blind here, hehe. :mischief:
 
One of civ editor's first requests was a system akin to the Fall from Heaven 2 spell system (actually, if you used something like that it might make this easier), where certain units would be given access to "Force Powers". I also added a special ability called Ion Blast for fighter units. If you want to look at the code for this, the necessary files are CvMainInterface.py (in Assets\Python\Screens), StarWars.py (in Assets\Python), CvEventManager.py (in Assets\Python) and CvGameUtils.py (in Assets\Python).

There's a tutorial linked in my signature on how to make python-only buttons like these, for more detail on how I did it. But the way this works is that the AI doesn't even know these buttons exist.
 
A list of things I think should be in the dll:

AI:

Prioritize capturing planets
Bombard and invade, or just huge invasion (star wars invasion strategy)
More aggressive AI
AI that expands quickly (Risks more, to expand)
Is focused on dominating the galaxy, not on culture not on defence
Using hyperlanes ???
Blockading
Hunting mobile enemy (aka: the Rebels)

Other:

Remove citizens; make production cost credits and time; ships can only be build on worlds that have shipyard, and then only ships they are allowed to produce (Kaut=star destroyers)

Make mountains passable again (see mountains back into service)

Thats all I can think of for now:

Also if you need help merging I can help; I know a little C++ and can (probably) compile dll's; I am well averse in the use of WinMerge
 
I seem to be running into some compile trouble. Does anyone have the SDK? Can you do me a favor and check for "CvGameInterface.cpp"? I don't have the file but the compiler is looking for it for some reason.
 
Here the file is unmodified and from 3.19.
 

Attachments

  • CvGameInterface.7z
    106 bytes · Views: 210
There is no header for it in my DLL.
If you could would you change domain air, land, and naval/sea. I would like domain land to not be able to go into tundra/Space or Orbit. It would be good if domain Air couldn't travel into Space/Tundra, but it can move like domain land. Is that possible? I woulld like domain Naval to be able to go anywhere including over planets because that happened all the time in star wars.
New Terrain Types: If you can do it High Priority
 
Alright then, thanks :)

I'll do what I can with the domains, I'll keep you in the loop on its progression as I take a look inside.
 
Thank you do the best you can
 
Ok sorry it's been so long, been a busy couple of weeks for me.

For the Domains, what do we want DOMAIN_SPACE to do? If it's similar enough to AIR, I feel we can just use AIR and NAVAL to already do what we want without the need to add a new domain.

What are the Python buttons that you want implemented?
 
Ok sorry it's been so long, been a busy couple of weeks for me.

For the Domains, what do we want DOMAIN_SPACE to do? If it's similar enough to AIR, I feel we can just use AIR and NAVAL to already do what we want without the need to add a new domain.

What are the Python buttons that you want implemented?

Essentially, all the domain should do is allow a unit to go over both land (planets) and water (space). So, I don't think there's any reason to create a new domain at all, just use Water and make Water able to use all terrains, both land and water.
 
Essentially, all the domain should do is allow a unit to go over both land (planets) and water (space). So, I don't think there's any reason to create a new domain at all, just use Water and make Water able to use all terrains, both land and water.

Ok, sounds good to me and much easier a fix- just remove a couple lines of code :lol: Are there any 'special circumstances' with the Terrain that we want this new Sea Domain to be affected by?
 
Just to let you all know, anything classified in the Sea domain should be able cross land and sea now. I have yet to test it in-game for sure, but the code is all in place and simply needs to be compiled and uploaded if anyone feels like taking a gander.

Still a couple of questions floating:

1) Python buttons, a list of them needed implementation (and their function preferably)

2) Any special Domain qualities DOMAIN_SEA should have besides being both land-and-sea capable.
 
Top Bottom