OISB (new input binding/mapping library!)

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
User avatar
kulik
Gremlin
Posts: 183
Joined: Sun May 01, 2005 2:00 pm
Contact:

OISB (new input binding/mapping library!)

Post by kulik » Sat Oct 02, 2010 10:12 pm

Hi,
I started a little game project and I found that world is lacking a decent open source input binding library, so I created one. It's in draft, pre-release stage but I really need some opinions and since OIS forum is nowhere near as active as the Ogre one, I posted here, hope I am not upsetting anyone :)

What is OISB?
First of all, it's a contributed OIS project building on top of OIS, thus the only dependency is OIS, it should be troublefree to use this in any project already using OIS.

License:
zlib/libpng (same as OIS)

What does it do?
If your project is using OIS, you're probably checking keystates and fetching the MouseState every frame to check their values. Your code looks similar to this:

Code: Select all

void Game::listenInput()
{
    if (mOISKeyboard->isKeyDown(OIS::KC_A))
        mPlayer->moveLeft();

    ...
}
What is the problem with this? First of all, your users don't get any chance whatsoever to remap controls, so if their A key doesn't work, they have to do some really nasty workarounds to play your game. Second of all, if your users do have some alternative input devices like joysticks, steering wheels or what so ever, they don't get to use them at all.

The alternative to this approach is:

Code: Select all

void Game::listenInput()
{
    if (mMoveLeftAction->isActive())
        player->moveLeft();
}
What is an Action? It's an elementary abstract idea above inputs that represents something user can interact with. User typically binds his/her input device to it to alter it's state. Binding happens like this (all of this already implemented in svn):

Code: Select all

mMoveLeftAction->bind("Keyboard/A");
When user presses the "A" key on the keyboard, the action is activated and the player moves. Furthermore, you can bind more than one key to provide some alternatives.
EDIT: This section was edited, since it now works differently ;-)

Code: Select all

mMoveLeftAction->bind("Keyboard/A");
mMoveLeftAction->bind("Keyboard/Left");
Pressing A or the left arrow key activates the action.

You can even bind combinations, for example to implement the insane difficulty in your game, you can do this:

Code: Select all

mMoveLeftAction->bind("Keyboard/Ctrl", "Keyboard/Alt", "Keyboard/A");
In this case user has to press Ctrl, Alt and A simultaneously to trigger left movement. Windows users will have advantage because of their serious former training of such moves though.

To make it hard even for Windows users, you might want to introduce SequenceAction (really initial non tested implementation in svn, needs more work), the action used before is a TriggerAction (means all of the bound states in at least one binding have to be active to activate the action), SequenceActions provide means to implement things like the good old "iddqd". The binding code is the same but instead of creating TriggerAction, create SequenceAction.

