Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site forums as they ran on Ultimate Bulletin Board, 1998–2001. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 2005 site & forums

  Apolyton Civilization Site Forums
  CtP2-Creation
  Ctp2 class definitions needed!!!

Post New Topic  Post A ReplyPost A Reply In A New Window

profile | register | preferences | faq | search next newest topic | next oldest topic bottom of page
Author
Topic:   Ctp2 class definitions needed!!! Format for Better Printing
lozina
Settler
Mt. Kisco, NY USA
Mar 2000
posted December 13, 2000 02:43   Click Here to See the Profile for lozinaClick Here to Email lozina  send a private message to lozina
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
is there anyone out there who can give me a list of classes with their functions and variables used by the game? in order to write good scenarios you need to use SLIC which is just c++ and any moderate level programmer can use it- its just knowing the classes. in particular im looking for city_t class functions and unit_t class functions.

also any info on how "mod_CanPlayerHaveAdvance()" works would be appreciated... does the program automatically check this function if you put anything in or do you have to make a call to this function somewhere else???

hopefully a ctp2 programmer will find this post!

phenyl
Settler
Vancouver, BC
Dec 2000
posted December 13, 2000 03:43   Click Here to See the Profile for phenyl   send a private message to phenylSend a Message to UIN: 2046142
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
iozina,
here are two reference sources i came across. locutus also has info on his site
R.I.P. Locutus Home Page
http://www.activision.com/games/civilization/slic.html
apolyton.net/ctp/modification/

it seems we are both a little late in the game regarding mods, etc.. by poking around the forums and looking at people's pages i am gathering some info to make a start at it. you wanna maybe try and work together and share info?


