suggestion for InputHandlerDevice.createTrigger

the method

createTrigger( InputActionInterface action, int eventIdentifier, int envolvement, boolean relocate, InputHandler inputHandler)

, in my opinion, should be changed to:

createTrigger( InputActionInterface action, int eventIdentifier, int envolvement, boolean relocate, InputHandler inputHandler, Object data)





my reasoning is versatility. For my game i have something called a WorldDevice that triggers localized events, the problem is that the current createTrigger method has no way of telling the device where the trigger is. ie where the owner of the trigger is. Say a player creates a new Tigger with the worldDevice, that trigger belongs to the player and should have data to be able to place the trigger at the same location(but in a different data structure), the current createTrigger can't do this. A good example of a localized event is a chat message, players can only see the message in a radius from where the chat message was sent.



Am i making sense?

Do i have a valid point or should i be doing something different?

Maybe I am just clueless  :?, but could you not just implement an InputActionInterface with that user provided data in the constructor so it would be available to you when the action is performed?

:? there is no such method!



Do you mean

InputHandlerDevice.createTriggers( InputActionInterface action, int axis, int button, boolean allowRepeats,
                                            InputHandler inputHandler );



If yes, your request does not make any sense to me. What data should be passed? The method is called by InputHandler.addAction - which does not have any data available. It is invoked to create triggers for an input axis or button of an input device.

I'm not sure if it's a good idea to use the input system for in-game-triggers - and I assume that's what you are after?

Feeling a bit like a broken record now, but GameControlManager was designed just such a scenario. :wink:

duenez: The action is passed some data, and creates some, but the dispatching of the event created by the action needs to be handled by the inputsystem or some event dispatch system. your comment didn't make complete sense to me, did i get it right?



irrisor: Whats the difference in functionality between in game triggers and the physical device input system? i don't think there is any, it is all event-response handling.



and sorry darkfrog, i don't understand your system, and even if i did, i still might not like it because it isn't event driven.

is there an example of GameControlManager somewhere?

Fungi said:

irrisor: Whats the difference in functionality between in game triggers and the physical device input system? i don't think there is any, it is all event-response handling.

hehe, well you might need additional data :P
Ok, seriously. Of course you can use the InputHandlers to get efficient event dispatching for other things. But still that additional method for createTriggers does not make sense to me. Though, you can use the InputHandlers for your purpose: The InputHandler does not have additional data to pass to createTriggers. But you can map that data in your "WorldDevice", depending on axis or button... you could even use the action to map or store that data... is this a solution for you?
irrisor said:
you could even use the action to map or store that data.

That sounds like a suppository  :P.
InputHandler doesn't have additional data to give it which is why you create a new addAction method.

The inputhandler is build in to practically everything and it has almost all of the things necessary to work your whole game around, I don't see why another system is needed to do practically the same event-repsonse thing. Yes darkfrog i know you like your GameControlManager but i don't see the genius you do, sorry.

What is everyone else using for game logic/trigger/action/event/whatever
Fungi said:
Yes darkfrog i know you like your GameControlManager but i don't see the genius you do, sorry.


Well, then there's not much I can do for you. ;)  GameControlManager is not event-driven though.  It is intended primarily to mimic the functionality of games like Battlefield 2 (and MANY others that give you good control over your key bindings).  Take a look at jmetest.input.controls.TestSwingControlEditor as an example of various uses of it.  I have yet to find anything it is not good for....yes, I think it's genius coding and if other people would take the time to understand it they might be as biased as me. ;)

how is the control system supposed to respond to an event rather than just act blindly?

Fungi said:

how is the control system supposed to respond to an event rather than just act blindly?


Take a look at jmetest.input.controls.TestSwingControlEditor as an example of various uses of it.

I read that.



take the localized message example i stated above. how is the GameControl system supposed to manage that? or a new example: a hit action? who is suppose to hold data for the attack and how is it supposed to be passed to the controller? The example you gave is just simple key bindings that don't need much data and the GameControl system seems designed for minimal data.