OK, we have sorted out the case when users want to remap their digital keys and even allowed combinations and sequences. How to improve on this? OISB also provides analog axis actions. As the name suggest, they store floating point number representing position on an axis. This can be used especially for racing games. The reason to use AnalogAxisAction instead of TriggerAction with the code above is that users can bind both digital states and analog states (AnalogAxisAction provides means for emulating analog input using digital states). This means that you will make both keyboarders and racing wheel users happy! 8) How all this analog stuff is used is probably best left for another post... It is already implemented but analog axis action will provide more elaborate emulation in future (right now it's just linear as a proof of concept, in future I will allow accelerating and decelerating movement - sort of supporting attack and release).

How to get the code?
I have moved this over to google code so that I can add committer rights to others without bothering pjcast.
http://code.google.com/p/oisb
old: pjcast has set a branch for me in the OIS svn tree (thanks!) - https://wgois.svn.sourceforge.net/svnro ... mpreisler/
It's the OIS' root, the oisb folder in there contains OISB sources.

The old SVN repo is therefore no longer authoritative!

What do I need right now (or: why am I spamming you? :wink: ):
I need ideas and responses (I've had some negative "why the hell would you need that" responses and some positive ones, I need to motivate myself a bit, knowing somebody might use the work I am doing would help tremendously), feature requests would help too 8) (especially if you implement them as well :lol: )

PS: I will hopefully provide a demo application soon (I have a working Ogre, OIS, CEGUI demo of OISB but it's way too complicated to use as OISB demo). I don't want to do tutorials yet since I will be renaming/moving some stuff and otherwise breaking the API.
Last edited by kulik on Wed Mar 02, 2011 1:47 am, edited 4 times in total.
0 x
mpreisler on IRC | CEGUI team member, CEGUI Unified Editor developer, OISB founder

entelin
Greenskin
Posts: 121
Joined: Thu Oct 07, 2004 8:38 am

Re: OISB (input binding)

Post by entelin » Sun Oct 03, 2010 7:42 am

I support your efforts here, I would love to see an input lib that was capable of neatly handling complex input series's (like the crazy stuff you see in platform fighting games) with good support for remapping, etc. As far as I know I don't think an open one even exists currently. I hacked up my own thing, but its pretty bad lol. It's surprisingly hard to come up with a neat solution for this.
0 x

User avatar
madmarx
OGRE Expert User
OGRE Expert User
Posts: 1668
Joined: Mon Jan 21, 2008 10:26 pm

Re: OISB (input binding)

Post by madmarx » Sun Oct 03, 2010 11:43 am

First, I think it's a good idea, since this is something I already do for some of my apps.
The code is so old-school (like Ogre, comparing to template programming), but very OK for me.
Lacks of tests, and tutorials. Some classes could have just a few lines more description (with example of common use).
ActionSchema is simply a set of Actions ?
0 x
Tutorials + Ogre searchable API + more for Ogre1.7 : http://sourceforge.net/projects/so3dtools/
Corresponding thread : http://www.ogre3d.org/forums/viewtopic. ... 93&start=0

User avatar
kulik
Gremlin
Posts: 183
Joined: Sun May 01, 2005 2:00 pm
Contact:

Re: OISB (input binding)

Post by kulik » Sun Oct 03, 2010 12:11 pm

entelin: thanks for the input!

madmarx: I don't think there is any use for templates in there (I had some templates which very unnecessary and I had used a lot of boost but pjcast said it was additional hassle and dependency, so I stripped all the signals and other fancy stuff). Still, it's a starting point, initial commit :-) Could you please tell me what exactly do you find old school about it?

I have not written much about the internals, but ActionSchema is basically a set of Actions that can be enabled/disabled at the same time. An example of ActionSchema might be "Vehicle" which is activated when player gets into a vehicle, suddenly steering, acceleration, braking, etc is enabled, another ActionSchema might be "On foot" which is enabled when player leaves a vehicle. I currently even use "GUI" ActionSchema that I activate whenever I want GUI to listen to input, etc...

Documentation (some of the doxygen docs really need improving as well), tests, tutorials are all lacking, as an excuse I will say (again) that this is initial code, I am basically playing with the concepts and trying to get something usable and powerful out, this might require several iterations (I am not as BDUF as I was a few years ago :wink: )
0 x
mpreisler on IRC | CEGUI team member, CEGUI Unified Editor developer, OISB founder

User avatar
madmarx
OGRE Expert User
OGRE Expert User
Posts: 1668
Joined: Mon Jan 21, 2008 10:26 pm

Re: OISB (new input binding library!)

Post by madmarx » Sun Oct 03, 2010 3:08 pm

I re-read what I wrote, and this was not very clear sorry. I have been doing almost 'templates only' for the past 3 months and this has been refreshing to see the Ogre-like object oriented programming again. I found your code very clean, and with already lots of comments. Unfortunately, I tend to report only little tweaks instead of the overall very good ^^ feeling.
I don't think there is any use for templates.
Listeners can often be made as a template. In your case, you want a single container of various Listeners, so this is not adapted. But if you had gone through function binding, or tag structure ("ActionCar/forward" is on/off/at 80% ...), this would have been adapted.
tutorials are all lacking
Yes, I knew, but it is simply more difficult for us to tell you what we think of it without a code example.

Have fun!
0 x
Tutorials + Ogre searchable API + more for Ogre1.7 : http://sourceforge.net/projects/so3dtools/
Corresponding thread : http://www.ogre3d.org/forums/viewtopic. ... 93&start=0

User avatar
chaosavy
Silver Sponsor
Silver Sponsor
Posts: 567
Joined: Mon Jun 15, 2009 8:29 pm
x 3
Contact:

Re: OISB (new input binding library!)

Post by chaosavy » Sun Oct 03, 2010 3:10 pm

Sounds great to me, I'm looking forward to checking it out once I reach the keymapping stage.
0 x
Visit http://www.VoidDestroyer.com to check out my space sim project - Void Destroyer

User avatar
kulik
Gremlin
Posts: 183
Joined: Sun May 01, 2005 2:00 pm
Contact:

Re: OISB (new input binding library!)

Post by kulik » Sun Oct 03, 2010 4:19 pm

madmarx wrote:
tutorials are all lacking
Yes, I knew, but it is simply more difficult for us to tell you what we think of it without a code example.
Yeah, you're probably right. I will try to cook something up so you can get a better understanding of how things work without digging through the source. I am quite tempted to do a complex Ogre, OIS, OISB, CEGUI demo showing how to remap keys and what not but that might take a lot of time. We'll see what I come up with.

Thanks for the input so far :)
0 x
mpreisler on IRC | CEGUI team member, CEGUI Unified Editor developer, OISB founder

User avatar
kulik
Gremlin
Posts: 183
Joined: Sun May 01, 2005 2:00 pm
Contact:

Re: OISB (new input binding library!)

Post by kulik » Fri Oct 08, 2010 6:27 pm

OK, I've started a little demo. It's basically a helicopter flying, using tons of analog axis actions (throttling, steering, leaning on 2 axes), there is one more secret sequence action. I plan to add running ninjas that you will shoot (this will show off trigger actions). For now it can serve to provide some sample code. I am planning to clean up AnalogAxisAction a lot, simply by moving the emulation code elsewhere and allowing user to customize it if needed.

Note: The throttle analog axis action is basically used as acceleration, this doesn't correspond to how engines work but it seems to fit in this case (unless you bind it to mouse, then it will become a super heli). Engineers, don't shoot me :D

http://harcov.czenet.com/kulik/oisbdemo.zip (win32 binary with data) - I can't assure you that this binary will work, I quickly put it together in 10 minutes or something ;-) It needs msvc2010 runtime. I even accidentaly included CEGUI layout editor so you can hack the UI :lol:

Controls:
W - more throttle
S - less throttle
A - steer left
D - steer right

Up arrow key - lean forward
Down arrow key - lean backwards
Left arrow key - lean left
Right arrow key - lean right

Leaning can also be done with a mouse, this isn't really ready yet but feel free to try ;-)

CTRL+Q or Esc quits the game.

The code that runs this: https://wgois.svn.sourceforge.net/svnro ... cation.cpp
I haven't yet put up a MSVC project file, so if you want to play around, you have to set it up yourself, it shouldn't be that hard...

TODO list:
Implement CEGUI UI to allow remapping of controls (this is a big one :P )
Spawn ninjas on the floor, allow the heli to shoot them and count scores (this will actually maybe make it enjoyable)
Different floor (what sense does it make to fly over tiles?)
Last edited by kulik on Fri Oct 08, 2010 11:49 pm, edited 1 time in total.
0 x
mpreisler on IRC | CEGUI team member, CEGUI Unified Editor developer, OISB founder

User avatar
Brutal
Greenskin
Posts: 142
Joined: Sat Nov 07, 2009 1:51 pm
Location: Gainesville, FL
Contact:

Re: OISB (new input binding library!)

Post by Brutal » Fri Oct 08, 2010 7:06 pm

Thank you for writing this. As I am working on my game, I come to areas where I can envision how things should function based on games I have played, but sometimes thinking them through in code is a bit different. All of the solutions I came up for in my head were extremely messy, where as this one is quite clean. I will be implementing this in my game later tonight and look forward to any updates you make to it.
0 x
**Certified Ogre Professional Amateur

reptor
Ogre Magi
Posts: 1120
Joined: Wed Nov 15, 2006 7:41 pm
Location: Finland

Re: OISB (new input binding library!)

Post by reptor » Mon Oct 11, 2010 10:25 pm

Hi,

I am checking this project out as it seems it is what I need in my project.


As I am on Linux and there are no makefiles for Linux yet for OISB I just dropped the files directly into my Netbeans project. This should work all right as far as I can see.


1) *********************************************************************************

