irrNetLite 2.1 [BETA]

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki

irrNetLite 2.1 [BETA]

Postby BlindSide » Mon Jul 02, 2007 6:30 pm

UPDATE: New 2.1 Beta version includes:

- Support for different w_char sizes across different machines (Linux and windows can communicate w_char now).
- More helper functions for SPacket.
- MSVC lib compiled properly now.
- Can run along side Irrlicht easily by defining "COMPILE_WITH_IRRLICHT", it will use the Irrlicht containers in this scenario. Otherwise you can also use it without Irrlicht if you want.

Hey guys I decided to release the Beta version which I've been handing around publically.

irrNetLite is an easy to use version of irrNet that does not depend on the irrlicht device or scene nodes. It is purely for easy, no hassle sending of packets using common irrlicht types.

New features in 2.0 include zlib packet compression, an AES encryption/decryption mechanism, more callbacks (For things like On connect/On disconnect) and more or less a complete re-write of the original irrNetLite.

You can get it from here:
http://irrlichtirc.g0dsoft.com/BlindSide/irrNetLite2.1Beta.zip

Excerpt from the tutorial (Updated API, pay attention):

Code: Select all
         // To send a packet, first you create an SOutPacket object.
         net::SOutPacket packet;
         
         // Then you can use the streaming operator << to add new data to it.
         packet << "Help I am stuck on a mountain!";
         
         // You can even chain the << operators like so, just like with ostream.
         packet << core::vector3df(50.0f, 30.0f, 20.0f) << 50.0f;
         
         // Compress the packet, not much to be said.
         packet.compressPacket();
         
         // Encrypt the packet. Note that here we are just using a simple key
         // that is shared among the client and the server. In more sophisticated
         // implementations you may want to generate a random key on the server for
         // each client and send that using a shared key, then use the new key for
         // further communication. Remember that the key should be 16 characters
         // long, and obviously the client and server must share the same key.
         packet.encryptPacket("hushthisissecret");
         
         // A simple call to "sendOutPacket" will send the packet to the server.
         netManager->sendOutPacket(packet);


Some more info (From original old post):
Most of the usage is similar to this and easy to use. It uses an interface very similar to the irrlicht event reciever, where the you construct a "packet handler" class derived from the base packet handler class and irrNetLite will send all the recieved packets there for processing. irrNetLite is not very big or elaborate, but I think it will help many people who want a no hassle solution to sending and managing their own packets without all the useless overhead and junk contained in irrNet, RakNet, and other big network libs, but also without needing to work with difficult low level api offered by Enet, HawkNL and other low level libraries.

Cheers.
Last edited by BlindSide on Wed Nov 04, 2009 12:22 am, edited 7 times in total.
BlindSide
Admin
 
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Postby m_krzywy » Mon Jul 02, 2007 6:35 pm

Looks nice. I'll try it in practise ;)
User avatar
m_krzywy
 
Posts: 133
Joined: Sat Nov 04, 2006 2:05 pm

Postby 3ddev » Tue Jul 03, 2007 10:12 am

Quite nice. Easy to integrate with existing games. :wink:
3ddev
 
Posts: 169
Joined: Tue Sep 19, 2006 6:51 am

Postby omar shaaban » Tue Jul 03, 2007 10:44 am

ya that was what i looking for !!! not on irrlicht scene node who i couldn't understand it or seemed stupid to me but this is perfect a simple network !! thanks blind side !!
User avatar
omar shaaban
 
Posts: 616
Joined: Wed Nov 01, 2006 6:26 pm
Location: Cairo,Egypt

Postby stef_ » Tue Jul 03, 2007 5:39 pm

IMHO the name is a bit wrong, should be : enetUtils, enetPacketBuilder.

A wrapper should add something a bit more consistent, otherwise I prefer to use
enet directly :)

Bye
stef_
 
Posts: 53
Joined: Tue Apr 18, 2006 9:39 pm

Postby BlindSide » Tue Jul 03, 2007 5:45 pm

stef_ wrote:IMHO the name is a bit wrong, should be : enetUtils, enetPacketBuilder.

A wrapper should add something a bit more consistent, otherwise I prefer to use
enet directly :)

Bye


Yes I recommend people to use ENet directly to have more control. But if someone wants to use this so its easier then they can too.
BlindSide
Admin
 
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Postby lostclimategames » Thu Apr 03, 2008 1:53 pm

this is nice but my question would be is how did you accomplish this. I want to make my own packet handling system that can send and recieve instances of classes I made in my program, an was wondering how you got this to work.
___________________________
For all of your 3D/2D resource needs:
Image
lostclimategames
 
Posts: 331
Joined: Sat Sep 02, 2006 4:11 am
Location: Michigan

Postby d3jake » Thu Apr 03, 2008 8:58 pm

Is this version tied to Windows and Linux? Or can it be compiled on Mac as well? Forgive me if the other one does indeed work on Mac...
The Open Descent Foundation is always looking for programmers! http://www.odf-online.org
"I'll find out if what I deleted was vital here shortly..." -d3jake
User avatar
d3jake
 
Posts: 198
Joined: Sat Mar 22, 2008 7:49 pm
Location: United States of America

