Some help with code in X-Com: Enforcer (UE1-based)

Discussions about Coding and Scripting
Orbis_Tertius
Novice
Posts: 5
Joined: Mon May 24, 2021 8:24 pm

Some help with code in X-Com: Enforcer (UE1-based)

Post by Orbis_Tertius »

Hi :) First post here. And with a bit of an unconventional request for help at that...

Last month I decided to purchase GOG's X-Com bundle which, other than the original games, also includes the much-maligned-but-rightly-so X-Com: Enforcer. On a whim, I've been tinkering with the game as it includes its own version of the Unreal Editor. Even the MP component follows from UT99, complete with mutators and all. But it's the first time I've tried messing with anything Unreal-based and I'm overwhelmed. Some things are easy to pick up on even without the editor's manual but others are trickier. Which... is why I'm here :)

Enforcer uses this weird third-person camera placed behind and above the main character but then angled as if looking down on him, which tends to limit visibility. Moving the mouse up or down only moves the reticule and the model; the perspective is fixed.

Image

I've managed to edit a level's ZoneInfo to change the camera distance and pitch, simulating a first-person perspective but the height of the camera still seems weirdly taller than what it should be in relation to the character. I've dug around and believe it's an issue with EyeHeight. This is neither in ZoneInfo, nor in PlayerStart but in the PlayerPawn Actor class. Thing is, it's mentioned *many* times and I'm not sure what part(s) of it reflects it, since any changes to the Actor class have brought zero effects on the map.

Here is Enforcer's PlayerPawn code as a PasteBin link. I was wondering if anyone could look into it and perhaps point me in the right direction.

https://pastebin.com/X0GL83bF

Another issue is that other than the main weapon, which has infinite ammo, the game makes use of respawning weapons and power-ups, spawned at regular intervals on maps. Once out of ammo, whatever weapon you're carrying is removed from the inventory and you're forced back to using the default one. I know how to deactivate these spawns per level, but I can't for the life of me find a way to make it work as a "standard" FPS, with actual camera movement for vertical motion, and make it possible to carry several weapons, even if they're out of ammo.

Any idea on how I might change these? I have been reading the BeyondUnreal wiki but I couldn't program a "Hello, world" even if my life depended on it, so this is a very slow process for me.

Thanks in advance for any help on this matter! :)
ShaiHulud
Adept
Posts: 446
Joined: Sat Dec 22, 2012 6:37 am

Re: Some help with code in X-Com: Enforcer (UE1-based)

Post by ShaiHulud »

Welcome to the forum! I expect someone can offer advice about inventory management, and any mutators you might be able to use (assuming there is some way to make use of them).

Can you access the console within the game? I doubt they've have made much attempt to hide it, since it's readily available in Unreal Tournament. If so, what happens if you open the console and type "behindview 0" when you're using the Enforcer?
Orbis_Tertius
Novice
Posts: 5
Joined: Mon May 24, 2021 8:24 pm

Re: Some help with code in X-Com: Enforcer (UE1-based)

Post by Orbis_Tertius »

Hi ShaiHulud , thank you for the welcome :)

"Behindview 0" was one of the first things I tried. What happens is, the character disappears but the camera position remains exactly the same.

The only way I've managed to make it closer to first-person was by changing the ZoneInfo properties of CameraDistance and CameraPitch; in some cases, I also changed the FOV to 120.
User avatar
UnrealGGecko
Godlike
Posts: 2762
Joined: Wed Feb 01, 2012 11:26 am
Personal rank: GEx the Gecko
Location: Kaunas, Lithuania

Re: Some help with code in X-Com: Enforcer (UE1-based)

Post by UnrealGGecko »

Welcome aboard!

Not a coder so can't really help much, but have you tried also asking in the OldUnreal forums? Quite a few knowledgeable peeps over there, and also happen to hive some sections for other Unreal Engine 1 games, so maybe there might be something useful over there.
User avatar
sektor2111
Godlike
Posts: 6133
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Some help with code in X-Com: Enforcer (UE1-based)

Post by sektor2111 »

Orbis_Tertius wrote: Mon May 24, 2021 8:35 pm Here is Enforcer's PlayerPawn code as a PasteBin link. I was wondering if anyone could look into it and perhaps point me in the right direction.
Enforcer Pawn's code is a PLAYERPAWN, not a weapon... These are different things anyway, or I failed to understand what is all about.