When I try to build it there is an error:
In file included from include/oisb/OISBBindable.h:27,
include/oisb/OISBGlobal.h:89: error: use of enum ‘ActionBindType’ without previous declaration
You have a forward declaration of an enum there.

It appears as if you are using a C++0x feature? Because I can find some web pages talking about this and they say forward-declaring an enum is not possible in C++ - but another page says it has been added in C++0x. http://stackoverflow.com/questions/7141 ... -enum-in-c I don't think using a C++0x feature in this project is a good idea...

Furthermore, I tried searching for ActionBindType in the files and it seems it is not defined or used anywhere so the only place where it is written is the forward declaration in OISBGlobal.h. So it is a useless forward declaration any ways.

So I just commented it out to make the project build.

The compiler I am using is "g++ (Debian 4.3.2-1.1) 4.3.2". Perhaps your Visual C++ 2010 is supporting the C++0x feature to forward-declare enums and hence why you don't get the error.



2) *********************************************************************************

I found another problem. You have this:

Code: Select all

typedef std::vector<std::pair<String, Bindable*> > BindableList;


twice in OISBBinding.h. In lines 170 and 200. Commenting out the latter one solves this problem.

Proceeding... let's see if something else comes up!

Curiously enough your compiler must have let this pass too.



3) *********************************************************************************

Another error:
src/oisb/OISBAnalogAxisState.cpp: In member function ‘void OISB::AnalogAxisState::_setAbsoluteValue(OISB::Real)’:
src/oisb/OISBAnalogAxisState.cpp:65: error: ‘fabs’ was not declared in this scope
src/oisb/OISBAnalogAxisState.cpp:65: error: ‘numeric_limits’ is not a member of ‘std’
src/oisb/OISBAnalogAxisState.cpp:65: error: expected primary-expression before ‘>’ token
src/oisb/OISBAnalogAxisState.cpp:65: error: ‘::epsilon’ has not been declared
I solve this by adding:

Code: Select all

#include <cmath>
#include <limits>
to the top of the OISBAnalogAxisState.cpp file next to the other include already there. Are they brought in by windows.h on Windows? I don't know but after adding those two lines the build continues.

4) *********************************************************************************

The same error is in OISBAnalogAxisAction.cpp so I added the same includes there as well as in step 3 above.






Now it completed building. I am yet to use it in my code but at least I got the files to build.
0 x

User avatar
DanielSefton
Ogre Magi
Posts: 1235
Joined: Fri Oct 26, 2007 12:36 am
Location: Mountain View, CA
Contact:

