Jump to content

X2EventManager as an Enterprise Service Bus?


TeamDragonpunk

Recommended Posts

 

EDIT : Also, I need a globally accessible Object variable that last during the whole game session.

For now I store my stuff in the game main menu but that's just a temp solution since prototypes state is reset as soon as we leave this menu...

I'm not familiar at all with UDK, are gamestates object the only way to do it ? (even if i don't need my data to be stored permanently in the savegame files ?! )

 

you could push it to the `ScreenStack bottom with

`SCREENSTACK.Screens.InsertItem(`SCREENSTACK.Screens.length-1, myScreen );

Works for me and puts it below everything else, and since it's a stack it would keep it that way (unless anything else tries burrowing even lower)

 

EDIT: as long as the game dosnt decide it wants to delete the stack and repopulate it like it does on game start

Edited by Guest
Link to comment
Share on other sites

Thanks, that helped to do some more tests.



Unfortunately, it doesn't last during a whole game-session because the game de-references all actors (including screens) when the game's class changes (there's one for the lobby, one for HQ and one for tactical).



But later I saw UIDataStore.


UDK's doc make it looks incredibly painful to use, but in fact it's quite simple.


Thankfully there's use-case in the Engine package, that helped me to figure how it works, eg : PlayerController.RegisterCustomPlayerDataStores()


Edited by OVNI
Link to comment
Share on other sites

Thanks, that helped to do some more tests.

Unfortunately, it doesn't last during a whole game-session because the game de-references all actors (including screens) when the game's class changes (there's one for the lobby, one for HQ and one for tactical).

But later I saw UIDataStore.

UDK's doc make it looks incredibly painful to use, but in fact it's quite simple.

Thankfully there's use-case in the Engine package, that helped me to figure how it works, eg : PlayerController.RegisterCustomPlayerDataStores()

Really? It could help a lot for me. Right now I am having problems with saving some data for UI options, can you post some code of the use cases and bow to read from it (without overriding any classes)
Link to comment
Share on other sites

Sure, here's the class I use to store my global data.


Some parts are specific to my framework obviously, you can replace PrototypeManager stuffs (and/or add new one) your own types.


Or you can use the GetValue/SetValue map-like methods.



 



class DataManager extends UiDataStore;


struct KeyObjectValuePair {
var string Key;
var Object Value;
};


var private PrototypeManager _prototypeManager;
var private array<KeyObjectValuePair> _pairs;


function PrototypeManager GetPrototypeManager() {
if( _prototypeManager == none ) {
_prototypeManager = new class'PrototypeManager';
_prototypeManager.Init();
}
return _prototypeManager;
}


function Object GetData( string key ) {
local int i;
for( i=0; i<_pairs.length; i++) {
if( _pairs[i].Key == Key ) {
return _pairs[i].Value;
}
}
return none;
}


function SetData( string key, Object value ) {
local int i;
local KeyObjectValuePair pair;

for( i=0; i<_pairs.length; i++ ) {
if( _pairs[i].Key == Key ) {
_pairs[i].Value = Value;
return;
}
}

pair.Key = key;
pair.Value = value;
_pairs.AddItem(pair);
}



public static function DataManager GetInstance() {
local DataManager instance;
local DataStoreClient dataStoreManager;

dataStoreManager = class'UIInteraction'.static.GetDataStoreClient();

instance = DataManager( dataStoreManager.FindDataStore( class'DataManager'.default.Tag ) );

if( instance == none ) {
instance = dataStoreManager.CreateDataStore( class'DataManager' );
dataStoreManager.RegisterDataStore(instance);
}

return instance;
}


DefaultProperties
{
Tag=ProtolanderDataManagerTag
}

 



use case :



// store a databag object
class'DataManager'.static.GetInstance().SetValue( "ModName", myModStuff );
myModStuff.foo = "bar";
...
// get it back
myModStuff = class'DataManager'.static.GetInstance().GetValue( "ModName");
`log( myModStuff.foo ); // logs "bar"

edit : spoiler tag



edit2 : that map-like stuff should be in a separate class, it's a bit messy as it is :shameful smilley:


Edited by OVNI
Link to comment
Share on other sites

@FxsRMcFall, Sir, before we get too deep in the woods, are you able to share any additional information on how a cordinated mod community might work with Firaxis to resolve this? (short of the current proposed idea of just adding more hooks). Now that the IDE is working, this is the communities next major challenge.

Link to comment
Share on other sites

I'm happy to participate in a discussion about best practices and mod interoperability. A framework mod is something we expected would evolve once the mod community had exposure to the systems and some mod ideas to spur it forward.

 

Someone mentioned that static data members don't exist in UE3 ... actually they sort of do but getting at them can be pain. There is a method on engine called "FindClassDefaultObject" that will return the default object for any class by name. We added this to our version of UE3... anyways, data members of this object can be used like statics. Be aware that these members also form the "default" values of the class, so any values you set in there will be propagated to new instances of that class.

 

Anyways, seeding the event manager with lots of events for modders to take advantage of - in combination with a set of methods that let you inject listeners for the events - could go a long way.

Link to comment
Share on other sites

Would that fresh SDK change also bring some indirect methods to "perfectly" mimic what TexMod could do to replace stock UI textures at runtime? Instead of having to create a static (but almost permanent) IDE pseudo-model with a properly devised MCController asset (with upward compatibility structure components that everyone has to rely on) that should offer us various features?

 

It's either the edge or the limit of most layered mechanics (including GFX-Flash tackling), AFAIC.

Link to comment
Share on other sites

Would that fresh SDK change also bring some indirect methods to "perfectly" mimic what TexMod could do to replace stock UI textures at runtime? Instead of having to create a static (but almost permanent) IDE pseudo-model with a properly devised MCController asset (with upward compatibility structure components that everyone has to rely on) that should offer us various features?

 

It's either the edge or the limit of most layered mechanics (including GFX-Flash tackling), AFAIC.

 

What fresh SDK change are you referring to, and what do you recommend in technical terms as far as accomplishing this?

Link to comment
Share on other sites

Well, from Ryan's comment...

-- Anyways, seeding the event manager with lots of events for modders to take advantage of - in combination with a set of methods that let you inject listeners for the events - could go a long way.

 

Maybe i'm misinterpreting the "set of methods" part as a new SDK set of features... but nevertheless, anything they can actually add as supplemental ways to control a number of **other** aspects via dedicated components would satisfy me.

 

TexMod principle (of control) is an obsession of mine since i really could tackle a LOT of UI/HUD elements (of the EW mod Re-CLR for Long-War) simply by injecting any runtime textures at will. Then, after a few weeks examining the XC2 UC scripts, i had to rationalize a simple truth... achieving such a process might require some extra IDE resources and specific functions adapted precisely for that kind of a UI task. Recently, Infectedm was able to create an ingenious code device to handle my colored Rank-Icons for qUIck_RCP.

 

This tiny jewel...

class UIMCController_qUIckR extends UIMCController;

simulated function QueueString(string Param) {
    local bool IconShouldBeReplaced;
    IconShouldBeReplaced = InStr(Param, "img:///UILibrary_Common.rank_") != -1
                        || InStr(Param, "img:///UILibrary_Common.psirank_") != -1;
    super.QueueString(IconShouldBeReplaced ? Repl(Param, "img:///UILibrary_Common.", "img:///qUIck_RCP_UILibrary.") : Param);
}

That immediately kicked up my mindset to analyze the MC-Controller stuff found into the source files folder. Soon enough, the obvious became clear (from snippets of the Samuel Batista code.. in terms of Flash, at least) -- some kind of generic template that combines many necessary "features" would need to be designed for the Modding community to refer as the core device which should serve as basis for everything else. A bit like the "Mod Options" static capacity that anyone must connect to in hopes Class/Overrides are prevented correctly as they should.

 

A SDK with such stable (compatible) external tools is the ideal solution as with many other special needs anyone could ever have.

 

Thus -- when Ryan speaks of methods, i can only dream of more User-Friendly (accessible) devices for the common modders out there. Better controls, better results.

 

:ninja: :geek:

Edited by Zyxpsilon
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...