CFW - Companion Framework

A place to discuss mods in development and concepts for new mods.
schilcote
Militia Captain
Militia Captain
Posts: 726
Joined: Sat Feb 02, 2008 7:22 pm

CFW is a functional/library type mod that, quite simply, allows SpaceObjects to communicate with minimal coding. It's intended to ease the creation of "companion"-type mods, allowing your followers to react and even interfere with events that happen during the course of the game. It provides a standardized and easy-to-use interface to allow mod creators to worry less about coding and more about writing good characters.

It is currently in a pre-alpha state; barely functional, but it can already do some interesting things.

How it works (or will work) is thus, in the most abstract terms possible:

1. A follower ship joins up with the player, registering itself with CFW via a single function call.
2. The 'triggering entity' (which can be just about anything, but will probably be a DockScreen most of the time) sends a signal to CFW that it's about to do something that companions might want to react to.
3. CFW then re-sends that signal to every (may change to be one random) registered companion entity, allowing them to react.
4. Any that wish to interfere can then send a signal back to the triggering entity saying either that it's handling things from this point on, or that it's changed something, but it's okay to continue as per normal.

Here's a video of it in action: http://www.youtube.com/watch?v=jSE7vRPFg5E


Any comments or suggestions would be appreciated; It'd be nice to have some input from other modders on how they want this to work. Might post a download link so you can test-drive it once it's a little more functional.
[schilcote] It doesn't have to be good, it just has to not be "wow is that the only thing you could think of" bad
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

This is awesome, I'm going to keep a close eye on this one :D
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
User avatar
Hatsuya Kanzaki
Militia Lieutenant
Militia Lieutenant
Posts: 145
Joined: Wed May 13, 2009 6:10 pm
Location: leading an armada of Realians driving sword-shaped gunships and WearGears

Must... HAVE THIS!

I can just imagine you, about to be killed by Lord Mikho, being saved by your wingmen like Volkov.
schilcote
Militia Captain
Militia Captain
Posts: 726
Joined: Sat Feb 02, 2008 7:22 pm

Some thoughts on multiple companions:

As of now, I've only tested the code with one registered companion. It's all designed to work with more than one, and as long as only one chooses to react to any one event at a time, it probably would work just fine.

The problems happen, of course, when two or more companions want to react to an event at the same time.

Responses in CFW are currently divided into three categories:

Level 0 response: No response. I didn't do anything anyone else needs to care about- I probably didn't even have the correct <Event> tags.
Level 1 response: I did something you might want to make note of, but continue on as usual. I imagine most of these would be the character making some sort of comment on what's going on.
Level 2 response: I want to completely override your behavior: I'm taking over from here, stop doing things immediately. In the video, the auton blowing up the factory and displaying a different message is a level 2 response.

There can be an infinite number of level 0 responses, of course, since it basically means "Proceed exactly as usual". Level 1 responses might need a cap on them so you don't end up filling the dockscreens with snide remarks all the time, but the real kicker is the level 2s: obviously, there can be only one at any time.

The most obvious way to do this would be to select one randomly, or just pick the first one in the list and discard all other responses (which would be difficult to do the way it works now, since the response level is determined after the response actually happens). I think the best way, though, is to use a priority system.

Each response event would have a staticdata element associated with it that represents how much the companion wants to respond to this event; so if, say, your character's most defining moment is getting into a barfight at that nightclub that's in every commonwealth starbase at once, it won't get overridden by another character inviting you to a chat about the Commonwealth's tax code- unless he thinks his tax code discussion is even more important than your barfight. If more than one response has the highest priority, then one will be chosen randomly.


Hatsuya Kanzaki wrote:Must... HAVE THIS!

I can just imagine you, about to be killed by Lord Mikho, being saved by your wingmen like Volkov.

Yeah, definitely. I always kinda hated how you meet those pilots and they fly and shoot and die for you- and except for the first conversation you have with them, and a couple bark-lines every now and then, they never say anything. That's what this system is supposed to be able to fix. (are they even in the game anymore? I couldn't find them in the XML, which is why I went with my old auton mod as the demonstration model)

It certainly lends itself well to Big Damn Heroes-type moments. I'm going to include a (seperate, removable) file full of vanilla overrides for things like the Fabricator death, so there'll be plenty of opportunities.
[schilcote] It doesn't have to be good, it just has to not be "wow is that the only thing you could think of" bad
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

Why staticdata? If you do ObjSetData in the <onCreate> event this means that you could have one generic event handler and then for each specific instance you can initialize the data during the OnCreate.
(Of course, I'm assuming that you're using event handlers for your wingmen.)
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
schilcote
Militia Captain
Militia Captain
Posts: 726
Joined: Sat Feb 02, 2008 7:22 pm

Yup, it's all <Events>.