I guess i don't realize how you use a non-event system to describe events, thats what they are. When i press a button: an event. When i attack a mob: an event. When i eat a sandwich while I'm programming: an event. Everything in a game has the event-response relationship, Even your GameControl system is event(very primitive event)-response.



event-response just makes sense:

actions are the means in which you change the system but an event defines: who, what, when, where, why and how much, everything about the change.

All events need to easily define parameters for: source, target, time, location, the action that create the event (:the answers to the question words, isn't that convenient that the human language can tell us exactly want is important to know about an event).

The most important parameter is how much. A single event defines many quantities for how much. For example: a hit event: total damage, percent absorbed by the shields, what angle it hit at, where it hit, whatever.



I don't think the input system was designed to be the core of a game actions but i don't see why it shouldn't be, they are so similar, am i wrong?

Fungi said:

I don't think the input system was designed to be the core of a game actions but i don't see why it shouldn't be, they are so similar, am i wrong?

You're not. I'll try to explain again what I mean:

The only data that the createTriggers method should get is data to identify the 'part' of the device that the action gets bound to. So I imagine you could do something like this:

int someBooleanEventId = myWorldDevice.createEvent(any, data, you, can, imagine);

and lateron:

myInputHandler.addAction(someAction, "world", someBooleanEventId, AXIS_NONE, false);

This is the way synthetic buttons/axes work currently. This way you can easily listen to all buttons/axes, list them etc. This would not be possible that easily if you'd need an additional arbitrary data object.
What's wrong with it? Why would you need the data parameter in the createTriggers and addAction methods?

There are supporting features in GameControls to handle events and non-events.  Not everything is necessarily event related.  However, it can make things often more convenient.



Take a look here:

https://jme.dev.java.net/source/browse/jme/src/com/jme/input/controls/controller/



By using controllers you can localize the activity of that controller to whatever spatial it is associated with.  Further, there are many included controllers for GameControls to help you replicate the functionality you want whether it’s a simple “pressed / released” style of event handling or repetitive based on a certain delay or something completely unique.  Use those as examples that should prove any circumstance you may want to handle is supported.  That’s what I was trying to get at with that test.  It makes use of a few of these controllers to accomplish various common game tasks.

irrisor said:

The only data that the createTriggers method should get is data to identify the 'part' of the device that the action gets bound to.

but that 'part' of the device changes, thats why i need another parameter, for the object who owns the action
of course i could place a owner in the device, then call addAction so that in InputHandlerDevice.createTrigger could pull the data out. but again, thats a hack, a way around this limitation, a suppository.

irrisor said:

This would not be possible that easily if you'd need an additional arbitrary data object.

well then i cant use it.

darkfrog said:

By using controllers you can localize the activity of that controller to whatever spatial it is associated with.  Further, there are many included controllers for GameControls to help you replicate the functionality you want whether it's a simple "pressed / released" style of event handling or repetitive based on a certain delay or something completely unique.  Use those as examples that should prove any circumstance you may want to handle is supported.  That's what I was trying to get at with that test.  It makes use of a few of these controllers to accomplish various common game tasks.

yes i read those too, they can do when things happen but they only work if you are looking at some specific value and know exaclty what to do with it. They can only answer the question how much. if you open a mail box and all there is is a piece of paper with a number on it how do you know what to do with it. The only way you can know is if you have a single thing you do with that number. but if your instructions are too give "x" hitpoints to "someperson" and just incase that "someperson" wants to know the person giving them those hit points, it's "someotherperson". that can't be done if all i am allowed to write on that piece of paper is a number. thats what i was asking, and that i haven't seen any examples of, dynamic actions that do more than just evaluate a simple "how much" number.

You still did not explain why you need that additional value so desperately…

nvm, i'll just change it locally every time i update from CVS

o_O