OpenXcom Forum

Modding => Work In Progress => Topic started by: psyHoTik on March 17, 2016, 08:36:29 pm

Title: psyHoTik's experiments
Post by: psyHoTik on March 17, 2016, 08:36:29 pm
Here I will post my useless, lame, noob, unprofessional, untested, unlicensed builds. They are done mostly for fun and testing but maybe (by accident) some of them will be even playable ;)

Experiment 1 - Alien Snipers
The goal was to give the aliens the ability to shoot at revealed targets they don't personally see, just like X-com soldiers do in most cases (you fire at enemy spotted by another soldier). In theory this could make game more challenging and unarmed or weak enemies would still pose a threat as they could relay your position to their buddies. The build actually works and such game may be even considered fun...

...BUT...

...there is a huge side effect. If you meet an alien during your turn and he saw you, then your soldier will be visible to AI during subsequent alien turn, even if you run into a dense smoke, far away from any enemy eyes or kill the spotting alien. This means this soldier will be sniped even if no longer visible to any alien. The problem is that turnsSinceSpotted is updated every "full" turn (X-com+alien). This idea requires it to be updated every half of the turn, like grenade timers. I wonder if this could be done without corrupting too much... Anyway, feel free to test it yourself :)


Problem solved, now it should work as planned :) The change, however, effectively halved the alien intelligence parameter as TurnsSinceSpotted is updated twice a turn. Multiplying intelligence by 2 will be required to keep the status quo.
Title: Re: psyHoTik's experiments
Post by: yrizoud on March 17, 2016, 11:12:29 pm
The change, however, effectively halved the alien intelligence parameter as TurnsSinceSpotted is updated twice a turn. Multiplying intelligence by 2 will be required to keep the status quo.
Can't you do the adjustment in the code that loads the alien stats ? read "n" from the file, store "n*2" in memory.
Title: Re: psyHoTik's experiments
Post by: psyHoTik on March 17, 2016, 11:13:57 pm
Can't you do the adjustment in the code that loads the alien stats ? read "n" from the file, store "n*2" in memory.
That's what I meant. I'll do it but not today ;)
Title: Re: psyHoTik's experiments
Post by: harre on March 18, 2016, 01:10:35 am
Can't you make a fork and have your changes there for everyone to see, remember it's GPL code ;)
Title: Re: psyHoTik's experiments
Post by: Slaughter on March 18, 2016, 03:44:39 am
Looking forward to being sniped from far away by unseen aliens
Do the alien do aimed shots if from afar?

Does this include use of explosives - 'nades, Blaster Bombs, etc?
Title: Re: psyHoTik's experiments
Post by: psyHoTik on March 18, 2016, 09:19:16 am
Can't you make a fork and have your changes there for everyone to see, remember it's GPL code ;)
Some day maybe :) I need to learn more how the forking works. Besides, at the moment, I don't consider myself good enough to do it in such official way ;) Of course I'll gladly share any code.

Do the alien do aimed shots if from afar?

Well, I'm not sure because I haven't touched the routines for choosing firing mode. But the distance is already included in this process so probably yes.

Does this include use of explosives - 'nades, Blaster Bombs, etc?
Actually, for grenades, blasters and (to some extent) PSI, this was already implemented, even in vanilla. The difference is, that the AI can use this weapons even after loosing visual contact, so implementing this routines for firearms would ruin the gameplay. I restricted sniping only to targets visible to AI in its current turn.
Title: Re: psyHoTik's experiments
Post by: psyHoTik on March 19, 2016, 01:59:46 pm
Experiment 2 - reworked/balanced Alien PSI

I've implemented mechanics described above for alien PSI. Now they use it mostly like the player do so no line of sight is required to perform PSI attack but the target must have been revealed (spotted by at least one alien) in current turn. This way:
- you won't get PSIed to death on first or second alien turn
- you have some means to defend yourself - as long as you keep you soldiers out of enemy sight, they are safe
- PSI "rod" tactic will not work anymore - unless you expose the "rod" to enemy but it's more probable that he will just get shot.
- on the other hand, alien psionics is not totally impaired by line of sight requirement and still pose a big threat if you get spotted.

