Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 12 Mar 2012
Offline Last Active Jan 15 2016 07:16 AM

Topics I've Started

Gesture Recognition Approach

10 July 2015 - 04:38 PM

Hello fellow gamedevs,


i have a quick question regarding gesture recognition and hope for some of you to be better informed than i am. (Which is most likely the case.)


What i did first:

Me beeing new to the field at first took a very naive approach, sampling my sensor x times per second and then did a likelihood analysis (via  a Levensthein adaption) - which was painfully slow and not really robust (for obvious reasons).


What i do now:

My new approach differs quite a bit of that.

Now i have a list of sensor data, a time value how fast the state has to be reached to be satisfied and a fuzzyness factor.  Every samplepoint in my list then basicly acts as a state and i store which state was last satisfied.

A state is satisfied, as soon as its predecessor is satisfied (state -1 is always) and we reached its ancestor in the given time without leaving the capsule spanned by the two samplepoints and the fuzzynessfactor(as radius).


The question(s) beeing...

Does this approach have a name so i can do some readup on that? I am not very well acquainted with the terminology as many of you might have guessed by now, so i couldnt find anything so far.

Also: Does this even sound like a feasible approach? It works for very simple gestures and i am currently in the process of testing more advanced ones, but it also clearly has its shortcomings...



I hope someone is able and willing to help, if you need more information i will provide this as soon as possible. Thanks in advance and warm regards,



PS: I almost forgot to tell! My sensor data is continous and clamped (since its angular data). Positional data is also planned but should work similar.

Polymorphism and casts.

02 April 2012 - 02:08 PM

Greetings again.

I tumbled across another problem which seems to be quite huge:
I registered an Interface from C++, named 'BaseEntity'.
A script class "AbstractBaseEntity" inherits that Interface.
A script class "AbstractNPC" inherhits "AbstractBaseEntity"

That results in a rather simple class hierarchy...

So far, so good.
I also have registered a method 'instanciate' for a global property named System. It works well, and instanciates my entities just fine. It is registered to return a handle '@BaseEntity' ... which works fine, too.
I can use the InterfaceSpecific methods then.

But now comes the clue:
I cant cast!

The following code does not work:

// Those are self designed includes. They work fine. I made a scriptdump to verify right behavior.
#include scripts/entity/IBaseEntity.as
#include scripts/entity/NPC.as

void main() {
	// System pretty sure is registered. But check to be sure... <img src='http://public.gamedev.net//public/style_emoticons/default/tongue.png' class='bbc_emoticon' alt=':P' />
	if( System is null ) {
		println("System is null.Aborting.");

	// Instanciate an entity.
	BaseEntity@ ent=System.instanciate("AbstractBaseEntity");

	if (ent !is null) {
		println("Received Entity(BaseEntity) with id: "+ent.getID());
	} else {
		println("Ent is null... :'( ");

	 // Prints:
	AbstractBaseEntity@ ent2=cast<AbstractBaseEntity>(ent);
	if (ent2 !is null)
		println("We have an AbstractBaseEntity at hand, btw.");

	 // Works fine.
	ParamList par();
	BaseEntity@ ent3=System.instanciate("AbstractNPC","AbstractNPC @AbstractNPC(int,string)",par);
	 //ent3 is an BaseEntity by now. Its true. I checked it. (:
	AbstractNPC@ ent4=cast<AbstractNPC>(ent);
	if (ent4 !is null)
		println("We have an AbstractNPC at hand, btw.");


Received Entity(BaseEntity) with id: 0
AbstractNPC created. ( <- This is printed in the constructor of AbstractNPC )

I just updated to the newst version of angelscript. So far everything seems to work fine.
Help appreciated.

With warm regards,
Kuro Sei.

PS: Shall i have missed some important details or in case you need some closer specification of my registrations or the script classes i will update those asap. But for now i dont see any reasyon why i should pump up this overextended wall of text even more.

Returning from AS ( Comprehension Question )

20 March 2012 - 12:09 PM

Okay, it's me again.
Most likely my question is easy to solve again, but i got hung there for 2 days now. Maybe i searched google and the forum for the wrong key words?

Well: The alst few days i was wrapping my head around AngelScript as good as possible. Now i have the problem that i want a generic method to receive return Values from Angelscript.

It looks like that:

template<class T> T getReturnG() {
  asIScriptObject* sObj=*(asIScriptObject**)scriptContext->GetReturnObject();
  T ent=(T)sObj;
  return ent;

//Some specis for it.
template<> int getReturnG() {
  return (int)scriptContext->GetReturnDWord();

template<> float getReturnG() {
  return scriptContext->GetReturnFloat();
template<> double getReturnG() {
  return scriptContext->GetReturnDouble();

It works fine with reference types, float, int etc.
But when i try to receive an std::string i get an error. It's a value type so i guess it has something to do with that?
( I registered strings with registerStdString() btw)
The compiler tells me, that asIScriptObject* can't be converted to std::string.

I got no idea how to retrieve value types with this convention. Any ideas?

Sorry, if the question is kinda dumb... ^^"

Edit: Oh i forgot:

Thats how i retrieve the return value.
std::string str=sys->getReturnG<std::string>();

Thats how i registered the function:
"string getString()"

AddScriptSection crashs

12 March 2012 - 07:07 AM

Im new to angelscript and honestly didnt program in C++ for a while so please be gentle to me ;)

I had no problems getting angelscript integrated in my IDE and stuff, but when i tried around with the ScriptEngine a bit i got a nasty error i cant solve.

My specs are:
Microsoft Visual Studio 2010
Windows 7 (64 bit)
Angelscript 22202

I use Angelscript as a static lib.

The code which does problems is this one ( Broke it down to be shorter. Posted Image )

  // Create the script engine
  asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);

  int r = engine->SetMessageCallback(asFUNCTION(MessageCallback), 0, asCALL_CDECL);

  // get the main module ( Or create it...)
  main_module=engine->GetModule("main", asGM_ALWAYS_CREATE);
  // Register the standard string for use in AngelScript
  // Ready.

ScriptManager::ScriptManager(std::string name, std::string path, bool dump)
  // First set up the general stuff we need.

  // Load the designated file.
  std::string script=LoadScriptFile(path);

  main_module->AddScriptSection(name.c_str(), script.c_str()); // PROBLEMS HERE


The last bit of code (namely: main_module->AddScriptSection(name.c_str(), script.c_str()); ) breaks my application. Visual Studio catchs the Exception. Edit: The messageCallback gives no output.

The debugger tells me that i got memory violation. __vfptr cant be interpreted as it seems.

I would be very gratefull if anyone knew an answer since im pretty much in to learn the AngelScript Scriptengine and language since it seems to fit my needs pretty well. Posted Image

If you need more information i missed for some reason feel free to ask and i will answer asap.