Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Arthanor

Pages: 1 [2] 3
16
Programming / [Patch][Test]Bullet saving patch!
« on: November 04, 2015, 03:34:51 am »
Picture this: You have this fancy gun. One magazine, which contains a dozen shots, costs a million. You have two. So you save the shots for when it's going to count. One day, you fire once when a chryssalid jumps at you and, upon your return to base, are told your clip with 11/12 bullets doesn't meet regulations. The quartermaster takes it back and doesn't have another to give you, so you're down to one clip. As you sadly walk away, you can hear him cackling with glee as he fires the other 11/12 shots! Same thing happens to your buddy when he goes to see the quartermaster after the mission.

That's how it was in XCom: If you had fired a shot, that clip was useless.

In OpenXCom: You're a bit more clever. First make a tally of all available shots for a clip type, divide by the number of shot per clip, and round down. So you put your bullets together and save a clip before going to see the quartermaster. It is a HUGE improvement, but it is not yet quite there. You still get short-changed on those leftover bullets that could have amounted to up to 99.999999999999999% of a clip.

So here comes my proposition:
Take those leftover bullets, divide by the number of bullets in a clip and that's your odds of getting a "free" clip. "FREE?!" you say? well, not really, but you are getting some extra bullets for free, IF you get the clip. If you don't, then you lose all the extra bullets you had.

Take a gun with 6 shots per clip. You fire 3 shots, you have 50% chance of getting a clip back. If you do, yay!, but next time you fire 3 shots, maybe you'll lose the whole 6 shots clip. Over time, it will average to losing a clip (=6 shots) every other battle, which means 3 shots per battle. Instead of the current situation where you lose a clip every time.

This is especially visible in some mods with special weapons of which you only take a few. For example, the Fusion Torch or Heavy Machine Gun. You take one, you fire once, you lose a whole clip. Annoyingly, it makes you gun-shy. But once you fire once in the mission, since you know you'll lose the clip, you can happily fire until you run out. I decided I'd go for a more average approach.

So I went into the OpenXCom code to look at DebriefingState.cpp, and I found:
Code: [Select]
https:// calculate the clips for each type based on the recovered rounds.
        for (std::map<RuleItem*, int>::const_iterator i = _rounds.begin(); i != _rounds.end(); ++i)
        {
               int total_clips = i->second / i->first->getClipSize();
                if (total_clips > 0)
                        base->getItems()->addItem(i->first->getType(), total_clips);
        }
This is how OpenXCom gets the total number of rounds, divides by the number of rounds per clip and it is rounded down since we are doing integer arithmetic. I think... Then if there are clips left, they are added back to the stock at the base.

The easiest way to implement my change is simply to add 0 to clipSize-1 "free" bullets at the end of the battle. If you get enough that the total goes once more over the clip size, you get a free clip. If it wasn't enough to make a difference, you don't and you lose all the extra bullets you had. I implemented this as:

- int total_clips = i->second / i->first->getClipSize();
+ int total_clips = ( i->second + RNG::generate(0, ( i->first->getClipSize() - 1 ) ) )/ i->first->getClipSize();


So say you had a clip of 6 shots and fired 3 shots. This would add 0 to 5 "free" shots, then divide by 6. If you get 0, 1 or 2 free shots (bringing the total to 3, 4 or 5), you don't get a clip back and lose your unused shots. If you got lucky with 3-4-5 free shots (total 6-7-8), you can a clip back. So you used 50% of your shots and you have 50% chance of getting the clip back.

If you had 3 clips of six shots and fired 3 shots, then you have 15 shots left, plus 0-5 "free shots". 0-1-2 gives you 15-16-17, so you get two clips back. 3-4-5 gives you 18-19-20, so you get 3. Theoretically, it should work.