Locutus
Prince
Apolyton Borg Hengelo/Enschede, The Netherlands
Nov 1999
posted December 13, 2000 08:51   Click Here to See the Profile for LocutusClick Here to Email Locutus  send a private message to LocutusSend a Message to UIN: 52912776 Visit Locutus's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
He, thanks for mentioning my site, phenyl I'm afraid I haven't updated the SLIC part in months though (it isn't called RIP for nothing ).

However, I'm currently working on extensive documentation for SLIC2, which will (hopefully) make it understandable for everyone, even for people without programming experience. Also, after the patch is released, Activision has promised to give out documentation as well, which will no doubt prove invaluable.

In the meantime, the documentation on SLIC1 is still very useful and also, if you have any questions, feel free to ask me: I've been working with SLIC2 for several months now (though it has undergone quite some changes in that time), so if I can't help you, most likely nobody can (well, except for the Activisioners of course)

Though I have only very limited experiences with C++ myself (still using either regular C or Java (or VB)), I wouldn't say SLIC is just C++, but it does resemble it as far as syntax goes. I've found that saying that it's 'just C++' only deters people with little or no programming-experience from experimenting with SLIC, which is unjustified 'cause I believe anyone could learn it.
One difference between C++ and SLIC is that SLIC doesn't have real classes. What you refer to as classes are in fact no more than structs: objects with several variables attached to them. They can't have their own functions or whatever. All functions in the game are 'regular' functions (the majority of which are documented in the SLIC documentation Mr Ogre wrote for CtPI).

The mod_CanPlayerHaveAdvance() and similar functions are really one of the most exciting new features of SLIC2. It indeed works as you describe: they're checked automaticly, just use it the same way it's used in the Alexander scenario and it will give you unpresidented power over what people can and can't build or research.

To get a full list of all functions, variables and events you should simply open up ctp2.exe in a hex-editor and perform a search on known functions and events (such as BeginTurn or mod_CanPlayerHaveAdvance). That should give you full lists of all these and even some, limited, info on some of them. Of course, I already did this and if you'd like I could post these lists tonight once I get home.
[This message has been edited by Locutus (edited December 13, 2000).]

lozina
Settler
Mt. Kisco, NY USA
Mar 2000
posted December 13, 2000 13:05   Click Here to See the Profile for lozinaClick Here to Email lozina  send a private message to lozina
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
phenyl,

yes that would be cool... im still trying to get a feel for how exactly slic works and how it and the program relate. but id be glad to share knowledge- after all two minds work better then one right? hey email me maybe u have AIM or icq so we can talk in realtime!
"lozina@cyburban.com"

Locotus: im currently trying to implement my idea on giving certain units prerequisite buildings. (like in order to build a fighter that city must have an airport + factory etc... whatever is rational unilke the current tech tree!!!) It's a pretty simple thing to do using mod_CanCityBuildUnit if i can figure out how to activate it... i also have lots of other cool ideas for ctp2 i cant wait to learn all the triggers and handlers so i can start on a mod. the thing is- i made a necessary scenario substructure under the ctp2 directory and put in only one file in \default\gamedata as mymod.slc (i assume the game uses default txt files for all other data u do not include under scenario subdirectories) in this slic file is a simple bit of code i copied off the nuclear scenario:

"int_f mod_CanCityBuildBuilding(city_t theCity, int_t theBuilding)
{
if (theBuilding == BuildingDB(IMPROVE_AIRPORT)) {
return 0;
} else {
return 1;
}
}
"

i then copied one of my old savegames into the \scenarioname directory and saved it as savegame.c2g- and ran the scenario expecting that i cannot build airports anymore (just to test that mod_ function) but it dosent work. do i need to make include statements in some file or do i need to make another slic file with something like HandleEvent(Building Buiding) or whatever its called? thanks for any info i really appreciate it! feel free to mail me too instead of replying on this forum. ill load up the exe on my hex editor now and see if i can find all the names (thats a good idea!)

Paul
King
Zwolle, The Netherlands
Mar 99
posted December 13, 2000 14:16   Click Here to See the Profile for PaulClick Here to Email Paul  send a private message to PaulSend a Message to UIN: 83134477 Visit Paul's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
lozina, SLIC is saved with the game, so you should start a new game to test your SLIC functions. If you load an old save it will not use the new SLIC functions you added. Other than that I'm not much of a LIC expert, so I can't tell if your function should work.
lozina
Settler
Mt. Kisco, NY USA
Mar 2000
posted December 13, 2000 14:20   Click Here to See the Profile for lozinaClick Here to Email lozina  send a private message to lozina
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
paul i love you! stupid me i was wondering what that "reload slic" button was for in the editor window! yeah i started a new game and its ok- now i can move on! thanks for pointing that out buddy
Locutus
Prince
Apolyton Borg Hengelo/Enschede, The Netherlands
Nov 1999
posted December 13, 2000 16:23   Click Here to See the Profile for LocutusClick Here to Email Locutus  send a private message to LocutusSend a Message to UIN: 52912776 Visit Locutus's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
Okay, I uploaded a XLS file to my site with some stuff I put together in a hurry. It ain't much but it's a start. If someone doesn't have Excel or whatever, email me and I'll send you the same info in text files. Tomorrow or so (whenever I have time), I'll try to convert the thing to HTML format or something.

Iozina,
Paul caught one problem but another is that you should either rename your file scenario.slc or 'include' it in scenario.slc using the line '#include "mymod.slc"'. If you don't do this, SLIC won't be able to find the code.

phenyl&iozina,
If you guys start emailing with eachother, feel free include me as well in the CC field or whatever, so I can share my knowledge with you when needed.

Locutus
Prince
Apolyton Borg Hengelo/Enschede, The Netherlands
Nov 1999
posted December 15, 2000 08:54   Click Here to See the Profile for LocutusClick Here to Email Locutus  send a private message to LocutusSend a Message to UIN: 52912776 Visit Locutus's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
In case anyone is following this, here's how Lozina and I got it working eventually (for the fighter example):

code:

int_f mod_CanCityBuildUnit(city_t theCity, int_t theUnit) {
if (theUnit == UnitDB(UNIT_FIGHTER)) {
if (CityHasBuilding(theCity, "IMPROVE_AIRPORT") && CityHasBuilding(theCity, "IMPROVE_FACTORY")) {
return 1;
} else {
return 0;
}
}
return 1;
}

Wes, something for the MedMod?

Alpha Wolf
Chieftain
Chicago Illinois
Nov 2000
posted December 15, 2000 10:45   Click Here to See the Profile for Alpha Wolf   send a private message to Alpha Wolf
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
But will the AI be smart enough to know it must build these first?

To me that seems the most difficult part of upgrading. People are smart enough to understand what needs to be done, but the AI doesnt and its not always easy it tell it what to do

------------------
History is written by the victor.

lozina
Settler
Mt. Kisco, NY USA
Mar 2000
posted December 15, 2000 20:14   Click Here to See the Profile for lozinaClick Here to Email lozina  send a private message to lozina
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
yes thats the hard part ive been thinking about. There's the BuildListSequences file i can edit,and the buildlists themselves. i still need to study the ai's building system thoroughly... =\
Locutus
Prince
Apolyton Borg Hengelo/Enschede, The Netherlands
Nov 1999
posted December 16, 2000 08:59   Click Here to See the Profile for LocutusClick Here to Email Locutus  send a private message to LocutusSend a Message to UIN: 52912776 Visit Locutus's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
Well, the AI doesn't have much of a choice. It simply must build factories and airports first before it can build fighters. If you feel the AI doesn't build these buildings soon enough, give them a higher priority in the buildlists or add the buildings to more buildlists or something like that. Shouldn't be too difficult.
Locutus
Prince
Apolyton Borg Hengelo/Enschede, The Netherlands
Nov 1999
posted December 16, 2000 09:10   Click Here to See the Profile for LocutusClick Here to Email Locutus  send a private message to LocutusSend a Message to UIN: 52912776 Visit Locutus's Homepage!
Edit/Delete Message    Reply To And Quote This Message
IP: Logged, Admin Access Only
Sorry, wrong thread...
[This message has been edited by Locutus (edited December 16, 2000).]
Apolyton Civilization Site Forums
> > > CtP2-Creation Forum

next newest topic | next oldest topictop of page

All times are EDT

Administrative Options: Close Topic | Archive/Move | Delete Topic | Top
Post New Topic  Post A ReplyPost A Reply In A New Window
Hop to:

Contact Us
Apolyton Civilization Site

Powered by: Ultimate Bulletin Board, Version 5.44a
© Infopop Corporation (formerly Madrona Park, Inc.), 1998 - 2000.

Front Page | Civilization III | Dinosaurs | Civilization II | Call to Power | Call to Power II | Alpha Centauri | Alternative Civs | Misc | Links | About ACS | GameStats
GameLeague | Scenario League | Hodadian Award Central | Civilization Scenario Collection | Spanish CivII Site | Clash of Civs | CtP Maps | Art of War