Forums Gallery Downloads LOGIN |REGISTER

creating a new FlowNode with C++

Please use this forum for questions on C++, Lua, XML, and any other languages used in CryENGINE development.


 

User avatar
indianen
Just getting started
Just getting started
 
Posts: 32
Member since: 20.01.2012, 17:29
Location: Antwerp, Belgium
Likes: 0

Re: creating a new FlowNode with C++

Postby indianen » 22.04.2012, 17:49

Hi Kimba,

I'm glad my documentation was useful for you.
OSC uses a specific kind of formatting for the messages you send (see http://opensoundcontrol.org/introduction-osc ) it looks a little like this:
/address/ ,f 10.9 (but "10.9" would be binary..)

The messages I'm sending are formatted much simpler. I do this because I want to have something that is working and stable first. Afterwards I can always add more complexity & parsing. It's also lazier :-)
This is how I commented the formatting in the message parser flownode:
Code: Select all
/*
       the structure of the messages I'm sending over UDP is super simple:
       "x y z\n"
       example:
       "0.568 1.234 8.439\n"
       so the end of a message is always the newline character, the rest are floats separated by spaces. */

see here: http://www.crydev.net/viewtopic.php?p=952957#p952957
you should look at the function
Code: Select all
void parseMessage(string inString, SActivationInfo* pActInfo)
in the CFlowNode_MessageParser class.

Does this answer your question?

best,
tim.
kimba23
Junior Dev
Junior Dev
 
Posts: 183
Member since: 21.11.2007, 23:13
Likes: 19

Re: creating a new FlowNode with C++

Postby kimba23 » 22.04.2012, 18:17

Thanks Tim

Does that mean I also should compile the parser?

I actually tried and i got these errors

Code: Select all
c:\program files (x86)\electronic arts\crytek\fresh3_4\code\game\gamedll\nodes\cflownode_messageparser.cpp(143): error C2220: warning treated as error - no 'object' file generated
3>c:\program files (x86)\electronic arts\crytek\fresh3_4\code\game\gamedll\nodes\cflownode_messageparser.cpp(143): warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
3>c:\program files (x86)\electronic arts\crytek\fresh3_4\code\game\gamedll\nodes\cflownode_messageparser.cpp(150): warning C4244: '=' : conversion from 'double' to 'float', possible loss of data


I
I was also able to compile the TCP example on the same thread without any problems...
I am a newbie with programming, I just started with openframeworks, and also trying to learn the cryengine so I am a bit slow.
I will look at the code and see if i can work it out.
if i understand correctly, I should make my own node/parser?

Thanks again
User avatar
indianen
Just getting started
Just getting started
 
Posts: 32
Member since: 20.01.2012, 17:29
Location: Antwerp, Belgium
Likes: 0

Re: creating a new FlowNode with C++

Postby indianen » 22.04.2012, 19:31

ooops!

that's what I get for posting code without checking for stupidity.
Your compiler is getting angry because it's treating warnings as errors.
The casting warning appears because of this line:
Code: Select all
   vec[coordcount] = atof(mssgBuf);


atof() returns a double (see:http://www.cplusplus.com/reference/clibrary/cstdlib/atof/ )
and I have vec[] defined as an array of floats.
I'll edit my original post, but you can just change every occurence of atof(...); to (float)atof(...);
"(float)" casts the double that atof returns into a float.
(more about casting: http://www.cplusplus.com/doc/tutorial/typecasting/)

like this:
Code: Select all
if(coordcount < 3){
                  vec[coordcount] = (float)atof(mssgBuf);
               }


Your other question: yes, you should make an OSC parser node. I've built two flownodes so far. A UDP client node that can send and receive messages and a message parser node that converts received messages into meaningful data (3D vectors).

You can just re-use the UDP client flownode if you only want to receive. If you want to make it send OSC, you'll have to change that too.
If I would want to create an OSC parser flownode I'd start by searching the web for an existing C++ OSC parser and then try to make a flownode with it. I'm pretty sure there must be an OF implementation flying around in cyberspace :-)

good luck with learning this stuff! OpenFrameworks is a great library to learn C++.

best,
tim.
User avatar
indianen
Just getting started
Just getting started
 
Posts: 32
Member since: 20.01.2012, 17:29
Location: Antwerp, Belgium
Likes: 0

Re: creating a new FlowNode with C++

Postby indianen » 22.04.2012, 19:39

User avatar
Gaming Arts
Developer
Developer
 
Posts: 211
Member since: 03.04.2012, 14:33
Likes: 0

Re: creating a new FlowNode with C++

Postby Gaming Arts » 23.04.2012, 15:46

This is exactly what i was lookin for very much thanks
Game Designer
kimba23
Junior Dev
Junior Dev
 
Posts: 183
Member since: 21.11.2007, 23:13
Likes: 19

Re: creating a new FlowNode with C++

Postby kimba23 » 23.04.2012, 16:16

Great Tim
Got it to work, I will try to figure out how to make the osc parser.
Thanks you so much for all your help,

cheers
User avatar
indianen
Just getting started
Just getting started
 
Posts: 32
Member since: 20.01.2012, 17:29
Location: Antwerp, Belgium
Likes: 0

Re: creating a new FlowNode with C++

Postby indianen » 23.04.2012, 17:22

I think I will reconstruct the UDP flownode.
Right now it's only usefull for sending specifically formatted messages.
I will rewrite it so it can send any message as a string. This way the formatting can stay separated from the sending/receiving.

I will put it up on github when it's done.

best,
tim.
User avatar
indianen
Just getting started
Just getting started
 
Posts: 32
Member since: 20.01.2012, 17:29
Location: Antwerp, Belgium
Likes: 0

Re: creating a new FlowNode with C++

Postby indianen » 23.04.2012, 23:57

Hi all,

I've put my flownode code online at https://github.com/timknapen/CryEngine-FlowNodes for everyone to take.
I will update it there instead of in this thread.

best,
tim.
kuta
Just getting started
Just getting started
 
Posts: 12
Member since: 21.06.2013, 02:32
Likes: 0

Re: creating a new FlowNode with C++

Postby kuta » 13.04.2014, 05:05

Hello,I've copied the code you put at the very bottom,but I still found nothing in my flow graph.I am waiting here for your answer.Thank you!


 
Connect and collaborate with CRYENGINE developers in the official Forums.
Visit the Gallery to share what you have created and be inspired by what others are creating with CRYENGINE.
Community