I think it's more fair for the player than vanilla mechanics but also more challenging than PSI Line of Sight mod. Please try it yourself :) Sniping aliens are included in this build.
Title: Re: psyHoTik's experiments
Post by: Slaughter on March 19, 2016, 04:30:13 pm
Personally I don't mind alien PSI as it works much, even if finding Ethereals without PSI protection is ABSOLUTE MURDER. Althrough these rules are nice - its somewhat unfair when I had all my troops and aliens can still psi them. Still, your experiments are very good and such things are where great concepts come from!

Nice to see psi rod not work anymore.

Is there a mod wich makes X-COM PSI line-of-sight while alien PSI is normal? I think that would make perfect sense, considering aliens are Psionic forever while X-COM finds out one of these days, the aliens oughta know more, their third-eyes are opened, so to speak.
Title: Re: psyHoTik's experiments
Post by: Arthanor on March 19, 2016, 04:43:32 pm
I think the customizable psi and blaster balance mod allows that. It's a really easy thing to mod too.
Title: Re: psyHoTik's experiments
Post by: Slaughter on March 19, 2016, 07:54:29 pm
Any plans for further experiments?
Say, alien UFOs attack X-COM craftm

Enviado de meu SM-G3502T usando Tapatalk
Title: Re: psyHoTik's experiments
Post by: psyHoTik on March 19, 2016, 09:38:24 pm
Still, your experiments are very good and such things are where great concepts come from!
Nice to hear that. It gives motivation for further work :)

Any plans for further experiments?
Say, alien UFOs attack X-COM craftm
Sorry, but my skills are far too low for such features. I'll focus mostly on battle AI, as it is actually quite easy to understand and modify.
Title: Re: psyHoTik's experiments
Post by: Slaughter on March 19, 2016, 11:25:11 pm
Battle AI, huh?

Well, how about making the AI:
a) Use smoke grenades if not hiding (the aliens in Apoc are capable of using them)
b) Be able to properly launch well co-ordinate assaults on multiple fronts
c) Act more clever when X-COM is preparing for an assault or camping up the door for reaction shots. Say, one alien opens the UFO door, another throws a grenade.
d) Does the UFO AI know about doors that can be opened in UFO? Pretty sure it is totally ignorant about this possibility, unlike the TFTD AI.
e) Civilians run towards the goddamn Skyranger, or at least towards somewhere hidden, rather than herp-derping around like mind-addled morons. Maybe actually keep some of the "herp-derp" behavior because sometimes people DO act derpy in unexpected situations.
f) PSI-controlled X-COM agents can pick guns and reload them. Always hated that kind of cheesery. Take the mind-control like a man!
g) AI isn't as interested in controlling soldiers unable to harm other soldiers - so no more "give lasers/firearms to psi-wimps so our top Power Armor soldiers aren't threatened anymore by psi". Bonus if the AI is smart enough to send that controlled soldier towards weapons that can harm the soldiers.

I'm sure someone can suggest more.

I'm sure someone can suggest something way better
Title: Re: psyHoTik's experiments
Post by: Solarius Scorch on March 20, 2016, 04:10:19 pm
The Psi mod is great news. It's close to how vanilla works, but feels more fair, more tactical and generally more... advanced.

The aliens sniping from afar is very cool, but I guess some more changes will be needed to make it work nicely. Like for example being able to define sight range during a day, too (OXCE only allows it for the night.

Actually, you can consider this a request on my part. ;)
Title: Re: psyHoTik's experiments
Post by: psyHoTik on March 20, 2016, 10:07:57 pm
Well, how about making the AI:
a) Use smoke grenades if not hiding (the aliens in Apoc are capable of using them)
b) Be able to properly launch well co-ordinate assaults on multiple fronts
c) Act more clever when X-COM is preparing for an assault or camping up the door for reaction shots. Say, one alien opens the UFO door, another throws a grenade.
d) Does the UFO AI know about doors that can be opened in UFO? Pretty sure it is totally ignorant about this possibility, unlike the TFTD AI.
e) Civilians run towards the goddamn Skyranger, or at least towards somewhere hidden, rather than herp-derping around like mind-addled morons. Maybe actually keep some of the "herp-derp" behavior because sometimes people DO act derpy in unexpected situations.
f) PSI-controlled X-COM agents can pick guns and reload them. Always hated that kind of cheesery. Take the mind-control like a man!
g) AI isn't as interested in controlling soldiers unable to harm other soldiers - so no more "give lasers/firearms to psi-wimps so our top Power Armor soldiers aren't threatened anymore by psi". Bonus if the AI is smart enough to send that controlled soldier towards weapons that can harm the soldiers.
You are expecting too much, my friend :) Remember, that human brain has been perfected by millennia of evolution, while alien AI is actually 60 KB of code ;) Your ideas are interesting and reasonable but, sadly, most of them are uncodable or require a huge amount of work for little observable effect. Let's talk them over:

a) probably doable (somehow) but consider the following:
- Apoc is more action-oriented (especially in real-time mode), while UFO and TFTD are more about hiding and seeking and are best know for that you never know where to expect the enemy. Exploding alien smoke grenades would give a hint about enemy position, spoiling some atmosphere
- smoke will hinder AI much more than the player, as aliens, by default, require a visual contact to shoot, unlike X-com agents, who could shoot through the smoke
- it would require creating new object (alien smoke grenade) and changing spawning routines so each alien will be equipped with it.
- if implemented I see two functions for alien smoke: 1. alien is carrying primed smoke grenade, which explodes when alien is killed to cover his buddies. 2. when escape evaluation fails because every available tile is in X-com visual range, the alien throws smoke grenade or just drops it to the ground and then moves. Like I said, however, it won't be easy to implement.
b) very difficult (impossible?) to code (unless you can translate it to algorithms ;) )
c) as above
d) what do you mean? In OpenXcom the same AI is used for UFO and TFTD. It can definitely move through the doors, unless you mean opening doors by "right click", without crossing them which it cannot do.
e) that was exactly my idea, as I always were sorry for this poor guys too :) Unfortunately, as Warboy told me, it is impossible to "tell" the AI where the Skyranger is so this won't work. I will ,however, experiment with civillian AI and see what are the results. You may not believe but they are not acting random - they have routines for hiding and running away, similar to those used by aliens. I think their problem are mostly low health and TUs so they are doomed anyway  no matter how smart they would be. They also quickly "forget" what they were running from, which I will try to change if I'll have some time.
f) I think this one is already implemented if you turn on Alien Pickup Weapons mod. Keep in mind that mind control lasts only for one turn, so they may have not enough time to do it.
g) this one (choosing targets based on carried weapon) may ne even doable... Picking up weapons - see above

The aliens sniping from afar is very cool, but I guess some more changes will be needed to make it work nicely. Like for example being able to define sight range during a day, too (OXCE only allows it for the night.

Actually, you can consider this a request on my part. ;)
I'll see what can be done, but I cannot promise anything :) What exactly you need? Global setting for day/night visibility for the whole mod? Or sight radius as a parameter for given alien race? If we are talking about sniping aliens - do you mean sight range as visual range or the range that alien can shoot at unseen (revealed by spotter) target?

Also, question for the Devs: Is it possible to make AI set grenade timer to more than 0? I can't see what happens next, after grenadeAction is completed (and AI decided to use grenade). Where are the routines for priming and throwing itself?
Title: Re: psyHoTik's experiments
Post by: Solarius Scorch on March 20, 2016, 10:18:12 pm
I'll see what can be done, but I cannot promise anything :) What exactly you need? Global setting for day/night visibility for the whole mod? Or sight radius as a parameter for given alien race?

I'd like to be able to set it by armour, just like with night vision. So some atmours are better for scouting, some have severe vision problems, etc. It would also work for unusual settings for aliens (25 tiles in full light, check this out).

If we are talking about sniping aliens - do you mean sight range as visual range or the range that alien can shoot at unseen (revealed by spotter) target?

Nevermind, I was referring to your first idea.
Title: Re: psyHoTik's experiments
Post by: Xeno Wiper on March 22, 2016, 02:00:23 am


Experiment 1 - Alien Snipers
The goal was to give the aliens the ability to shoot at revealed targets they don't personally see, just like X-com soldiers do in most cases (you fire at enemy spotted by another soldier). In theory this could make game more challenging and unarmed or weak enemies would still pose a threat as they could relay your position to their buddies. The build actually works and such game may be even considered fun...



As if aliens weren't cheating enough with their extended vision...  :P


The psi thing is actually interesting, but it makes things fair.... :D


But seriously, those are nice options to make the game more balanced, instead of relying in cheat stuff for that.


Any chance for Warboy to merge it to the main build (as an option/mod, not actually a fixed feature)?
Title: Re: psyHoTik's experiments
Post by: psyHoTik on March 22, 2016, 10:15:52 pm
Ladies and Gentlemen , by special request from SolariusScorch...

Experiment 3 - variable sight range for armors. I've add 2 parameters for rulesets, that define sight range at day and night. It was done in most simple way and may not be exactly what you've expected, but here are the details:
1. In ruleset "sightRangeDay" and "sightRangeNight" will define the sight radius. If you don't define it, the default values will be 20/9
2. sightRangeNight should be lower or equal than sightRangeDay, otherwise it may not work as planned (but feel free to test it)
3. For aliens sightRangeDay will be used for both day and night. It is not possible to make alien sight different at night without radical changes in gameplay, because your soldiers glow, so for game logic there's always a "day" around them.
4. The light radius around your soldiers is not changed so if you set the values high you will detect units out of light radius.
5. LOS blocking by smoke and fire is unaffected by those parameters.

I've included a simple mod to show how it works. It adds night vision for human armors and also make Floaters even more pathetic by halving their sight range (just for show). Sniping aliens and PSI rework included.

Also a bug was fixed - hitting an alien on their turn via reaction fire should no longer bring counter-barrage on shooting soldier if he remained unseen.
Title: Re: psyHoTik's experiments
Post by: Solarius Scorch on March 22, 2016, 10:23:35 pm
Awesome! Thanks. Now I need to ask Meridian to include your code.
Title: Re: psyHoTik's experiments
Post by: psyHoTik on March 22, 2016, 10:25:26 pm
Awesome! Thanks. Now I need to ask Meridian to include your code.
Better test it first :)
Title: Re: psyHoTik's experiments
Post by: Solarius Scorch on March 22, 2016, 10:27:21 pm
Better test it first :)

He's more qualified :)
Title: Re: psyHoTik's experiments
Post by: Meridian on March 24, 2016, 05:03:44 pm
I've included a simple mod to show how it works. It adds night vision for human armors and also make Floaters even more pathetic by halving their sight range (just for show). Sniping aliens and PSI rework included.

Can you share just that single change? As a git patch? Or maybe upload to github?
Title: Re: psyHoTik's experiments
Post by: Meridian on March 25, 2016, 05:23:07 pm
I couldn't really use this, can't see what was changed. And I also needed to consider OXCE changes as this was for vanilla only. So I made my own version: https://github.com/MeridianOXC/OpenXcom/commit/8bf5a9d4abf8c839028bff6717bed791faa2c737

1. In ruleset "sightRangeDay" and "sightRangeNight" will define the sight radius. If you don't define it, the default values will be 20/9

OXCE already has "visibilityAtDark".
I have added "visibilityAtDay".

2. sightRangeNight should be lower or equal than sightRangeDay, otherwise it may not work as planned (but feel free to test it)

visibilityAtDay can be lower than visibilityAtDark, if you wish so... Solarius seems to have a use case for everything... but both of them must be lower or equal to a global limit (20)... the global limit is configurable too in OXCE... that DOESN'T mean I suggest to change it... be very careful about that!

3. For aliens sightRangeDay will be used for both day and night. It is not possible to make alien sight different at night without radical changes in gameplay, because your soldiers glow, so for game logic there's always a "day" around them.

I am using both limits also for aliens; in OXCE you can turn off the "glow", so no problem.

Btw. definition of dark is "tile shade > limit" (this limit is also globally configurable in OXCE). If unit is on fire, it is automatically not in dark. If unit is lighted by external source (e.g. flare) or by personal lighting ("glow") it is also not in dark.

4. The light radius around your soldiers is not changed so if you set the values high you will detect units out of light radius.
5. LOS blocking by smoke and fire is unaffected by those parameters.

I didn't change any of that either.
Title: Re: psyHoTik's experiments
Post by: yrizoud on March 25, 2016, 05:42:56 pm
I kinda remember a hotkey "L" to toggle the light around your characters, though I'm not sure what gameplay effect it has, if any.
Title: Re: psyHoTik's experiments
Post by: psyHoTik on March 25, 2016, 09:43:40 pm
I couldn't really use this, can't see what was changed. And I also needed to consider OXCE changes as this was for vanilla only. So I made my own version:
So you don't need my code anymore? That's a shame  ;D
But seriously, if you could provide me with some tutorial on how to make those Git patches or how to use Github properly, I would be very grateful. I have Github installed but I used it only to clone the repository. I don't know what else should I do with it to make everything lege artis.

If we are talking about light, I have some idea for next experiment, but I need to earn some EXP and advance a level i coding first :) The idea is:
1. Soldiers do not emit any light or this light is very weak.
2. Items have "flashlight" parameter, defined in ruleset . Such items, when hold in hand, emit a cone of light in front of soldier, not around him.
3. By setting flashlight value we can set the strength of light. This way we can have weapons with build in light (weak light), handheld flashlights (decent light source but blocking a hand slot) and some hi-tech, elerium powered super-light sources (maybe mounted on shoulders, if this is codeable)
4. Turning light off allows to hide from some species of aliens, that don't see good during the night. Turning it on makes soldier visible and exposed.
5. Shooting at target in darkness gives big penalty to accuracy (don't know if this is codeable, as I haven't looked at accuracy routines yet). So you should either illuminate the target or use weapon with night scope (another flag in ruleset) that would ignore this penalty)
6. Ultimate achievement would be learning the AI to use such light sources too.

That's the idea. Anyone tried that? :)
Title: Re: psyHoTik's experiments
Post by: Solarius Scorch on March 26, 2016, 01:04:14 am
but both of them must be lower or equal to a global limit (20)...

Well it's a bit of an issue, since it would be interesting to have aliens with vision 24. :)
I kinda remember a hotkey "L" to toggle the light around your characters, though I'm not sure what gameplay effect it has, if any.

It just turns off lights on X-Com soldiers. Which means they're not shining brightly in the dark for everyone to shoot at them.

1. Soldiers do not emit any light or this light is very weak.

Why? You can always turn off the lights with 'L'.

2. Items have "flashlight" parameter, defined in ruleset . Such items, when hold in hand, emit a cone of light in front of soldier, not around him.

Yeah, that'd be great.

4. Turning light off allows to hide from some species of aliens, that don't see good during the night. Turning it on makes soldier visible and exposed.

That's actually easily done in OXCE. I prefer to fight humans at night, because you can outsmart them using flares and shadows. Ninja style.

5. Shooting at target in darkness gives big penalty to accuracy (don't know if this is codeable, as I haven't looked at accuracy routines yet). So you should either illuminate the target or use weapon with night scope (another flag in ruleset) that would ignore this penalty)

This could be interesting, but no nightvision please, this has been discussed to death twice over. ;) Unless we have a special slot for headgear maybe.
Title: Re: psyHoTik's experiments
Post by: Meridian on March 26, 2016, 09:49:48 am
Well it's a bit of an issue, since it would be interesting to have aliens with vision 24. :)

Increasing global limit to 24 is OK, feel free to do that... just don't go to something ridiculous as 50 or 100... for "true vision" we would need a different algorithm.

Code: [Select]
maxViewDistance: 24 #global visibility limit
maxDarknessToSeeUnits: 9 #0-9 is day, 10-15 is dark
...
armor:
  type: STR_XCOM_ARMOR_TO_MAKE_MERIDIAN_ANGRY
  visibilityAtDark: 4
  visibilityAtDay: 8
...
  type: STR_ARMOR_TO_MAKE_FLOATERS_OP
  visibilityAtDark: 24
  visibilityAtDay: 24
...
Title: Re: psyHoTik's experiments
Post by: Solarius Scorch on March 26, 2016, 08:47:06 pm
OK, I was hoping it would work. Thanks, effendi :)
Title: Re: psyHoTik's experiments
Post by: Meridian on April 02, 2016, 10:27:46 am
OK, I was hoping it would work. Thanks, effendi :)

I did some testing after upgrading to newest piratez, and with maxViewDistance=30 it starts lagging on maximum xcom movement speed on large maps.

So, to be on the safe side, I'd recommend keeping maxViewDistance on 30 or less... otherwise you need to warn the users they may experience lags and need to decrease the unit movement speed.

PS: tested with above average 2016 hardware
PS2: attached a save with most lag