I'm not sure what the advantage of doing that is, though.
[schilcote] It doesn't have to be good, it just has to not be "wow is that the only thing you could think of" bad
KA101
Miner
Miner
Posts: 45
Joined: Tue Jan 15, 2013 2:36 am
Location: US-Eastern

Excellent idea; if this could be applied to NPCs as well as RPCs*, this would greatly facilitate that "interacting with the NPC traders" thing i was suggesting.

*Recruitable Player Characters; term from Wiz8 but could well originate elsewhere. Finding a modder in-game would be rather interesting to say the least.

Looking forward to it.
schilcote
Militia Captain
Militia Captain
Posts: 726
Joined: Sat Feb 02, 2008 7:22 pm

Shouldn't it be RNPC? "Recruitable Player Character" would mean you're recruiting a real person to follow you around.

Interacting with NPC traders would unfortunately be outside of the scope of this system- you'd need a completely different structure, since this thing is based around events that happen to or near the player.
[schilcote] It doesn't have to be good, it just has to not be "wow is that the only thing you could think of" bad
KA101
Miner
Miner
Posts: 45
Joined: Tue Jan 15, 2013 2:36 am
Location: US-Eastern

Fair enough, though with something like Upgradeable [Wingers] or Playership Drones, the line between party-members as "NPCs" v. "PCs that the player didn't start with" tends to blur.

Sorry to hear that, though the idea itself is still good and I look forward to it.
FourFire
Militia Captain
Militia Captain
Posts: 567
Joined: Sun Aug 12, 2012 5:56 pm

This looks pretty cool, I am really looking forward to what sort of things will be done with this, especially with PSD ( I always hated the fact that you still die instantly in PSD, despite having multiple other craft to escape to.)

Now I just need to assure that your voice doesn't slowly sex me up ;)
(func(Admin Response)= true){
if(admin func(amiable) = true)
Create func(Helpful Posts)
else func(Keep Calm and Post derisive topics)}
User avatar
digdug
Fleet Admiral
Fleet Admiral
Posts: 2620
Joined: Mon Oct 29, 2007 9:23 pm
Location: Decoding hieroglyphics on Tan-Ru-Dorem

a hookable NPC companion type library ! sounds awesome ! :D
very nice idea! :)

btw, upgrade to 1.1 and the "nasty black borders" will go away ! (at nearly all resolutions)

also, nice to know that I have to pronounce your name as S-chilcote and not as SHilcote like I was doing. :) you'll never know, might meet you in the future at a "Trans-con" or something :D
schilcote
Militia Captain
Militia Captain
Posts: 726
Joined: Sat Feb 02, 2008 7:22 pm

FourFire wrote:Now I just need to assure that your voice doesn't slowly sex me up ;)
I guarantee nothing.
digdug wrote:btw, upgrade to 1.1 and the "nasty black borders" will go away ! (at nearly all resolutions)

also, nice to know that I have to pronounce your name as S-chilcote and not as SHilcote like I was doing. :) you'll never know, might meet you in the future at a "Trans-con" or something :D
I'm on 1.8l, still in blackborderville.

Either pronunciation is acceptable, actually. Just as long as you don't drop the 'c's like everyone does for whatever reason.

EDIT:

Also, a little treat for y'all: http://www.mediafire.com/?5v84cjtbtqv80e1

Put a little bit of polish on it at school, so I think it's ready for people to at least look at it.

EDIT:
Youtube Captions wrote:this is designed so that the the uh... framework is designed so that
indy
and by anyone
and uh...
do that sort of thing in any station
anything wendy
anything that has concluded
which is
everything interesting um candor
fire hit near you've been strong the
campion should leave and spawned the
companion ship captain list
kena rambling here but um...
basically any
in the
seeing what happens
can now
uniform
[schilcote] It doesn't have to be good, it just has to not be "wow is that the only thing you could think of" bad
schilcote
Militia Captain
Militia Captain
Posts: 726
Joined: Sat Feb 02, 2008 7:22 pm

No-one feels like looking at the preview release? How sad.
[schilcote] It doesn't have to be good, it just has to not be "wow is that the only thing you could think of" bad
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

Derp, didn't think the link was an alpha >.<
I downloaded it and forgot to look inside....
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
schilcote
Militia Captain
Militia Captain
Posts: 726
Joined: Sat Feb 02, 2008 7:22 pm

RPC wrote:Derp, didn't think the link was an alpha >.<
I downloaded it and forgot to look inside....
Well, take a look at it (that's your code at the top of cfwcore.xml for making the init run, by the way, just so you know I'm not trying to pass it off as my own) and see if you can see any problems with the way the interface works or how the documentation explains things. Try making something with it and tell me any problems you run in to or extra features that might come in handy.
[schilcote] It doesn't have to be good, it just has to not be "wow is that the only thing you could think of" bad
Post Reply