I don't get why Pawn would hold an empty weapon in a shooter game when game demands at least a "melee weapon" by any matter... or I miss-understood the problem.
User avatar
papercoffee
Godlike
Posts: 10244
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.

Re: Some help with code in X-Com: Enforcer (UE1-based)

Post by papercoffee »

sektor2111 wrote: Wed May 26, 2021 8:34 pm
Orbis_Tertius wrote: Mon May 24, 2021 8:35 pm Here is Enforcer's PlayerPawn code as a PasteBin link. I was wondering if anyone could look into it and perhaps point me in the right direction.
Enforcer Pawn's code is a PLAYERPAWN, not a weapon... These are different things anyway, or I failed to understand what is all about.

I don't get why Pawn would hold an empty weapon in a shooter game when game demands at least a "melee weapon" by any matter... or I miss-understood the problem.
X-Com: Enforcer is the name of the game and has nothing to do with the Unreal Tournament Enforcer (the weapon).
Orbis_Tertius wrote: Mon May 24, 2021 8:35 pm Any idea on how I might change these? I have been reading the BeyondUnreal wiki but I couldn't program a "Hello, world" even if my life depended on it, so this is a very slow process for me.
The problem here can also be that these engine version might be heavily modified to fit the needs of the game. Therefore can some parts be slightly different or totally different at all.
Some things can be hard coded.

Edit--------------------------------------------
I watched a video of the game ...now I understand. Wow that game could be nice with a better movement handling.
There is a mutator called Third-Person Shooter.
It let you see over the shoulder of your player pawn but gives you as much freedom to aim like in first person.
Maybe this mutator could be marauded for your needs.

Edit2------------------------------------------
Found it
Third-Person Shooter.zip
You do not have the required permissions to view the files attached to this post.
Orbis_Tertius
Novice
Posts: 5
Joined: Mon May 24, 2021 8:24 pm

Re: Some help with code in X-Com: Enforcer (UE1-based)

Post by Orbis_Tertius »

Hello! Thank you everyone for their responses :)

I've realized a couple of things. In LevelInfo > EnforcerCamera > I can change Camera Distance and CameraPitch both to 0, which is fine in itself: as assumed, it adjust the camera so that I can see "through" the main character.

At first I thought PlayerStart might handle height, but no property seemed to change it. That's when I decided to check PlayerPawn and EnforcerPlayer.

PlayerPawn can move the camera freely, akin to true first-person perspective (or the 'Ghost' cheat command), but its height doesn't seem to be adjustable and it doesn't animate at all. Plus, camera settings don't work and no reticule/crosshair Class can be applied. It also crashes the game when it's killed.

EnforcerPlayer, however, loses the ability to aim as in traditional first-person (that is, it reverts to the default aiming behavior of the camera not following mouse input on the vertical axis beyond a certain point) but can have its DrawScale reduced, meaning at first glance it "fixes" the height issue by reducing the mesh size, but though the problem of camera height vs. model eye height is still present... It's just less noticeable if one doesn't change the camera back.

@papercoffee: Thank you for this, I'll take a look at the mutator :) And will also ask around at the OldUnreal forums :)
Orbis_Tertius
Novice
Posts: 5
Joined: Mon May 24, 2021 8:24 pm

Re: Some help with code in X-Com: Enforcer (UE1-based)

Post by Orbis_Tertius »

Ok. It's been a lousy week trying to get anything done with this game, but...

I found at least part of what I was looking for.

The FreeLook and FreeLookToggle, handled by Alias bExtra0 in the User.ini, do pretty much what I wanted: full, FPS-like movement and aiming. I don't even get why this option was not made available in-game when it was released almost 20 years ago. It would have made playing it less of a hassle.

And yet...

For some reason, when activating Freelook, the game reverts to the same initial camera position (up and behind the player, looking down). What this shift means is that while I can now look around in full 360 degrees in simulated first-person (provided I changed the ZoneInfo camera values), I do so at a disadvantage, because now the reticule is never centered. It's always offset by some unknwon reason.

Picture 1 is the initial state. Mouselook works, but camera is fixed on the horizontal axis. Picture 2 is right after activating Freelook. Notice how far it's from the center of the screen.

Image Image

Might as well give up on this...