2 x 2 = A Lot of Work

by Kyzrati on 20111002 , under ,

It took one heck of a mega-refactor, but... they're finally here.

First time spending this much time on any one part of X@COM (even the particle engine only took a little over a day); had to parse a big chunk of the code since large units touch on a little bit of nearly everything--display, body item mechanics, FOV/LOF, pathfinding... Those weren't actually much of a pain, though. Implementing the effects of gravity on these guys was the annoying part--proper displacement by falling objects, bumping into each other while tumbling through the air, etc... In the end it was definitely worth it (not to mention necessary for any self-respecting X-COM remake!).

First sighting: Reaper!

So in the next release you'll be able to stomp--oops, I mean get stomped by--some large units. Don't worry, you'll have tank support! Too bad we all know X-COM tanks tend to suck. I suppose I'll be generous and give you a well-armed rocket tank or something like that, but it won't save you...

Not from...

Building collapses, from the smoke and rubble emerges a huge shadowy figure.

Soldier: "Um, command, I think we've encountered a new species."

[Radio silence]

Command: "Do you have a visual?"

Dust settles.

Soldier: "Oh my god... We're going to need a lot more rockets..."

...or, just one giant rocket:

Hell yeah!

That's a bit excessive though, you won't see anything quite that big in the demo.

But anyway, as you can see, unit sizes are actually arbitrary--they can be any dimension you like, even taller than one cell! Why not, the code is the same regardless of size. Not necessary for vanilla X-COM, but could lead to some interesting mods :)

Since it's somewhat related to large units, next up is terrain smashing: Any units with strength exceeding the integrity of a terrain material can smash right through it (for a TU cost). So soldiers can jump through windows, tanks and strong aliens can push down walls, and massive units could walk right through buildings. Obviously like anything else not X-COM, this will be an optional setting you can turn off in case you *don't* enjoy jumping through windows or surprising aliens by driving your tank through the side of a house.

After that is tank/natural weapons. That'll be a quick addition, then I can get the next release out.

In other news: ALIENS HACK X@COM!

They must've found out about X@COM and are afraid us Earthlings are developing a training program to devise ways to repel their imminent invasion!

Okay, what really happened is the ASCII mapping code was a bit off and turned the help screen into some alien language. Under the new mapping scheme, a virtually unlimited number of tiny images can be added to the resources and attached to any terrain, unit, etc. This was necessary to make it possible to draw the 2x2 units using special characters. Until now I was relying on hacks to get the unit triangles, but now they and the normal ASCII characters are easy to work with, even from the text files.
7 comments more...


  • Joshua Day

    The original X-COM kept positions separate from unit data -- one 2x2 unit had four positions. Did you end up doing something similar?

    An aside: A sidebar or top bar listing units by distance from the cursor would be extremely useful. (Look at Brogue for a good example of this.) In practice I've had a lot of trouble with Space for next turn; I tend to use it to try to clear prompts and end up advancing unintentionally.

  • Kyzrati

    Yep, large units store a vector containing all their positions (4 for 2x2 units, more for even larger units) instead of the original method, which was a single Pos.

    The weird thing about X-COM was that mind control could cause large units to attack themselves. Wonder how they coded it to result in something strange like that... The way I've got it set up that would be impossible since no matter how many cells a unit takes up it still only has one handle to which all of the cells refer. (I actually store unit position information in cells as well, unlike others who may only store units in a list.)

    About the spacebar issue, I already changed that for the next release. Backspace will end the turn instead. I was using spacebar for development because it's quicker to get to and I tend to frequently advance through lots of turns in a row to see things change.

    About the units-by-distance and such, that's an interface feature, and I'm not actually working on the interface yet (haven't even done the framework), just doing mechanics. The interface is going to be completely different from what it is now, and will be as informative (and dynamic) as possible. But I do already have something like that down in the design docs.

  • Anonymous

    "Under the new mapping scheme, a virtually unlimited number of tiny images can be added to the resources and attached to any terrain, unit, etc."

    So, does it mean that someone could make tile version of x@com rl?

  • Kyzrati

    Yes and no. Theoretically, yes, but ideally the so-called "images" should work more like a font in that they have a background and foreground area. So instead of a true tiled version you'd really have a version that uses alternate symbols instead of ASCII.

    Having a black background area is still necessary to show fire, smoke, and particle effects, thus normal opaque tiles wouldn't work.

    X@COM is not designed to be compatible with normal tiles, nor do I think it's necessary since there are already so many X-COM remakes out there with more normal graphics.

    I'm going for a completely different style.

  • Anonymous

    This actually looks somewhat reminiscent of the alien glyphs that decorate the walls of many UFO's. You should alphabetize this and turn it into an actual alien language! You know, like how good old Keen did it http://www.commander-keen.com/standard-intergalactic-alphabet-font.php

  • Kyzrati

    Yeah, I was thinking about doing something like that later on, once the game enters the design phase. Lots of potential uses, like "real-time deciphering" of alien transmissions that inform you about their activities once you gain the technology.

Post a Comment

Note: Only a member of this blog may post a comment.