Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2 3 4

Author Topic: Modding questions  (Read 9110 times)

SlatersQuest

  • Bay Watcher
    • View Profile
Modding questions
« on: December 09, 2013, 11:48:54 am »

Hello,

I guess it was only a question of time before I started modding.

I'm going to keep this thread and update the opening post (this post) as I get more questions and as existing questions get answered.


Current questions:

4. How does the game generate maps for sieges in safehouses that have existing maps (e.g. university apartments, downtown apartments, captured CCS bases, etc.)?

Answered questions:

1. I'm trying to get the Conservative Crime Squad to attack specific locations, in this case the city park (this is for plot reasons). How do I do this?
Answered in post 2 by Jonathan Fox.
Summary: The indices of the locations[] array is built by the game and does not correspond to the enumerated locations list in locations.h. Instead, there is a find_site_index_in_city() function that will look up an appropriate site. The first argument is the type of location (e.g. SITE_OUTDOOR_PUBLICPARK for the park), and the second is the city (e.g. SITE_CITY_SEATTLE for Seattle, Washington). If the second argument is -1, then the function will simply find the site without bothering for a city (and is ignored if not playing with multiple cities). Also, targeting locations that the CCS is forbidden from raiding (such as the CEO's house) will cause special CCS events.
Notes: also take note of the squadstory_text_location() in squadstory_text.cpp; it has several names, dialogue, etc.

2. Why are several different cities and political issues commented out?
Answered in post 7 by Jonathan Fox.
Summary: Various reasons, but largely that there's no (unique) content for them, either because it was removed from the game for being repetitive (views) or hasn't been added yet (cities)

3. How does the CIA determine whether to justify the CCS' existence if exposed?
Answered by Jonathan Fox in post 12, but see also post 9
Summary: It doesn't. As of this writing (22 December 2013), the FBI will destroy the CCS if it is exposed irrespective of the LCS' behavior prior to the exposure. The wiki is in error (for now).
« Last Edit: January 03, 2014, 06:42:49 pm by SlatersQuest »
Logged

KA101

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #1 on: December 12, 2013, 02:49:32 am »

I'd have to say trial/error and take notes?  Let us know--I haven't any idea how to mess with the newspaper.
Logged

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: Modding questions
« Reply #2 on: December 13, 2013, 09:34:40 pm »

Hey hey, sorry for not replying sooner. As you've figured out, ns->loc isn't the type of location as defined in locations.h, but the index of a specific location of that type in the locations[] array, and those don't match up; there can be multiple parks in the locations[] array, for example, all sharing the same type as defined in locations.h. Fortunately, there's a function that will track down an index corresponding to the type of location you want:

Code: [Select]
ns->loc = find_site_index_in_city(SITE_OUTDOOR_PUBLICPARK, -1);
As suggested by the function name, the second parameter allows you to pass the city you want to search within (like SITE_CITY_SEATTLE). However, you can pass -1 if you don't care about the city, and the second parameter is ignored either way if you're playing in single city mode. If there are multiple valid locations it could give you an index for, it'll just give you the first one it finds.

Let me know if this works for you or if you're having any other trouble.

Additional Edit: Also, take note of the squadstory_text_location() function in squadstory_text.cpp -- it provides alternate names for several possible locations when showing news stories about CCS hits. So, for example, the CCS won't raid the CEO's House, they'll raid the "Richard Dawkins Food Bank". This could be a source of surprises for you if you set custom CCS raid targets, or alternatively, it could be a target for modding if you want to set up some custom overrides.
« Last Edit: December 15, 2013, 03:25:42 pm by Jonathan S. Fox »
Logged

SlatersQuest

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #3 on: December 13, 2013, 11:24:42 pm »

Hi Jonathan, thank you very much! I edited the opening post so that other people can easily find your answer!
Logged

SlatersQuest

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #4 on: December 15, 2013, 09:42:30 am »

By the way, quick clarification: it's find_site_index_in_city, not find_site_index_by_city, for anybody trying to do the same thing. I'm putting that in the opening post, too. :)
« Last Edit: December 15, 2013, 11:35:15 am by SlatersQuest »
Logged

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: Modding questions
« Reply #5 on: December 15, 2013, 03:25:28 pm »

By the way, quick clarification: it's find_site_index_in_city, not find_site_index_by_city, for anybody trying to do the same thing. I'm putting that in the opening post, too. :)

Thanks for the correction, I'll edit my post to avoid having misleading information there too.
Logged

SlatersQuest

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #6 on: December 15, 2013, 05:51:59 pm »

Thank you!

I have another question, by the way: looking through the code, I see several pieces of game content that have been commented out. Among them are:

-A couple of laws and views, including VIEW_POLITICALVIOLENCE and VIEW_MILITARY.
-They're not really commented out, but I see location numbers for several cities not currently in the multi-city mode (Detroit, Chicago, Atlanta, Miami).

These are just things I'm seeing. Some of them (especially views on political violence and the military) seem interesting to play with. Is there any particular reason why they're commented out (e.g. are they buggy, just incomplete, or intentionally left out)? What would be the consequences of uncommenting them?

Thanks again!
Logged

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: Modding questions
« Reply #7 on: December 16, 2013, 01:45:05 am »

It varies, there isn't any consistent answer for all examples of content that isn't in the game but that some code exists for. There's no content for the unimplemented cities. Political violence is from an earlier version of the game; the design I wrote for the concept ended up being less fun than I'd hoped, so I removed just a couple versions after adding it.