Re: OISB (new input binding library!)

Post by DanielSefton » Tue Oct 12, 2010 2:56 am

Thanks kulik, this will come in handy. :)

I created a patch which fixes the bits harming compilation on linux/mac that reptor pointed out. I also added a template function (if you're anti-templates for this library, just ignore it) which makes it easier to create actions without the nasty casts.

Code: Select all

mSteering = static_cast<OISB::AnalogAxisAction*>(mChopterSchema->createAction("Steering", OISB::AT_ANALOG_AXIS));
To

Code: Select all

mSteering = mChopterSchema->createAction<OISB::AnalogAxisAction>("Steering");
This also makes it easier to bind to scripting languages (e.g. luabind)

Code: Select all

class_<ActionSchema>("ActionSchema")
    .def("CreateTriggerAction", &ActionSchema::createAction<TriggerAction>)
    .def("CreateSequenceAction", &ActionSchema::createAction<SequenceAction>)
    .def("CreateAnalogAxisAction", &ActionSchema::createAction<AnalogAxisAction>)

Code: Select all

Index: include/OISB.h
===================================================================
--- include/OISB.h    (revision 27)
+++ include/OISB.h    (working copy)
@@ -25,7 +25,6 @@
 #define __OISB_OISB_H__
 
 #include "OISBAction.h"
-#include "OISBActionManager.h"
 #include "OISBActionSchema.h"
 #include "OISBAnalogAxisAction.h"
 #include "OISBAnalogAxisState.h"
Index: include/OISBAnalogAxisAction.h
===================================================================
--- include/OISBAnalogAxisAction.h    (revision 27)
+++ include/OISBAnalogAxisAction.h    (working copy)
@@ -50,6 +50,8 @@
 
             /// @copydoc Action::getActionType
             virtual ActionType getActionType() const;
+            
+            static ActionType getActionTypeStatic();
 
             void setEmulationDecreaseSpeed(Real speed);
             void setEmulationIncreaseSpeed(Real speed);
Index: include/OISBActionSchema.h
===================================================================
--- include/OISBActionSchema.h    (revision 27)
+++ include/OISBActionSchema.h    (working copy)
@@ -84,6 +84,18 @@
             Action* createAction(const String& name, ActionType type);
             
             /**
+             * @brief creates a new action and casts it to the specified action type.
+             * 
+             * @tparam T type of action
+             * @param name name of the new action
+             * @return pointer to the newly created action
+             */
+            template<class T> inline T* createAction(const String& name)
+            {
+                return static_cast<T*>(createAction(name, T::getActionTypeStatic()));
+            }
+            
+            /**
              * @brief destroys previously created action
              * 
              * @param name name to lookup
Index: include/OISBGlobal.h
===================================================================
--- include/OISBGlobal.h    (revision 27)
+++ include/OISBGlobal.h    (working copy)
@@ -86,7 +86,6 @@
     typedef float Real;
 
     class Action;
-    enum ActionBindType;
     class ActionSchema;
     class AnalogAxisState;
     class AnalogAxisAction;
Index: include/OISBTriggerAction.h
===================================================================
--- include/OISBTriggerAction.h    (revision 27)
+++ include/OISBTriggerAction.h    (working copy)
@@ -50,6 +50,8 @@
 
             /// @copydoc Action::getActionType
             virtual ActionType getActionType() const;
+            
+            static ActionType getActionTypeStatic();
 
             bool getValue() const;
 
Index: include/OISBSequenceAction.h
===================================================================
--- include/OISBSequenceAction.h    (revision 27)
+++ include/OISBSequenceAction.h    (working copy)
@@ -50,6 +50,8 @@
 
             /// @copydoc Action::getActionType
             virtual ActionType getActionType() const;
+            
+            static ActionType getActionTypeStatic();
 
             /// @copydoc Action::createBinding
             virtual Binding* createBinding();
Index: include/OISBBinding.h
===================================================================
--- include/OISBBinding.h    (revision 27)
+++ include/OISBBinding.h    (working copy)
@@ -197,7 +197,6 @@
             /// true if this binding is active (means that it activated the parent action)
             bool mIsActive;
 
-            typedef std::vector<std::pair<String, Bindable*> > BindableList;
             /// stores bounds states/actions of this binding
             BindableList mBindables;
     };
Index: src/OISBTriggerAction.cpp
===================================================================
--- src/OISBTriggerAction.cpp    (revision 27)
+++ src/OISBTriggerAction.cpp    (working copy)
@@ -38,6 +38,11 @@
         return AT_TRIGGER;
     }
     
+    ActionType TriggerAction::getActionTypeStatic()
+    {
+        return AT_TRIGGER;
+    }
+    
     bool TriggerAction::impl_process(Real /*delta*/)
     {
         bool ret = false;
Index: src/OISBAnalogAxisAction.cpp
===================================================================
--- src/OISBAnalogAxisAction.cpp    (revision 27)
+++ src/OISBAnalogAxisAction.cpp    (working copy)
@@ -28,6 +28,9 @@
 
 #include "OISException.h"
 
+#include <cmath>
+#include <limits>
+
 namespace OISB
 {
     AnalogAxisAction::AnalogAxisAction(ActionSchema* parent, const String& name):
@@ -57,6 +60,11 @@
     {
         return AT_ANALOG_AXIS;
     }
+    
+    ActionType AnalogAxisAction::getActionTypeStatic()
+    {
+        return AT_ANALOG_AXIS;
+    }
 
     void AnalogAxisAction::setEmulationDecreaseSpeed(Real speed)
     {
Index: src/OISBSequenceAction.cpp
===================================================================
--- src/OISBSequenceAction.cpp    (revision 27)
+++ src/OISBSequenceAction.cpp    (working copy)
@@ -40,6 +40,11 @@
     {
         return AT_SEQUENCE;
     }
+    
+    ActionType SequenceAction::getActionTypeStatic()
+    {
+        return AT_SEQUENCE;
+    }
 
     Binding* SequenceAction::createBinding()
     {
Index: src/OISBAnalogAxisState.cpp
===================================================================
--- src/OISBAnalogAxisState.cpp    (revision 27)
+++ src/OISBAnalogAxisState.cpp    (working copy)
@@ -23,6 +23,9 @@
 
 #include "OISBAnalogAxisState.h"
 
+#include <cmath>
+#include <limits>
+
 namespace OISB
 {
     AnalogAxisState::AnalogAxisState(Device* parent, const String& name):
0 x

User avatar
kulik
Gremlin
Posts: 183
Joined: Sun May 01, 2005 2:00 pm
Contact:

Re: OISB (new input binding library!)

Post by kulik » Tue Oct 12, 2010 9:06 am

reptor:
Thanks for the report and sorry about the enum forward decl, I got rid of the enum later and forgot about the forward declaration. Using C++0x features is definitely not a good idea and wasn't intentional.

DanielSefton:
Thanks for the patch Daniel! I am definitely not anti templates and I was planning to introduce something similar :) I am currently not at home and won't be till Thursday, so commiting will have to wait till then.
The changes making this build on Linux are great, I was initially developing this on Linux but then switched to Windows because I had to do something there and didn't want to dual boot, so my later changes have probably broken linux compat. Full Linux support is definitely planned.



I am now deciding how to implement the build system. OIS itself uses separate MSVC files and makefiles. This sounds like a maintenance nightmare to me (I hate having to boot into different OSes and having to install all sorts of IDEs just to test that I didn't mess up the project/make files). I was thinking of using cmake but that's probably overkill. What do you think?

The next big change I plan is to support buffered input changes. So when user presses a key twice or more in a frame (which is unlikely under normal circumstances but gets much more probable as FPS drops) both presses will get caught. This will need a slight API change. Another important fix is to clean up the demo data (I just grabbed Ogre sample materials :wink: so there are many errors reported) and finish the demo including remapping.

There is a lot of work needed in analog axis and sequence. Analog axis will likely get split into the code doing just the action (storing min max, abs, delta value, etc...) and a separate class able to emulate digital input (since this is a lot of code and would just unnecessarily pollute the class). I plan to implement 2 emulation classes - linear (this is the current algorithm, linear with and optional return) and quadratic (accelerating/decelerating with optional return). Developers could inherit these classes and provide their own emulation if needed.

Pretty high on the priority list is wrapping of joysticks and other devices reported by OIS :lol: Right now only mouse and keyboard are wrapped which kinda defeats the purpose of this library.
0 x
mpreisler on IRC | CEGUI team member, CEGUI Unified Editor developer, OISB founder

User avatar
kulik
Gremlin
Posts: 183
Joined: Sun May 01, 2005 2:00 pm
Contact:

Re: OISB (new input binding library!)

Post by kulik » Sat Oct 16, 2010 8:48 pm

Just a little update here:
I have applied Daniel's patch with minor modifications, so now it should build on Linux.
I have split analog emulation out of analog axis action.

Furthermore, there is a new way of setting properties.

Code: Select all

mThrottle = mChopterSchema->createAction<OISB::AnalogAxisAction>("Throttle");
mThrottle->setProperty("MinimumValue", 0.0f);
mThrottle->setProperty("EmulationReturnValue", 9.0f);
mThrottle->setProperty("MaximumValue", 15.0f);
mThrottle->setProperty("EmulationSpeed", 10.0f);
mThrottle->setProperty("EmulationReturnSpeed", 10.0);
See the demo for more on how to use these ;-)

I will probably remove Visual Studio project files and just provide CMakeLists.txt... The project file is probably already outdated and it's a PITA to update it.
0 x
mpreisler on IRC | CEGUI team member, CEGUI Unified Editor developer, OISB founder

nurf
Gnoblar
Posts: 8
Joined: Mon Sep 29, 2008 5:45 pm

Re: OISB (new input binding library!)

Post by nurf » Sun Oct 17, 2010 11:15 am

Very nice project.
We have realized it very similar within our game engine.
I will have a deeper look into your project, when I am back from vacations.
0 x

User avatar
kulik
Gremlin
Posts: 183
Joined: Sun May 01, 2005 2:00 pm
Contact:

Re: OISB (new input binding library!)

Post by kulik » Sat Nov 13, 2010 12:31 am

Just a note here that I am not abandoning this project, quite the contrary, I am using it in a sample game of my entity engine (of course using Ogre) - http://www.youtube.com/watch?v=Na4IEa5zWwo

The first possible stable release is getting close, I have replaced "delta value" with "relative value" to make the API more clear, I am finishing some tutorials, reviewing doxygen docs, initial documentation and cmake build system (not committed yet), I have plans to support buffered input states but as of now I have no need for them so I am deciding whether to postpone that feature or not. The critical stuff that keeps me from releasing is basically just the demo (needs major data cleanup and UI for remapping). I also plan official python bindings for OIS and OISB and I want them to make it to the release.

Even though I anticipated more positive reactions (a big thanks to the people who did support me!) I believe some might use OISB after it gets stable and the effort to publish this is actually worth it.
0 x
mpreisler on IRC | CEGUI team member, CEGUI Unified Editor developer, OISB founder

User avatar
chaosavy
Silver Sponsor
Silver Sponsor
Posts: 567
Joined: Mon Jun 15, 2009 8:29 pm
x 3
Contact:

Re: OISB (new input binding/mapping library!)

Post by chaosavy » Sat Nov 13, 2010 4:37 pm

cool vid and neat model.
0 x
Visit http://www.VoidDestroyer.com to check out my space sim project - Void Destroyer

User avatar
tdev
Silver Sponsor
Silver Sponsor
Posts: 244
Joined: Thu Apr 12, 2007 9:21 pm
Location: Germany

Re: OISB (new input binding/mapping library!)

Post by tdev » Sat Feb 19, 2011 2:46 am

i am helping kulik a bit with this project as we want to use it was well for our game "Rigs of Rods".

just finished the basics for the XML loading part where you can throw an xml config file at OISB and it does the mapping for you :)

example xml file (example_schema.xml):

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<schemas>
	<schema name="Default">
		<action type="Trigger" name="Quit">
			<bind>Keyboard/Q</bind>
			<bind>Keyboard/Esc</bind>
		</action>
	</schema>
	<schema name="Chopter">
		<action type="AnalogAxis" name="Throttle" MinimumValue="0" MaximumValue="100" EmulationReturnValue="9" EmulationSpeed="10" EmulationReturnSpeed="4" />
	</schema>
	<schema name="Car">
		<action type="AnalogAxis" name="Brake" MinimumValue="0" MaximumValue="10" EmulationReturnValue="3" EmulationSpeed="1" EmulationReturnSpeed="2" />
	</schema>
</schemas>
and its usage in the code:

Code: Select all

		// load the schema from xml
		OISB::System::getSingleton().loadActionSchemaFromXML("example_schema.xml");

		OISB::Action *mExitAction = OISB::System::getSingleton().lookupAction("Default/Quit");

		// .. later on in the code

		  //check if we should exit
			  if (mExitAction->isActive())
			  {
				  break;
			  }
work in progress :)

EDIT: forgot to say, we have a simple cmake buildsystem now as well
0 x

User avatar
tdev
Silver Sponsor
Silver Sponsor
Posts: 244
Joined: Thu Apr 12, 2007 9:21 pm
Location: Germany

Re: OISB (new input binding/mapping library!)

Post by tdev » Sat Feb 19, 2011 2:03 pm

added basic joystick support today, now we need to add linearity, death-zone and other joystick features.

force feedback also still missing

change: http://code.google.com/p/oisb/source/de ... cf1045d09b#

update: xml for joysticks working:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<schemas>
	<schema name="Default">
		<action type="Trigger" name="Quit">
			<bind>Keyboard/Q</bind>
			<bind>Keyboard/Esc</bind>
		</action>
	</schema>
	<schema name="Chopter">
		<action type="AnalogAxis" name="Throttle" MinimumValue="0" MaximumValue="100">
			<bind optional="1">Controller (Xbox 360 Wireless Receiver for Windows)/Axis 0</bind>
		</action>
		<action type="Trigger" name="Fire">
			<bind optional="1">Controller (Xbox 360 Wireless Receiver for Windows)/Button 0</bind>
		</action>
	</schema>
	<schema name="Car">
		<action type="AnalogAxis" name="Brake" MinimumValue="0" MaximumValue="10" EmulationReturnValue="3" EmulationSpeed="1" EmulationReturnSpeed="2" />
	</schema>
</schemas>
0 x

reptor
Ogre Magi
Posts: 1120
Joined: Wed Nov 15, 2006 7:41 pm
Location: Finland

Re: OISB (new input binding/mapping library!)

Post by reptor » Wed Mar 02, 2011 1:38 am

I tried to compile the latest OISB code from svn on Linux and g++ (Debian 4.3.2-1.1) 4.3.2 gives this:
In file included from src/oisb/OISBPropertySet.cpp:24:
include/oisb/OISBPropertySet.h:57: error: explicit specialization in non-namespace scope ‘class OISB::PropertySet’
include/oisb/OISBPropertySet.h:67: error: expected nested-name-specifier before ‘T’
include/oisb/OISBPropertySet.h:67: error: too many template-parameter-lists
include/oisb/OISBPropertySet.h:73: error: explicit specialization in non-namespace scope ‘class OISB::PropertySet’
include/oisb/OISBPropertySet.h:81: error: too many template-parameter-lists
include/oisb/OISBPropertySet.h:91: error: too many template-parameter-lists
It looks like some template code in there isn't g++ compatible? Perhaps someone else can try to compile it on Linux - I don't understand how to fix that.
0 x

User avatar
kulik
Gremlin
Posts: 183
Joined: Sun May 01, 2005 2:00 pm
Contact:

Re: OISB (new input binding/mapping library!)

Post by kulik » Wed Mar 02, 2011 1:45 am

I don't have a comfy access to a Linux box ATM, will hopefully get there on Friday to test this.

Just to make sure, are you using the code from the Mercurial repository at Google code? I should commit to the wgois repo that I no longer commit here. :)

Unrelated news:
I am working with tdev to make input mapper and input designer Qt applications. The priority of this is low for me and I have a lot of other stuff to attend to but hopefully I will get it done eventually.
0 x
mpreisler on IRC | CEGUI team member, CEGUI Unified Editor developer, OISB founder

reptor
Ogre Magi
Posts: 1120
Joined: Wed Nov 15, 2006 7:41 pm
Location: Finland

Re: OISB (new input binding/mapping library!)

Post by reptor » Wed Mar 02, 2011 2:48 am

It's from the wgois repository. I didn't notice that you have switched to another place.

But, taking a quick look at it, it looks like the same problem can be with the code in the other repository too - the code looks like it's the same.

As I didn't see how to get it to compile to be a lib, I just put the files into my project directly but I think that should not be the problem.



And no worries about this not being a priority now... I have definitely no hurry with this at all and I can always work around it if I can't get it fixed by myself (I just test this lib out for now, it's not crucial for my project).
0 x

reptor
Ogre Magi
Posts: 1120
Joined: Wed Nov 15, 2006 7:41 pm
Location: Finland

Re: OISB (new input binding/mapping library!)

Post by reptor » Wed Mar 02, 2011 7:02 pm

I searched around the net a bit and some people seem to think Visual C++ allows some non-standard template code to pass whilst g++ doesn't. I don't understand it enough yet to fix it but I'll have another go at it. And I'll change to the other repository even though I think that's not going to solve the problem.


Edit: Yeah, the copy from your hg repository gives the exact same errors.
0 x

reptor
Ogre Magi
Posts: 1120
Joined: Wed Nov 15, 2006 7:41 pm
Location: Finland

Re: OISB (new input binding/mapping library!)

Post by reptor » Thu Mar 03, 2011 1:09 am

I got help to fix the problem with the templates at the gamedev forum. And I also had to do other fixes too.

Here is a patch:


Code: Select all

diff -rupN -b --exclude=build /home/vader/programming/libs/oisb/CMakeLists.txt /home/vader/programming/libs/oisb_custom/CMakeLists.txt
--- /home/vader/programming/libs/oisb/CMakeLists.txt	2011-03-03 01:59:28.000000000 +0200
+++ /home/vader/programming/libs/oisb_custom/CMakeLists.txt	2011-03-03 01:53:10.000000000 +0200
@@ -52,11 +52,11 @@ add_library(oisb STATIC ${sources} ${inc
 install(TARGETS oisb ARCHIVE DESTINATION lib)

 # oisb simple demo
-include_directories(demo/simple)
-add_executable(oisb_console demos/simple/OISBConsole.cpp demos/simple/CommandLine.rc)
-target_link_libraries(oisb_console oisb ${OISB_OIS_LIB})
+#include_directories(demo/simple)
+#add_executable(oisb_console demos/simple/OISBConsole.cpp demos/simple/CommandLine.rc)
+#target_link_libraries(oisb_console oisb ${OISB_OIS_LIB})

-install(TARGETS oisb_console RUNTIME DESTINATION bin)
+#install(TARGETS oisb_console RUNTIME DESTINATION bin)

 # doxygen stuff
 find_package(Doxygen)
Binary files /home/vader/programming/libs/oisb/.hg/dirstate and /home/vader/programming/libs/oisb_custom/.hg/dirstate differ
diff -rupN -b --exclude=build /home/vader/programming/libs/oisb/include/OISBPropertySet.h /home/vader/programming/libs/oisb_custom/include/OISBPropertySet.h
--- /home/vader/programming/libs/oisb/include/OISBPropertySet.h	2011-03-03 01:59:28.000000000 +0200
+++ /home/vader/programming/libs/oisb_custom/include/OISBPropertySet.h	2011-03-03 01:29:52.000000000 +0200
@@ -53,27 +53,13 @@ namespace OISB
                 impl_setProperty(name, toString(value));
             }

-            /// @copydoc PropertySet::setProperty
-            template<>
-            inline void setProperty<String>(const String& name, const String& value)
-            {
-                impl_setProperty(name, value);
-            }
-
             /**
              * @brief gets property of given name and the result is returned as given type
              */
             template<typename T>
-            inline typename T getProperty(const String& name) const
+            inline T getProperty(const String& name) const
             {
-                return fromString<typename T>(impl_getProperty(name));
-            }
-
-            /// @copydoc PropertySet::getProperty
-            template<>
-            inline String getProperty<String>(const String& name) const
-            {
-                return impl_getProperty(name);
+                return fromString<T>(impl_getProperty(name));
             }

             /// coverts given type to string, idea from boost::lexical_cast
@@ -109,6 +95,21 @@ namespace OISB
              */
             virtual String impl_getProperty(const String& name) const;
 	};
