SamSuka
Kyzrati
Kyzrati

patreon


Throwing Architecture

No, I don't mean tossing buildings around.

This has been a very productive week, and I would've about finished implementing all the item updates I've been streaming about lately if I hadn't gotten mega-sidetracked starting Monday...

I had this little idea which turned into a big idea (as they often do) and most of this week was spent working on new pieces of architecture to support certain mechanics we couldn't have before. I'm going to be vague here because it's pretty spoilery and I'll leave the new stuff for you to discover in the next prerelease.

The chain of events leading through this week was interesting: I wanted to make a guaranteed late-game artifact no longer a guaranteed find, but in exchange wanted to add the possibility of finding some other new artifact instead, and one of the easier go-to possibilities was an upgraded weapon. Well I started thinking about the lore behind this thing, and that led to me wanting to make it even bigger, so I replaced that weapon with another concept to justify just how big this thing would need to be, and it turns out some new architecture would be required to support it as well. So that's what I did first, a little experiment to even see if this would be feasible, and I'm happy to report that 1) it worked out and this weapon got added, and 2) the original weapon concept was also added. Both of these tread new ground.

Anyway, that's enough of the vague stuff--just a quick progress update to let you know what's going on, where the real mechanic I wanted to write about today is "throwing."

Throwing 101

As many of you know, Cogmind emerged from my old X@COM project, and in that game throwing items around the map is not uncommon, be it lobbing a grenade at an alien or some terrain you want to blast/conceal, or tossing some spare ammo or equipment to a nearby squadmate. (I really should stream some X@COM sometime!)

So this was actually a feature that kinda sat unused in Cogmind, and technically incompatible with other architectural advancements made over time, meaning I couldn't just easily let throwing items actually work in the world of Cogmind. But at least some of the ground was tread before, so with a little fiddling I did get it working again.

It's probably important to emphasize here that I'm not actually saying throwing items is a thing in Cogmind, nor will it be.

The real reason I needed to revisit this feature is that I wanted to be able to animate an item's movement from one location to another, and properly handle any other related changes at the proper points in that process.

An early example of where this could have been applicable in Cogmind is with the Abominations event, in which they are capable of sucking up nearby parts to attach to themselves. Ideally this process would have some quick path-based animation associated with it so you could better see the changes playing out on the map itself rather than having to notice items suddenly disappearing and read the message log for details. But building that mode was complicated enough without also worrying about appearances, so at the time this wasn't a priority. Instead, as I tend to do with special modes I improvised, piggybacking on the self-destructing item animation system and having absorbed parts quickly flash out of existence at their original map position.

Not that I suddenly had the urge to go back and update this event or anything--I actually needed to animate item movement for an entirely different reason more relevant to Beta 11. Curious!

Architecture 101

Anyway, how does this actually work? Well map animations are directly linked with game logic via particle data. So when weapons are fired, the projectile is a type of particle that the map can animate, but that particle also carries the weapon (and attacker) information with it in order to apply itself to whatever it encounters while in flight, such as obstacles to damage or penetrate, or eventually fizzle out when it reaches max range.

For the most part it's pretty straightforward. Even resulting AOE blasts are just a lot of particles carrying damage information to different targets, not really any different from firing a bunch of guns from an origin at all the cells in range, but throwing is a different story, since it actually has to move something rather than purely carrying data.

"Throwing" an item is therefore a case of removing the item from its current location, giving it to a particle to carry, allowing that particle to reference the item's appearance (ASCII/color) in order to render it, and depositing it at the target using whatever method is desired, be it attaching to a target robot, falling to the ground, etc.

Those bits were partially borrowed from X@COM code, though there was one area in particular that X@COM never considered: object movement that the player isn't aware of, and therefore shouldn't stop the action. Like when robots are fighting far away on the map and you can neither hear nor see them, combat is played out using a faster separate method rather than passing data through particles, so even though it was quicker to get particles carrying and "throwing" items, I had to take the next step and also make it possible for said throwing to occur further away without interrupting play. Of course much of the usual projectile code could simply be repurposed, which didn't turn out to be too much trouble, but it does take time to go through it all line by line and adapt a few parts, making sure the new applications won't have unintended consequences, and generally run some experiments to test that it all actually works!

So yeah, now we have support for this feature if and when it's needed for some mechanic or behavior, for example the little thing I used it for in Beta 11 which I imagine a lot of people won't actually see, but... such is developing a big world with lots of stuff in it ;) (actually there's still plenty of X8 things few to no people have reported finding yet, either...)

Comments

Well not directly, though technically that's what you're doing when you get matter and use it for ammo (or even closer--using an FRU to convert parts to matter, which you then fire as projectiles). *Thematically* not the same, of course, though doing that in a more thematic way isn't really compatible with the UI...

Kyzrati

This could already exist and I just never found it but now I want a junk launcher which lets you launch items at extremely high speeds at an enemy

Pizzatiger

Yeah in its current state it requires already knowing the rules of the original game, since it never reached the stage of adding a tutorial and QoL, or even a proper UI. It was all pretty minimal just to implement all the mechanics and play with new possibilities (it recreates all the features of the original, and has even more as well!).

Kyzrati

I have actually downloaded XCOMRL some time ago, but never got the hang of the control mechanics, guess I just don't understand Xcom enough. But I really like tactical shooters based on teamwork and coordination like Rainbow Six. You gotta stream XCOMRL, even if you could just teach us how to play!

Young Young


More Creators