Jump to content

Day/night in Apocalypse


jos

Recommended Posts

Ok, so after playing around with the Apocalypse editor unlocked thanks

to J'ordos's fabulous work, it's clear that the day/dusk/night graphics

in the game change using a palette swap. (you can switch between them in the editor)

 

So, as we know, It works perfectly on the cityscape but no palette

swap happens in the battlescape. If there was one thing I could change

in Apoclaypse it would be this. I'm sure we all love/hate night missions

from XCOM 1, and it looks like Day/night got cut from Apoc along with

lots of other cool stuff. What a damn shame.

 

So given that we have a working palette swap function in the game, could

we set it to work in the battlescape? Does anyone have some idea how

this could be achieved?

Link to comment
Share on other sites

UFO/TFTD handles its day/night graphics by a palette "bump", rather then a complete swap - their palettes are made up of groups of colours, light to dark. All they need to do is add a little bit to each colour index, and things look darker. This is allows more complex lighting, eg, an area near a trooper can be clearly visible, whereas other areas on the same screen can be pitch black.

 

It'd be pretty difficult to get such a system going in Apoc.

 

A "cheaty" way to do it would be to hunt down where the valid palette is stored (I guess it's one of the ones in the UFODATA folder), and swap this file whenever a night mission starts with a darker version.

 

There are still a few catches to this method.

 

First off, like the original games, Apoc has multiple executable files - it switches between these when you go from the cityscape to the battlescape or back again. The first two titles in the series handled this via a batch file, which, being plain text, was trivial to modify so that modders could have their own executables run in between missions (this is how XcomUtil and my own mods do much of their work).

 

Apoc has no batch file. TACP.exe would need to be renamed to something else, and replaced with another EXE that checks what time it is, provides the correct palette file, then executes the "real" tactical game engine.

 

The second catch is that darkening the whole palette will also affect the mouse cursor and the icons down the bottom of the screen, etc. This probably won't be too noticeable, however, as TFTD performs a full palette swap for the deeper ocean depths, and it doesn't look too bad there.

 

The one other issue is that just messing with the colours won't decrease your agents view range. That'd require an additional EXE edit. j'ordos would probably have the best idea as to the difficulty involved there.

Link to comment
Share on other sites

UFO/TFTD handles its day/night graphics by a palette "bump", rather then a complete swap - their palettes are made up of groups of colours, light to dark. All they need to do is add a little bit to each colour index, and things look darker. This is allows more complex lighting, eg, an area near a trooper can be clearly visible, whereas other areas on the same screen can be pitch black.

 

Interesting. Ingenious in fact! Do you know Apoc handles its cityscape day/night the same

way though?

 

A "cheaty" way to do it would be to hunt down where the valid palette is stored (I guess it's one of the ones in the UFODATA folder), and swap this file whenever a night mission starts with a darker version.

 

Ok. But I suppose the key question is, will this just darken everything uniformly? As you say above,

the UFO/TFTD palette swap cleverly allows 'light sources' such as agents and electro-flares and fire.

How does it do this? And do you think we could we set up the Apoc palette swap to do the same thing?

A uniform darkening of the screen during night missions without light sources would probably not be worth doing

as it wouldn't create the awesome atmospheric lighting we see in UFO/TFTD....

 

First off, like the original games, Apoc has multiple executable files - it switches between these when you go from the cityscape to the battlescape or back again. The first two titles in the series handled this via a batch file, which, being plain text, was trivial to modify so that modders could have their own executables run in between missions (this is how XcomUtil and my own mods do much of their work).

 

Apoc has no batch file. TACP.exe would need to be renamed to something else, and replaced with another EXE that checks what time it is, provides the correct palette file, then executes the "real" tactical game engine.

 

The second catch is that darkening the whole palette will also affect the mouse cursor and the icons down the bottom of the screen, etc. This probably won't be too noticeable, however, as TFTD performs a full palette swap for the deeper ocean depths, and it doesn't look too bad there.

 

Right - in fact, a small amount of colour change to the UI could actually be quite cool, as in TFTD!

 

Unfortunately I wouldn't have much idea how to set it up to change the palette. Can you give

me any leads Bomb bloke? I've modded alongside an expert engine hacker on the game Fallout 2

but I've only done game scripting. She creates the extraordinary little program (called sfall) that, presumably,

gets triggered when a certain offset changes (like day to dusk) and tells the game to do x or y.

Unfortunately it's mostly magic to me...

 

The one other issue is that just messing with the colours won't decrease your agents view range. That'd require an additional EXE edit. j'ordos would probably have the best idea as to the difficulty involved there.

 

Honestly, that would be nice, but far from essential. I'm mostly trying to add atmosphere to the game

(which i think it is sorely missing in comparison to EU/TFTD) Ranges reduced by 50% at night would

be sweet, but a bonus only.....

Link to comment
Share on other sites

To add in proper lighting like they did in UFO/TFTD, you would need to maintain a tile lighting bitmap for all the elevations (which I don't think is present in this game), update it regularly and you'd need to somehow get into the main drawing loop and alter the tile drawing function to reference the map and individually draw the tile at the right light level. UFO/TFTD actually maintain two 3d tile light maps, one for moving objects and one for fixed objects, and adds them together to get the palette shift value to use.

 

They might have scrapped it in Apocalypse because of the sheer amount of processing power (back then) that it would've taken to be able to update everything may have slowed the game down too much. Particularly in real time. There's just so much more to display and maintain.

 

One simple solution (used by other iso/hex tile games) might be a lighting bitmap overlaid over the playing area. Just a black bitmap the size of the playing area with areas 'lightened' every frame. Mainly a big radial burst in the middle (bigger or smaller depending on the time of day) and smaller (skewed) bursts around objects that are deemed to be light sources. This wouldn't look as good because light will penetrate foreground walls, but I imagine would probably be easier to implement than to manage tens of thousands of individual tiles.

 

- NKF

Link to comment
Share on other sites

Thanks for your analysis, NKF. The tile-based palette change would work

excellently, I think. The main complaint about Apocalypse is the graphics,

as a graphics guy, I can say the some darkness would probably be the single

thing that would improve the visuals the most.

 

I would have no clue where to begin with what you describe unfortunately as

i'm only a beginner in programming.

Is there an Apocalypse fan out there who would like to help make this happen?

I could provide extensive testing, tweaking, and other palette-related work....

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...