+
+
+    /// @copydoc PropertySet::getProperty
+    template<>
+    inline String PropertySet::getProperty<String>(const String& name) const
+    {
+        return impl_getProperty(name);
+    }
+
+    /// @copydoc PropertySet::setProperty
+    template<>
+    inline void PropertySet::setProperty<String>(const String& name, const String& value)
+    {
+        impl_setProperty(name, value);
+    }
 }

 #endif
diff -rupN -b --exclude=build /home/vader/programming/libs/oisb/src/OISBAnalogAxisState.cpp /home/vader/programming/libs/oisb_custom/src/OISBAnalogAxisState.cpp
--- /home/vader/programming/libs/oisb/src/OISBAnalogAxisState.cpp	2011-03-03 01:59:29.000000000 +0200
+++ /home/vader/programming/libs/oisb_custom/src/OISBAnalogAxisState.cpp	2011-03-03 01:25:33.000000000 +0200
@@ -23,6 +23,9 @@ restrictions:

 #include "OISBAnalogAxisState.h"

+#include <cmath>
+#include <limits>
+
 namespace OISB
 {
 	AnalogAxisState::AnalogAxisState(Device* parent, const String& name):
diff -rupN -b --exclude=build /home/vader/programming/libs/oisb/src/OISBSystem.cpp /home/vader/programming/libs/oisb_custom/src/OISBSystem.cpp
--- /home/vader/programming/libs/oisb/src/OISBSystem.cpp	2011-03-03 01:59:29.000000000 +0200
+++ /home/vader/programming/libs/oisb_custom/src/OISBSystem.cpp	2011-03-03 01:23:00.000000000 +0200
@@ -24,7 +24,7 @@ restrictions:
 #include "OISBSystem.h"
 #include "OISBMouse.h"
 #include "OISBKeyboard.h"
-#include "OISBJoystick.h"
+#include "OISBJoyStick.h"
 #include "OISBActionSchema.h"
 #include "OISBAction.h"
 #include "OISBState.h"
@@ -39,8 +39,9 @@ restrictions:
 #include "OISBSequenceAction.h"
 #include "OISBTriggerAction.h"

-#include <strstream>
+#include <sstream>
 #include <fstream>
+#include <cstring>

 using namespace rapidxml;


So basically the two template specialisations were moved outside of the class definition with some other minor changes too as you can see.


NOTE: THIS PATCH DISABLES THE SIMPLE DEMO. The simple demo (OISBConsole) looked so broken that I decided to just disable it so that I got the build process to go through.


I haven't tested whether the library actually works, but at least with these changes the build process goes through and a liboisb.a is created.
0 x

reptor
Ogre Magi
Posts: 1120
Joined: Wed Nov 15, 2006 7:41 pm
Location: Finland

Re: OISB (new input binding/mapping library!)

Post by reptor » Fri Mar 04, 2011 4:44 pm

I'm not sure whether the library actually works now on my Linux or not.

I adapted the code from the OISB demo 'ogre' into my program and it throws an exception with the message: "Action schema 'Keyboard' not found". The 'defineActions' function is written exactly the same as in the demo.

Since I made some changes to OISB to make it compile on Linux, I am not 100 % sure that it is actually a working version. I may test the OISB demo 'ogre' on Windows by myself (with and without my modifications to it) but if somebody already knows for sure that it works (with or without my modifications to it, please specify), please tell.
0 x

User avatar
kulik
Gremlin
Posts: 183
Joined: Sun May 01, 2005 2:00 pm
Contact:

Re: OISB (new input binding/mapping library!)

Post by kulik » Sun Mar 06, 2011 12:48 pm

reptor: I think I have fixed the problem, I have replaced the improper specialisation with more straightforward code, please pull & update to verify. As for your other problem, I will need a dump of action schemas and your code (yeah there is no means to do this, I will add this in a few minutes). I think Keyboard is a device not an action schema so you might be looking it up wrong.

EDIT: I added System::dumpActionSchemas() and System::dumpDevices(), please run both and post the output.
0 x
mpreisler on IRC | CEGUI team member, CEGUI Unified Editor developer, OISB founder

Post Reply