OpenTNL Simple Wrapper

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
User avatar
brentrossen
Kobold
Posts: 35
Joined: Sun May 21, 2006 11:57 pm

OpenTNL Simple Wrapper

Post by brentrossen » Sat Jun 17, 2006 12:50 am

Heya everyone, here's a wrapper for OpenTNL (the Open Source Torque Network Library). It's pretty simple, but I think it will help people avoid the pitfalls I ran into.

The initial example on OpenTNL.org has significant issues (it doesn't compile). So, based on their example, I wrote up some code that does compile and provides stubs that might be useful in an OGRE type project.

http://www.ogre3d.org/wiki/index.php/OpenTNL

Please post any comments, questions, complaints, etc here. Hope it's useful.
0 x

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US

Post by xavier » Sat Jun 17, 2006 12:55 am

Only thing I would say is that I don't know how a networking library is supposed to interface with a pure rendering library -- the design rationale simply makes no sense. Is there any engine logic in between the two?
0 x

User avatar
brentrossen
Kobold
Posts: 35
Joined: Sun May 21, 2006 11:57 pm

Post by brentrossen » Sat Jun 17, 2006 1:16 am

Yeah, I guess I really didn't create an interface from OGRE to OpenTNL. It's more of a good example for getting started with OpenTNL, including a few appropriately named calls with helpful comments.

I figured if one could get both OGRE and OpenTNL working, they could also write a simple communicator class to connect SimpleNet and OGRE. That communicator class is pretty behavior dependent. All I needed was some simple audio and animation calls, others will need significantly more.

Maybe I'm not understanding correctly, is there something you're suggesting I add?
0 x

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
Contact:

Post by jacmoe » Sat Jun 17, 2006 1:16 am

If this could expand into an Ogre powered networked showcase example, I think it has its place.
This is something people often ask for (MMOs, anyone?). :)
0 x
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US

Post by xavier » Sat Jun 17, 2006 2:05 am

Not so much "add" as it is "mismatching of concepts". Unless you are sending direct positional updates of actual Ogre moveable objects across the network, there is nothing to "connect" between the network layer and Ogre...and no one sends direct positional updates of rendering geometry across the network in any practical application of any significant complexity.

Instead, the network layer generally transmits abstract commands, which have some semantic meaning to a game or simulation engine. The engine then ultimately translates the commands (possibly) into some form of positional or orientation update on a rendered player-character (through a more abstract engine entity) -- in other words, the engine updates the Ogre objects, not the networking code. That was what I was asking about "engine" -- I don't know what you are communicating across the network but I certainly hope it's not actual Ogre translations, rotations and scaling.
0 x

User avatar
Wretched_Wyx
Orc
Posts: 498
Joined: Thu Mar 16, 2006 5:27 pm
Contact:

Post by Wretched_Wyx » Sat Jun 17, 2006 2:07 am

Agreed. That and RakNet. Pretty soon here, we're going to have all the bases covered:

Commercial/Free for non-commercial wrappers:
Physics - PhysX - NxOgre
Audio - FMOD - FMOD SoundManager
Vegetation - Planta - ?
Network - RakNet - ?
Input - ? - ?

Pfft. Nice attempt there. My mind went blank with that. Oh well. But you get the point. We'll have the nice free for non-commercial stuff, which will be useful for those out there who want tp protoype the "best of the best" in their commercial projects. Then we have the full on open-source stuff. Gotta love it. Ogre is going to be a beast soon... Er, beastier than he is now.
0 x

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US

Post by xavier » Sat Jun 17, 2006 3:33 am

Input -- OIS

pjcast will have Guido sent around to straighten you up. :P
0 x

User avatar
Wretched_Wyx
Orc
Posts: 498
Joined: Thu Mar 16, 2006 5:27 pm
Contact:

Post by Wretched_Wyx » Sat Jun 17, 2006 4:54 am

OIS is not totally free? I thought it was GPL or LGPL. Where have I been? I was referencing the big commercial/free non-commercial things above :wink:.

I love OIS... It reminds me of waking up in a hotel in Vegas next to the same hot chick you first came there with, *without* a hangover, and more money than when you first arrived. Well maybe not that much, but I'd put it close.
0 x

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US

Post by xavier » Sat Jun 17, 2006 5:06 am

Oh nm, sorry, I thought you were just listing libraries. I doubt there is a commercial input-only library; it's just not something that would sell.
0 x

User avatar
brentrossen
Kobold
Posts: 35
Joined: Sun May 21, 2006 11:57 pm

Post by brentrossen » Sat Jun 17, 2006 6:52 pm

Xavier,

If you look in the code, the Server just makes RPC calls, the Client would handle any connection between network code and OGRE, which would be pretty minimal. The Server would have no idea what rendering engine was being used, and the client network code should have a Communicator type object between it and Ogre to provide a facade.