In practice? I'm not 100% sure, since I'm not 100% sure that I coded it right (it's only my second patch for OpenXCom, and second attempt at coding in c++). I ran a quick trial by assaulting a base, firing 3 shots out of a weapon with 6 shots/clip and then aborting, repeat (ie go back to base and come back, not reload, although that could have worked with save scumming turned on). It took 22 missions to lose 8 clips. The expected number would be 16 missions (lose a clip every other mission), so I was lucky? Or I was dumb and coded something wrong.. Not sure.. The sample size is a bit small, but the experiment got boring ;)

17
XPiratez / Bugs & Crash Reports
« on: November 02, 2015, 05:10:03 pm »
Well, instead of all posting crash reports in the main topic, I thought it might be better to make a new one, where we can all share our evidence, so as to make it easier if ever someone wants to look at it.

The BASIC, MINIMUM requirement for a report is a save, with a description of what to do to get a crash. Ideally something as simple as "press end turn, shooting happens then the game crashes". Try to make a save as close to the crash as possible (ie just before pressing end turn) so that testers don't have much to do.

Extra info that is useful:
1 - Screenshot of the offending unit
2 - Info about the offending unit and how to circumvent the bug.

To get the extra info, it is sometimes useful to activate debug mode. You do that by going in your config folder (check here for where that could be on your computer), open the file called options.cfg, find the place where it says debug: false and replace it by debug: true. Then, in the game, before pressing the end turn button, press control-d, to activate the debug mode. This will allow you to see the whole map and watch as the enemy takes their turn.

Find which unit is active just before the game crashes and take a screenshot. Note the position of the offending unit, and then you can use that to find it in your save. For example, if the unit was shown as being at location (35,42,1) when you clicked on it (as shown in my screenshot below), you can then search your save for "- 35" and should soon find a place that looks like:

Code: [Select]
      position:
        - 35
        - 42
        - 1

which should refer to an enemy unit (something like STR_SPARTAN_RIFLEMAN or STR_SECTIOD_ENGINEER) Then note the id of that unit (typically something like 1000012), as it will allow to see all its items by searching for owner: 1000012. You can remove these items from the save, and see if the crash still happens.

Below is my first report:
1 - Save at deployment. Game will crash after Spartan Rifleman at 35/42/1 opens the door to the civilian.
2 - Screenshot of offending rifleman
3 - Removing equipment from the save did not help. Probably terrain issue?

18
Playthroughs / X-Piratez: Capt'n's Log
« on: October 03, 2015, 05:37:46 pm »
Capt'n's log - Dec 25, 2600

T'day, the crew stopped on an island in da Middle Sea. Good place as any fer an XMas dip! and not too many eyes to ogle the swimmers. Mad Marg'ret went in a cave and came back yelling 'bout something. What a find! Whole cave full of stuff in there! Big elevator at the front, then a hangar with the sleeping beauty in there, armed to the teeth! We're retiring the ol' boats and taking to the air. Brainer's callin' it the Bonaventura, for good luck or somethin'. Like we've gotten any luck on this rotten world... Until t'day! Bunch of bunks on the other side, and rooms full of stuff. At least we'll be comfy and we've got enough guns to throw out whoever comes knocking.. maybe.




Capt'n's log - Jan 1st, 2601


Stuff is going good! We got a bunch of places agreed they'll pay us to keep an eye on 'em, and the girls are getting used to this place. Harpy's Nest, it's been called now. That's us, gals stealing from those who have too much and taking care of our own.

The runts are trying to make stuff, they're telling me it's packing a punch but we'll see if it gets 'em sick.. Extra-Grog or something, they're callin' it, the gals just say X-Grog. One's good with numbers, we're supposed to make 5.3K from a barrel. Not sure who she got the price from, but that's not too bad. Crank 'em out runts! We need the money! Got some brainy ones looking at how we could make more of 'em guns. Never too many guns..!



Some of the gals are really takin' to this flying and gunning. Think it's time to shoot something down and get some real loot. I heard some saying they'll make themselves a new name in the business. New names.. what's that gonna be eh?

19
Programming / Script for compiling Linux nightlies
« on: October 01, 2015, 05:43:37 am »
Currently, I use these steps to compile my own versions of OpenXCom (sometimes Extended, sometimes normal, sometimes old versions for some mods, sometimes patched versions with extra features, etc. So I'll leave out the git stuff).
Code: [Select]
0.    make installation directory (called "srcdir" in these notes)
 1.    git clone git@github.com:SupSuper/OpenXcom.git srcdir
 2.    {copy XCOM1 assets into srcdir/bin/data}
 2*    For new data structure: cp -rp ../PatchedData/* srcdir/bin/UFO
 3.    mkdir srcdir/build
 4.    cd srcdir/build
 5.    cmake ..
 6.    ccmake ..
 7.    {set CMAKE_BUILD_TYPE to Release (or Debug if you want useful stack traces)}
 8.    {set CMAKE_INSTALL_PREFIX to /home/yourusername/bin/OpenXcom (or wherever you want OpenXCom to be installed: /home/jpaucl/XCom/OpenXCom/ThisBuild)}
 9.    {set DATADIR to define folder in which OpenXCom will look for the data subfolder}
10.    {configure, generate, and exit}
11.    make -j3
12.    make install

I think there is a method to make that into a script that will take care of most things, but I don't remember how to replace the definition of build type, prefix and datadir in a script.

Another thing is, as soon as I change a little thing (say add a few lines in one of the .cpp files), the "make -j3" command will recompile the whole thing (which takes forever on my crappy laptop), but that is quite unlike other makefiles I have seen, which only recompile the files that changed. What am I doing wrong?

20
Troubleshooting / Wrong mission zones in TftD?
« on: August 07, 2015, 06:44:08 am »
I'm no expert in regions and especially not missions with the new scripting stuff, but I decided to try TftD and noticed this.

My base is in the North Atlantic, but for some reason the aliens decided to launch their alien probe mission in the South Atlantic?

In fact, now that I look at it, my globe is a bit wonky, but that might be because it's a TftD globe and I haven't seen one in a long time.. Just seems odd that Free China is roughly in the Philippines, the Asian Coalition in India, and New Mexico in the water west of Mexico.

I've attached a save for the base/mission stuff.

21
Troubleshooting / Graphics overlap
« on: July 06, 2015, 03:36:17 pm »
I'm working on a new mod, generated my graphics the same way I have always done, but for some reason, they behave really weird. My new items seem to have a 2 by 3 "cloak field" no matter what size they are. They hide other items that are next to them, even though the engine knows the proper size of the item.

See screenshot below where an incendiary grenade hides one square of a laser rifle, even though the engine knows the grenade to be only 1x1 (the number of grenades displays in the proper place, and it indeed fits in a 1x1 space). The engine also knows that the rifle is there as shown by the tooltip on the "empty" square. It's really just a graphic issue.

I've used Falko's palette converter to make the images and it used to work fine. I think it's something to do with the ruleset(s), but I don't know what, so I attached the mod.

Thanks in advance!

22
Suggestions / Change hitSound on Explosions
« on: June 21, 2015, 09:57:40 pm »
I'm not sure if I am missing something, but I haven't been able to change the sound played when something explodes.

In the vanilla ruleset, every explody thing has the same "hitSound: 0". Presumably OpenXCom uses a similar system based on the explosion's power to determine the noise, like the original?

I have tried to import new sounds in BATTLE.CAT, which works fine for firing sounds, but did not change anything for hit sounds. Or do you need to change a different file?

I've attached a flamethrower ripoff mod I had been working on a while ago, in case anyone wants to test things. It defines a hitSound and the appropriate entry for BATTLE.CAT, but every time the flame jet hits the ground, a small explosion sound is played instead of the flamey sound,

23
Troubleshooting / Running multiple versions of OpenXCom
« on: June 15, 2015, 12:05:04 am »
I am trying to run multiple versions of OpenXCom. One for Piratez, one for a vanilla game.

I have two executables, with two data folders which I define upon compilation (by defining Datadir in ccmake).

Is there a way to define different config files and save folders? Currently, they both look into .config/openxcom and .local/share/openxcom folders. This means each version overwrites the other's config files, so you have to manually switch mods every time you switch. The saves are also shared, which clutters the space and overwrites autosaves.

24
Some weapons have a reload rate that vary depending on your stance. But you can't know that unless you look into the ruleset, a modder puts it in the flavour text, look it up online or time it yourself. In the vein of other "displaying more info" patches we are seeing, maybe something like this could be useful?

(Note: Laser cannon stats are not accurate :P)

25
Suggestions / Adding items to lists instead of overwriting them.
« on: March 13, 2015, 05:03:21 pm »
This is for mod compatibility, obviously.

When you define a research project that has an "unlock" or "getOneFree" property, the last mod loaded will overwrite any previous list from other mods or default. This makes it difficult to have multiple mods interact properly.

You don't want to list things from other mods in your "unlocks" list because you don't know if the user will actually have those other mods. But, if you don't and they do use the other mods, then some things won't unlock because their list was overwritten. The only option is a megamod that will combine both, but ideally mods should be modular and allow users to pick what they want to use.

Could it be possible to have the unlock and getOneFree lists for research projects behave like alien missions? In other words, what you list under unlock and getOneFree would be added to the list instead of replacing it, to replace a list you would have to first delete it.

26
Suggestions / Crash site after retaliation attack?
« on: March 10, 2015, 09:33:28 pm »
I was just thinking about base defences. They are pretty much shooting an UFO out of the sky, like interceptors do. Wouldn't it make sense if it created a crashed UFO next to the base? That would add an alternative to the base defence mission:

Defences succeed: Launch a cleanup mission with all soldiers from the base (or spawn a UFO crash site that the player can decide to clean up)
Defences fail: Base defence as usual.

27
Troubleshooting / No quicksave in battlescape?
« on: February 25, 2015, 07:30:14 pm »
I have started having this problem just today, where I can't use quick save or quick load in battlescape. I can still save manually going into options-> Save game and load as well.

quicksave/load also works in geoscape mode.

Anyone has any idea what could have gone wrong? I have checked and the hotkeys are not assigned to anything else either.

Thanks in advance!

28
Suggestions / tuUse or tuPrime for grenades
« on: February 25, 2015, 05:59:24 pm »
It would be interesting to have varying priming costs for different types of grenades.

Priming a good ol' grenade could be faster than a high explosive: Pull the pin versus setting up the digital detonator. It would also allow more customization of modded explosives.

Being able to use "flatRate: true" for priming explosives would also be convenient. Makes a veteran faster at priming complicated explosives than a newbie.

29
Troubleshooting / Funky report
« on: February 22, 2015, 11:05:00 pm »
I have noticed recently that my monthly reports are weird. Looking at my most recent month, a few minutes to midnight at the end of the month, I have $2,307,185.

I get a monthly report with the following information:
Income: $9,245,000 (+$842,000)
Maintenance: $9,627,000
Balance: $1,083,185

Looking at this, I have losses of ~400k, so I expect to start my next month with ~2 millions. However, when I go to the geoscape, my balance is indeed ~$1 million just like the report stated. So I've had losses of ~$1.2 millions!

Doing the exact math, I found that my "extra losses" are exactly equal to the amount in parenthesis next to the income. If you reload a save and go through a month again, the amount in parenthesis changes and the income with it. However, your balance and the money you have in geoscape on the first of the month stay exactly the same.

It looks like OpenXCom does:
Income = Basic Income + Bonus
Balance = Last month's money + Basic Income - Maintenance (No Bonus!  >:()

I have attached a save and screenshots, if anyone wants to duplicate that. (I believe none of my mods affect income, so missing some should be fine). I am running the nightly: 1.0gec4a302.

30
Suggestions / Ordering crafts in item lists and interception screens
« on: February 22, 2015, 08:13:26 pm »
I'm in the middle of a playthrough now, with 8 bases and getting close to 10 crafts. I just noticed that they are really all over the place.

Would it be possible to define a listOrder entry for crafts as well, which would be used to order them. Then if multiple crafts of the same kind are in a base, order them by ID. Somehow it works for vanilla crafts, you get:

Skyranger-1
Interceptor-1
Interceptor-2

when creating a game, but once you add modded crafts they go all over the place.

Having the same ordering in the interception screen would be handy too:

Skyranger-1
Skyranger-2
Interceptor-1
Interceptor-2
Firestorm-1
(etc.)

Grouping by bases is not really that convenient. The order within a base is still messed up and you can't reorder bases besides by editing a saved game.

Pages: 1 [2] 3