Phantom Objects

So this is a bit of a new one. Modding CC2 is mainly about altering the visuals in scripts to display things on the map differently. Hiding stuff, exposing stuff, showing custom details like names or impact points in the HUD, allowing finer control over things like aircraft waypoints etc.

Lurking in the background of my mods are some extra things that kind of create “things” in the game world. Things you can see on screens, and now thanks to the last update also things in the HUD.

You might be able to see in the image above the yellow triangle at the “X” marker added by my Holomap.

QuantX introduced the “captain’s holomap cursor” when we made UI Enhancer. This neat hack totally blew my mind. It used the drydock (which is a vehicle) and created a waypoint wherever the captain moved their cursor to using the holomap. The other screens then simply displayed this waypoint without any lines drawn, just the position. Inspired by that I realized that we could store a lot as waypoints, and use them to pass data between screens and even players.

Each waypoint consists of:

  • 32bit signed floating point X (longitude)
  • 32bit signed floating point Y (latitude)
  • 32bit unsigned integer altitude
  • 4 bits (hold A,B,C,D)
  • 1 bit deploy

Discarding the floating point parts for data storage, each waypoint can store 101 bits of data. Or about 12 bytes.

It’s not really feasible to use the 4 hold bits as they get cleared when anyone issues a GO code. So realistically, we can just about play with the 96 bits of X, Y and Altitude.

There is one important thing to note though. Once you’ve placed a waypoint, you cannot alter the X/Y values, you have to delete it and add another. So in most cases if I want to simply tweak one thing I only really get to alter the altitude value, so, 32bits per waypoint.

I’ve made a lot of use of this in Revolution, Behind the scenes this powers “Strategic Bombing”, Fog of war “scouting”, an more efficient version of the holomap cursor, the holomap markers and the carrier name selections.

Why do I say ‘Phantom Objects’?

We can now share waypoints with all the screens and HUD displays, We can set them in one script and read back in any of the others.

But what about some extra gameplay? what could we do here.

We can fairly easily do the following:

  • Mark a location With a numeric value
  • Compare each location to unit positions or other locations
  • Remove marked locations when we want

But what could we do with this kind of system?

To recap, we can usually do these kinds of things in mod scripts:

  • hide visible things on HUD / maps
  • expose hidden things on HUD / maps
  • display custom graphics on HUD / maps
  • add/remove waypoints on any unit
  • issue automated attack/airlift orders on any unit
  • configure friendly factory production
  • configure friendly inventory orders
  • discard carrier inventory items
  • buy friendly island turrets

A couple of ideas I’ve been throwing around between work and life are perhaps some kind of “sensor buoy”.

Fly an albatross off far away and drop a sonar buoy (torpedo decoy). But instead of the decoy just timing out after 60 seconds and vanishing, a “sensor” would be left in it’s place, perhaps exposing any ship that comes within a few km of that point, Then after a few minutes the sensor would expire? Perhaps the opposing team would also see these buoys when they are active?

Another idea might be special locations on islands. Perhaps a team gains some kind of modest bonus or difficulty when a unit is at one of these special places?

Would it be fun to have places on islands, where if you say brought a RADAR equipped SEAL that it could get a vision range bonus?

I’ll keep thinking, please post any ideas you might have as a comment or on one of the various CC2 Discord servers.

By:


Leave a comment