Could you tell me what exactly is the problem you're seeing and offer a solution? Maybe quote some code or comments? I'd like to understand.
0 x

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US

Post by xavier » Sat Jun 17, 2006 8:43 pm

It is just the fundamental misconception that you can even "connect" networking with Ogre.
the Client would handle any connection between network code and OGRE, which would be pretty minimal.
There is a pretty significant design effort you are assuming is "minimal".

I guess I am having hard time understanding why you would ever want to use *only* Ogre and a network library -- what application for this do you have in mind?
0 x

User avatar
brentrossen
Kobold
Posts: 35
Joined: Sun May 21, 2006 11:57 pm

Post by brentrossen » Sat Jun 17, 2006 8:48 pm

Yeah, I wasn't talking about a network "connection" there. I was speaking of a class that would exist between Ogre and SimpleNet.h (the example). What I was saying was, there isn't a place where Ogre and the network code "connect". They would both communicate with another section of code.

I explained my use for the class on the OpenTNL page in the wiki.
0 x

User avatar
xavier
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 9481
Joined: Fri Feb 18, 2005 2:03 am
Location: Dublin, CA, US

Post by xavier » Sat Jun 17, 2006 8:50 pm

Gotcha. :)
0 x

User avatar
Longstreet
Halfling
Posts: 94
Joined: Tue Jan 20, 2004 10:41 am

Post by Longstreet » Sun Jun 18, 2006 11:10 am

I've been working with TNL on my project, and like its attempt at making network stuff more OO-like than I found with raknet.

Just courious why you chose to put everything in the connection class? I've been keeping the net interface and connection classes seperated. Just seems a bit strange with the interface inside the connection class, and then more connections inside the interface, at least on the server end.
0 x
Have your machines contact my machines.

User avatar
brentrossen
Kobold
Posts: 35
Joined: Sun May 21, 2006 11:57 pm

Post by brentrossen » Sat Jun 24, 2006 9:24 pm

It's mostly to just to keep everything in the same file and use as few lines as possible. I imagine it would be clearer if the interface class were separated out, but quite a few of the requirements on each end are identical. I just didn't think it was necessary to write them twice. This is really just a "get you started" class, each programmer's implementation should differ.
0 x

kneeride
Bugbear
Posts: 807
Joined: Sun May 14, 2006 2:24 pm
Location: Melbourne, Australia

Post by kneeride » Sun Jun 25, 2006 4:35 am

i prefer a facade design over OO in network libraries. i find some OO designs add complexity
0 x

User avatar
tone
Halfling
Posts: 64
Joined: Thu Mar 09, 2006 8:18 pm
Contact:

Post by tone » Wed Aug 09, 2006 4:22 pm

Longstreet wrote:I've been working with TNL on my project, and like its attempt at making network stuff more OO-like than I found with raknet.

Just courious why you chose to put everything in the connection class? I've been keeping the net interface and connection classes seperated. Just seems a bit strange with the interface inside the connection class, and then more connections inside the interface, at least on the server end.
There are several bits I don't like about TNL, and this is one of them.

Another is the reflexive approach taken (that the client and server MUST have the same class representing their connection to the other). I find the combination of these approaches produces "connections" that have a lot of dead code on both sides (am I server, or am I client?) and altogether too much behavior within them.

I'd prefer had they had a listener interface for each which would in turn process the events. This would, I think, lead to a case where you did not have to subclass Connection types, and you could have as much distinction between the server and the client as you wanted.

The same criticism applies to NetEvents -- ::process() should not exist (IMO), as it convolves data transport and serialization with the actions to be taken upon receipt. I'd rather have handlers do that and not muddy up the event code with application logic.


tone
0 x

User avatar
Excizted
Halfling
Posts: 77
Joined: Mon Nov 02, 2009 6:45 pm
Location: Fyn, Denmark

Re: OpenTNL Simple Wrapper

Post by Excizted » Sat Nov 14, 2009 12:38 am

opentnl.org is inaccessible.. how do i download it then!? :(

*Edit: By googling I was able to find it :) Well dunno if its a newer version, the highest version available was 1.5.0

Anyway, found a bug in your sample header..

Code: Select all

int main(int argc, const char **argv)
{
    if(argc != 3) // This should be 2 you know :)
    {
        printf("usage: simpletnltest <-server|-client>");
        ...
Otherwise a great wrapper, works seamlessly :)

I had some trouble setting it up initially, but the problem was simple. So if anyone recieves unexpected linker errors on this test net application, try'n see if your project properties > C/C++ > Code Generation has Multi Threaded Debug DLL enabled, if so change to Multi Threaded Debug and that will work :)
0 x

Post Reply