Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: Action map saving/loading  (Read 1557 times)

vectrex

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 33
    • View Profile
    • http://www.kartsim.com
Action map saving/loading
« on: May 19, 2006, 05:03:24 AM »

howdy, I was wondering if Actionmaps will have a save/load function for easy user config from files? Currently Yake's actionmaps do this and it's a nice function (but no joystick/ff support so I'm using ois)
Also I vote for making actionmaps part of the core or at least more 'official' than the demo as I like them :)
Yake's actionmaps seem a bit more advanced and neater I think although I haven't used either yet. They both seem quite convoluted to me though considering what they actually do, could an absolute minimal example be provided? :)

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2653
    • View Profile
    • http://www.wreckedgames.com
Action map saving/loading
« Reply #1 on: May 19, 2006, 07:05:12 AM »

Well, the ActionMap stuff could be moved into a different folder of helper utilities.. But, as they are very app specific, never part of OIS core.

As for being convaluted, I don't see how.. The class just overrides all the listener events, searches a Map for the trigger (button, axes, etc etc), and calls the callback function. Pretty simple and straight forward. One thing that it could use though, is more template binding (perhaps through the use of Fast Delegates).. as, now it only binds class member method instances. It does not yet to static binding.. but not to difficult to add. And, it is really just an example right now.

For instance, in WGE, I use a Map with the trigger id, and a String.. The string is used to call a Squirrel Script Function callback... And, I combined the ActionMapping stuff directly into the same class that initialises OIS, as the code is very small.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2653
    • View Profile
    • http://www.wreckedgames.com
Action map saving/loading
« Reply #2 on: May 19, 2006, 07:21:28 AM »

Oh, and as for the saving loading. There is no easy way to accomplish this. Besides, using some callback functionality in the ActionMap class, making the demo harder to understand.

And, this is very app specific. Some poeple may want to use a database (ie SQLite) to serialize such settings to/from, while others may prefer scripts (ie WGE) to serialize settings to/from, while others may use flat files. Saving and loading the action map is just saving a few values: the trigger, the event id, and the what to use as a callback. Perhaps, I will implement a small serialiser in the demo, but not in the near future.. I have quite a bit on my plate for the next several weeks. A patch is welcome, that could save/load the action map into a small file, and add a CEGUI button to do that :) As long, as, it stays relatively simple, and does not make the demo much harder to understand.
Logged

vectrex

  • Regular
  • *
  • Karma: +0/-0
  • Posts: 33
    • View Profile
    • http://www.kartsim.com
Action map saving/loading
« Reply #3 on: May 19, 2006, 07:45:42 AM »

I was looking at boost::serialize which looks like it would do the trick neatly as the output isn't set. Assuming of course the structure is suitable, I have to look into it more yet (only just started with OIS).

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 2653
    • View Profile
    • http://www.wreckedgames.com
Action map saving/loading
« Reply #4 on: May 19, 2006, 01:21:54 PM »

Quote from: "vectrex"
I was looking at boost::serialize which looks like it would do the trick neatly as the output isn't set. Assuming of course the structure is suitable, I have to look into it more yet (only just started with OIS).


Boost:serialize would probably work well. However, I really don't see the need for a boost dependency in the OIS demo itself. I hate having to require boost (or any 3rd party large lib, besides Ogre) inside a small lib as OIS. But, in your own app, yeah, boost would rock  :D
Logged

OvermindDL1

  • Administrator
  • Veteran
  • *****
  • Karma: +0/-0
  • Posts: 288
    • View Profile
    • http://www.overminddl1.com/forum/
Action map saving/loading
« Reply #5 on: May 19, 2006, 05:15:49 PM »

You can include the parts of boost you want to use in your own app, just change their namespace to something to insure no conflicts. :)
Logged