Postby monkeycracks » Thu Apr 03, 2008 9:04 pm

Just curious, I was trying to implement a disconnect() function for the client. I did so in INetManager like this :

Code: Select all
void INetManager::disconnect()
      {
         if(!isserver)
            enet_peer_disconnect(peer, 0);
      }


Is this correct? Should I be doing it differently? How could I disconnect a client from the server based on the client id?

I looked through the eNet docs and tried to play around with the irrNetLite stuff to make it work but I'm still not getting the printf that should be showing when ENET_EVENT_TYPE_DISCONNECT is given.
monkeycracks
 
Posts: 1029
Joined: Thu Apr 06, 2006 12:45 am
Location: Tennesee, USA

Postby MasterGod » Thu Apr 03, 2008 9:32 pm

Pure simplicity. I love it.
Thanks!!

P.S
Add a link in the Wiki..
Image
Dev State: Abandoned (For now..)
Requirements Analysis Doc: ~87%
UML: ~0.5%
User avatar
MasterGod
 
Posts: 2061
Joined: Fri May 25, 2007 8:06 pm
Location: Israel

Postby BlindSide » Fri Apr 04, 2008 5:27 am

monkeycracks wrote:Just curious, I was trying to implement a disconnect() function for the client. I did so in INetManager like this :

[code]I looked through the eNet docs and tried to play around with the irrNetLite stuff to make it work but I'm still not getting the printf that should be showing when ENET_EVENT_TYPE_DISCONNECT is given.


I think thats correct, I'll have a closer look into it later. The manager automatically calls enet_deinitialize(); when its destructed, so you can just destroy the NetMgr when you want to disconnect, and make a new one when you want to make a new connection. (Unless there is some specific reason why you can't do this.).

I also implemented an onConnect callback for this, as I found that essential, and a few other improvements. So expect those to be added sometime soon.

this is nice but my question would be is how did you accomplish this.


Well I thought you could look at the source of irrNetLite and figure that out. Hint "memcpy".

Is this version tied to Windows and Linux? Or can it be compiled on Mac as well? Forgive me if the other one does indeed work on Mac...


In theory it'll work without a flaw on Mac, as it just uses Enet which just uses BSD sockets which are implemented pretty identically on both Unix and Mac operating systems. Googling for something like "Enet on Mac" should get you somewhere if you're stuck. This post seems relevant.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
BlindSide
Admin
 
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Postby D-Eagle » Sat May 03, 2008 2:16 pm

My server crashes, when second player joins and tries to send a packet.

Code: Select all
#include "irrNet.h"

#pragma comment(lib,"ws2_32.lib")

using namespace irr::net;

INetManager* NetManager;

class CPacketHandler : public PacketHandler
{
public:
    CPacketHandler(){};
    virtual ~CPacketHandler(void){};
    virtual void Handle(InPacket * packet);
private:
   char buffer[1000];
   c8 packetid;
};

void CPacketHandler::Handle(InPacket * packet)
{
   packet->getNextItem(packetid);

   if(packetid == 50)
   {
      packet->getNextItem((char*)buffer);
      c8 textstyle; packet->getNextItem(textstyle);
      OutPacket* opacket = NetManager->createOutPacket();
      opacket->addData((c8)50);
      opacket->addData(buffer);
      opacket->addData(textstyle);
      for(u16 i=0;i<NetManager->getPeerCount();i++)
      {   
         NetManager->sendOutPacket(opacket,i);
      }
      printf("%s \n",buffer);
   }
}

int main()
{
   CPacketHandler* handler = new CPacketHandler();
   NetManager = createNetManager(handler);
   NetManager->setUpServer(2593);

   while(1)
   {
      NetManager->update();
   }

   return 1;
}


the console:

Code: Select all
Initializing Enet!
Creating server!
A new client connected from 100007f:1951
asd: mo
asd: this works
asd: let me join with another client
A new client connected from 100007f:1952
asd2: hi
Error sending outgoing packets: No error
Error sending outgoing packets: No error
Error sending outgoing packets: No error
Error sending outgoing packets: No error
Error sending outgoing packets: No error
Error sending outgoing packets: No error
D-Eagle
 
Posts: 25
Joined: Fri Jan 25, 2008 11:03 pm

Postby BlindSide » Mon May 05, 2008 2:05 am

You are probably calling update() too frequantly. This is designed to be used in a game loop, so stick a "Sleep(100);" in there just after "NetManager->update();".
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
BlindSide
Admin
 
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Postby D-Eagle » Mon May 05, 2008 1:14 pm

I added it to the server, and it still does it.
D-Eagle
 
Posts: 25
Joined: Fri Jan 25, 2008 11:03 pm

Postby BlindSide » Fri May 09, 2008 11:46 pm

Ok another problem I see is:
Code: Select all
for(u16 i=0;i<NetManager->getPeerCount();i++)
      {   
         NetManager->sendOutPacket(opacket,i);
      }


Could you try replacing it with:

Code: Select all
NetManager->sendOutPacket(opacket);


Which does the exact same thing.

Does the debugger tell you anything useful?
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
BlindSide
Admin
 
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Next

Return to Project Announcements

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest