Jump to content
XCOMUFO & Xenocide

Pyxcom


Recommended Posts

MONSTER POST WARNING! :blablabla:

 

Ok, its kind of a gaming aid, kind of an editor. Not sure which forum to put it in. Probably a better term would be an editing platform. It originated in another thread where I was wanting to fuse Python, XCom, and DOSBox.

 

It's not exactly as easy as I thought it would be (happens to me all the time) but I do have working python code that can manipulate and read most of the game files. There is no 'interface', atleast not a user interface. I've just been using the python interpreter right now, but I'll be working on scripts to make it more 'user-friendly'.

 

Probably the most 'practical' thing in here right now is the soldier renaming script. It can parse the first, and last names (along with a stat string), and the it will be thrown into a function where you can create your own stat strings. This was one of the motivations for this project as I feel somewhat limited by XCom-Util's system. Don't get me wrong it's a nice and clever system, but you can only add 1 letter at a time or else the entire process stops.

 

This one is done completely through python, an interpreted language so you have a bit more control, and in some cases ease. One thing I didn't like was the 'ranks' XComUtil would use. It just simply started from A and went up to F for each rank. Over time I got a bit used to it, but in the game I'd be like... C? what rank is that... let's see, rookie, squaddie,... sergeant?

 

There was also no way of controlling how it mangled the soldiers names. This one can, but can be a bit tricky. Also, it is possible for the script to get information on the base or craft the soldier is at, or even the armor. While the Base and Craft aren't included right now, it wouldn't be difficult.

 

So ok, let me explain the current status a bit here:

 

What PyXCOM currently is/does:

  1. Can view and change values of most XCom Save files (and OBDATA.DAT)
  2. Can save these changes
  3. 'Smart' readers that can link up to other files such that you can find what armor the first soldier on the first craft at your first base has (which requires use of SOLDIER.DAT, BASE.DAT, LOC.DAT, and CRAFT.DAT in concert)
  4. Relatively fast, Python has to be the fastest interpreted language I've seen, this is furthered by the fact that I've designed this from the bottom up to only load files when necessary and only parse entries needed. Thus if you never touch ASTORE.DAT, it will never be loaded (nor parsed). If you just want to look at the layout of your first base, BASE.DAT will be loaded and only one entry parsed.

What PyXCOM CURRENTLY is NOT:

  1. Easy to use editor for non-programmers (no user interface)
  2. Easily deployed, (you need Python as well as this, and of course XCOM)
  3. A complete editor

With that said here are my plans:

  • Develop some kind of interface. Will probably be using the DOS command line first (eg: C:\UFO>python rename.py GAME_1), then maybe an actual command line interpreter as supplied by python. I'd like to get a GUI going with a mouse, which can be easily done... on modern machines. The problem is using a pure DOS envinronment as Python was developed after those golden years. I might do a 2 step solution, one with a nicer GUI that requires a modern machine, and another more archaic one that can run where XCom can run.
  • Fixes - I'm hoping to possibly correct some issues left over in the game. One of which is the little known bug of 'complete' dirt modules. This can happen with editors like ClarkWheyr or even in normal games. Basically a module that is dirt is completed, but actually eats up monthly expenses, though they are not displayed on the Monthly costs screen.
  • Better Soldier Equipping. Even with the Stat strings you usually have to usually manually equip the soldiers. The ingame engine and even XComUtil's is pretty darn good, but there's no real customizing. While XComUtil says you can assign a load out to a particular soldier, I haven't gotten this to work (currently I think it's because I don't have a soldier at every base of mine, which the readme says is a requirement, why don't I just put soldiers in those bases? Because they are new and don't even have living quarters yet! I'm more worried about getting a radar or hangar or stores first.) That all said, I'm hoping to still have a 'generated' load out that could be customized and slightly more intelligent. I hate how it puts the heaviest weapons on soldiers that can't handle them, and how it tries to allocate every piece to every soldier.
  • Add some realistic features to the game - One idea spawned is to modify base defense. Stripping away aliens according to how much defense the base has. Another I have is limiting Heavy Plasmas to commanders/leaders, or only to larget UFOs, or until a certain amount of time has passed (basically user customizable).
  • Going along with this, it might be possible to have multiple radars of the same type have a use. Since the Long range and Short range detection are stored in a file, we could override them according to how many radars the base has. Only issue is when another radar is completed the game will probably remake its values and you will have to apply the patch again, but see the next entry
  • Monitoring system - Another issue I had with XComUtil's renaming was that it was always 1 battle behind, since stats aren't updated until in Geoscape which is after XCU runs. What I actually did was saved the game, switched to a seperate DOS prompt on my computer and issue the XCU command to rename it and then reloaded the file. I'm hoping to make a program or something to automatically 'patch' any saved games, updating soldier names, removing bad 'dirt' modules, updating base Radar stats, etc.

Of course any of these 'fixes' will be able to be turned on or off easily (I hope). I'll post what I have so far here, if anyone cares it's under the GNU license. Feel free to fork off this project if you got an idea of what to do. I'm sure it could be used in the future to grab empirical data for people like Zombie.

Link to comment
Share on other sites

Well I seem to have gotten ahead of myself....

 

I was trying to replace the ingame soldier equipment screen with my own, but I need the tactical engine to generate stuff and it seems to assign weapons and all.

 

It seems to follow most of what what you put down, but any left over weapons, 'nades, ammo on the ground it will automatically assign.

 

Also if I load the weapon with ammo, it seems to dissappear when you run tactical.

 

I experimented with a 'hidden' place where you could put items so that they won't show in the initial equipment screen but when I do that it seems to hide it from Tactical altogether. I know it keeps the items, because after a battle I still had the items I 'hid'. So it should be possible to save the game, run a util to 'unhide' the weapons and presto. Which this should only be needed in very special circumstances.

Link to comment
Share on other sites

I used to have a quick way of editing its called

 

OPEN THE XCOM SOLDER EQUIP SCREEN

 

Too bad that's not really editing, as you cannot, say... EDIT THE SOLDIERS. Unless you consider changing names and equipment editing.

Link to comment
Share on other sites

Heh, the purpose of this was mainly to help equipping soldiers. The in-game one is very basic, it doesn't even show the statistics of the soldier hence why people put stat strings in the names.

 

Also it doesn't seem to remember the last layout of your soldiers, so each time you have to assign your soldiers what you want. I was hoping to make a loudout editor to make this process much faster. Similar to what is in UFO 2000, allowing you to copy paste loadouts and save/load teams.

 

I did say I wanted to 'replace the ingame soldier equip screen', what I really meant was the first soldier equip screen when Tactical starts, the initial load out of your soldiers.

Link to comment
Share on other sites

Ok, I've made some major updates to this, and hopefully a usable interface for PyXCOM. I'm hoping the installation details aren't to complex but basically if you are running the Windows version you will need to have the executable split for the soldier equipper to pop up, everything else should work even with a combined exe.

 

Basically unzip this to a folder in the same parent directory as XCOM, that is if XCOM is in 'foo\bar\ufo', place this in 'foo\bar\pyxcom' but you can name pyxcom whatever you want.

 

You will need Python (which should have Tkinter), and of course XCOM

 

I'll leave the rest of the nitty-gritty details for the readme.txt. But I'll copy-paste the current 'features' from there.

 

Also note that this only scratches the surface of what can be done with the modules in inforead, this is only the stuff I've taken the time to write an interface for.

 

Enjoy, and please post any concerns or problems here.

 

1. Base Fixing  
  * Will fix completed 'empty' modules that can be a result from using other editors or from simply
 dismantling a Base module without putting anything there to replace it. These modules will eat monthly costs,
 unless they are fixed
  
  * Will fix 'phantom' radars as discovered by NKF. When you dismantle a radar at a base, the base will still
 retain it's scanning ability of that radar until another radar station is completed (Small, Large or Hyperwave)
 This will fix them and force any saves to have the correct values

  * Can Adjust radars. Contrary to what the in-game UFOPaedia says, extra radars of the same type will not aid you
 in any way. The values that control how a base scans have been discovered and this program can count the 
 facilities you have to increase these variables. I have not tested if this actually does raise performance
 of a base or not, but I would imagine so.

2. Precombat
  * Currently I have an unfinished soldier equipper for the initial load out of your squad. I have disabled options
 that have no implementation yet(mainly saving and loading loadouts) but are planned. You can copy and paste
 a loadout of a soldier to other soldiers (will give warnings if no extras are found).

 There is a basic 'smart equip' available that isn't finished yet. It will simply allocate weapons to your 
 squad (first 2 handers, then 1 handers if anyone still needs a weapon). The main function is that it will take
 the weight of the weapon and ammo into account with the soldier's strength. Thus it should give the heaviest 
 weapon to the strongest soldier, 2nd heaviest to 2nd strongest, etc. In the future I plan on having it also
 give grenades on the shoulders, medikits in belts, possibly psi-amps based on psi-skill, secondary weapons,
 possibly flares if a night-time mission. 

 The main purpose of this little utility is to replace or aid with the in-game's aweful equipping algorithm. 
 (It never fails to give a 24-29 strength guy a Rocket Launcher or Auto-Cannon for me)

3. Soldier Renamer
* This is normally disabled, as you may or may not want your soldier's renamed according to stats or the same 
  way I like to name them. You can customize these options in mystats.py. To enable it you can click the check
  box named enabled and press the start button or edit pyxcom.py near the end to 
	  addModule(True, SoldierRename...
  like the others around it, (I'll have it has an option in userconf.py soon)
 
  The advantage this renamer has is that it monitors all save games. So when you save a game it will rename the
  soldiers automatically (should take less than a second, depending on the logic in your naming). It also does
  this when you go between geoscape and tactical just like XComUtil, but with this, you can save your game and
  reload it to have the stats updated, something you would have to do manually with XComUtil.

pyxcom.zip

Link to comment
Share on other sites

  • 2 months later...
  • 3 weeks later...
Guest Azrael
Ok, I've made some major updates to this, and hopefully a usable interface for PyXCOM. I'm hoping the installation details aren't to complex but basically if you are running the Windows version you will need to have the executable split for the soldier equipper to pop up, everything else should work even with a combined exe.

 

Basically unzip this to a folder in the same parent directory as XCOM, that is if XCOM is in 'foo\bar\ufo', place this in 'foo\bar\pyxcom' but you can name pyxcom whatever you want.

 

You will need Python (which should have Tkinter), and of course XCOM

I'll leave the rest of the nitty-gritty details for the readme.txt. But I'll copy-paste the current 'features' from there.

Link to comment
Share on other sites

Yes, right, but not what I was getting at. I do have python installed, but the installation notes in the readme file refer to 2 batch files that are not included in the package:

 

*****INSTALLING/RUNNING*****

...

***DOS***

...

2. Copy pyxcom.BAT into your UFO folder. You should run this program (by typing pyxcom at the prompt) instead of

go, xcom, or runxcom (XcomUtil).

...

***Windows***

...

2. copy pyxcom_Win.bat into your UFO folder. (NOTE: if your UFO folder is not called UFO but UFO Defense you

will need to edit your userconf.py) Run this (by double-clicking) instead of UFO Defense.exe or runxcomW.bat

to use pyxcom

 

NOTE: You will need the executable split to geoscape.exe and tactical.exe in the UFO root folder. This is done by

XComUtil.

...

 

Maybe I downloaded the wrong zip file?

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...