For political issues, many aren't fully implemented, or no gameplay to back them up (eg, some might have no sites to raid), or there could just be low benefit for adding them. There are a lot of views and laws in the game already, and adding more without adding unique gameplay to support them makes the game more grindy (need to do the same action over and over on different issues to win). This has made me hesitant to take the kitchen sink approach to adding new issues. Which is probably more Conservative than Toady would have been (I love how many kinds of rock there are in Dwarf Fortress), but there you have it.
Logged

SlatersQuest

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #8 on: December 18, 2013, 07:40:06 pm »

New question: according to the wiki page on the Conservative Crime Squad:

Quote
As of 4.06, you can find a "CCS Backer List" in the CIA computer. Unless your squad has been extremely violent (and we mean extremely), publishing this will cause the CCS to be raided and disbanded within six months. In a few cases, it will just dramatically increase their unpopularity. In the worst of cases, the CIA will justify the CCS as being necessary to stop the LCS (this only happens when you have killed quite a lot of innocent people).

*

I've been searching all over for the code that does this. I have a feeling that I'm not looking for the right thing. Can you maybe tell me where I can find it? Thanks!  :)
Logged

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: Modding questions
« Reply #9 on: December 18, 2013, 08:20:40 pm »

Depends on what you're looking for exactly. The meaty stuff destroying the CCS is in news.cpp, but the steps leading up to that are in mapspecials.cpp (getting the backer list) and lcsmonthly.cpp (initially publishing it).

Step 1) src/sitemode/mapspecials.cpp: The LCS raids the Intelligence HQ and activates special_intel_supercomputer(). Upon passing the checks, the global variable ccsexposure is advanced to CCSEXPOSURE_LCSGOTDATA (preventing the LCS from getting two copies of the data), and is provided with a Loot item of type LOOT_CCS_BACKERLIST. (Alternatively, this item can be acquired through a CREATURE_CCS_ARCHCONSERVATIVE sleeper's monthly action, in src/monthly/sleeper_update.cpp.)

Step 2) src/monthly/lcsmonthly.cpp: The LCS is prompted to run a special edition, as in any other month in which they have documents that can be run in the Liberal Guardian. On line 448, the behavior for running LOOT_CCS_BACKERLIST as a special edition is defined, with some specific text and public opinion impacts. But the thing that triggers the eventual downfall is advancing the global variable ccsexposure to CCSEXPOSURE_EXPOSED.

Step 3) src/news/news.cpp: generate_random_event_news_stories() is called each day, and gives a 1 in 60 chance of calling advance_ccs_defeat_storyline() if ccsexposure is in a place where news stories can advance the storyline. advance_ccs_defeat_storyline() makes a news story by calling either ccs_exposure_story() or ccs_fbi_raid_story(), depending on ccsexposure. These are at the end of the file and construct the news story, also doing any extra work needed to implement the effects of the story, like flagging the CCS as destroyed, advancing ccsexposure, arresting your CCS sleepers, etc. The text of the stories are in the middle of the file, in a switch statement over the ns.type of the news story, under the newsstory types NEWSSTORY_CCS_NOBACKERS and NEWSSTORY_CCS_DEFEATED.
« Last Edit: December 18, 2013, 08:22:50 pm by Jonathan S. Fox »
Logged

FinetalPies

  • Bay Watcher
  • Even on the battlefield.
    • View Profile
Re: Modding questions
« Reply #10 on: December 19, 2013, 07:32:52 pm »

So is it possible to publish the backer list and have the CCS not disband?
Logged

SlatersQuest

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #11 on: December 21, 2013, 12:52:33 am »

Thanks - I was able to find most of these functions, although I didn't understand quite how ccsexposure works. What I was wondering, though, is basically FinetalPies' question: where is the determination that checks to see if the LCS has been so violent that the CCS is justified (and thus the CCS is not eventually destroyed despite the LCS' exposing it)?
Logged

Jonathan S. Fox

  • Bay Watcher
    • View Profile
    • http://www.jonathansfox.com/
Re: Modding questions
« Reply #12 on: December 22, 2013, 12:08:10 am »

Thanks - I was able to find most of these functions, although I didn't understand quite how ccsexposure works. What I was wondering, though, is basically FinetalPies' question: where is the determination that checks to see if the LCS has been so violent that the CCS is justified (and thus the CCS is not eventually destroyed despite the LCS' exposing it)?

Oh, there is none, at least in the code I wrote. Someone might have been mistaken!

You could add that, however; you'd just need to track the level of violence the LCS has been engaged in, probably in a global variable somewhere. You'd need to make sure to change saveload.cpp to make it save and load that violence level information!
Logged

SlatersQuest

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #13 on: December 22, 2013, 11:11:05 pm »

Got it, thanks!
Logged

SlatersQuest

  • Bay Watcher
    • View Profile
Re: Modding questions
« Reply #14 on: January 03, 2014, 06:44:56 pm »

Hmm... guess I need to ask it here.

The big stumbling block in my path for the Terra Vitae mod is that I don't know how maps are made for sieges, especially in those areas that have maps for them already. For instance, suppose that the LCS takes over the Desert Eagle Bar & Grill and then gets besieged by the CIA... how is the map generated and what determines the LCS' starting position on the map?
Logged
Pages: [1] 2 3 4