irrNetz (another lightweight enet wrapper)
irrNetz (another lightweight enet wrapper)
Hello,
for my techdemo I needed some network code. BlindSide implemented irrNet and irrNetLite, so why another wrapper? The answer is very simple:
At first I wanted to get a little bit closer to game network code programming. The second reason was, I wanted to use the latest enet code (1.3.3), which comes already with compression code (range coder), so the reference to zlib is not needed any longer. Furthermore I wanted the code to be a little bit more irrLicht style.
Here is the result. At the moment there is only a simple server and a simple client sample. But I will soon add a chat sample with irrlicht gui and a game lobby sample.
My dev system is win7/MS-VisualStudio so it would be nice if someone could compile and test it on other platforms/dev systems.
http://www.van-helsing-band.de/irrlicht/irrNetz.zip
for my techdemo I needed some network code. BlindSide implemented irrNet and irrNetLite, so why another wrapper? The answer is very simple:
At first I wanted to get a little bit closer to game network code programming. The second reason was, I wanted to use the latest enet code (1.3.3), which comes already with compression code (range coder), so the reference to zlib is not needed any longer. Furthermore I wanted the code to be a little bit more irrLicht style.
Here is the result. At the moment there is only a simple server and a simple client sample. But I will soon add a chat sample with irrlicht gui and a game lobby sample.
My dev system is win7/MS-VisualStudio so it would be nice if someone could compile and test it on other platforms/dev systems.
http://www.van-helsing-band.de/irrlicht/irrNetz.zip
Re: irrNetz (another lightweight enet wrapper)
very interesting. thanks for sharing
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Re: irrNetz (another lightweight enet wrapper)
haven't have time to test this out, but it does sound interesting. good job man.
My company: http://www.kloena.com
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
My blog: http://www.zhieng.com
My co-working space: http://www.deskspace.info
Re: irrNetz (another lightweight enet wrapper)
Isn't this C++ and C mixed without proper externs???
Re: irrNetz (another lightweight enet wrapper)
Yes it is c mixed with c++, but I think the enet header (enet.h) itself ensures the proper use of "extern":
so I hope that everthing is correct.
Code: Select all
...
#ifdef __cplusplus
extern "C"
{
#endif
...
Re: irrNetz (another lightweight enet wrapper)
yes enet is protected, and your code is mostly correct as well (printf = c++)
but in your examples you're using _getch() and _kbhit().
Those are C if I'm not mistaken and I occasionally am. On that note I'm not trying to make a big deal of it, just thought I'd point that out in practice.
but in your examples you're using _getch() and _kbhit().
Those are C if I'm not mistaken and I occasionally am. On that note I'm not trying to make a big deal of it, just thought I'd point that out in practice.
Re: irrNetz (another lightweight enet wrapper)
Using C from C++ code = not bad
Using Windows-only functions in examples for portable code = bad
Using Windows-only functions in examples for portable code = bad
Re: irrNetz (another lightweight enet wrapper)
is that what it is? Yeah we've gone down the C&Cpp debate road enuff... as a matter of fact MSDN is telling me conio and those two functions from it are proper for all versions of the C Runtime libraries so it is actually c++ anyway I guess.
At any rate I've gained knowledge from your code and I thank you for that.
At any rate I've gained knowledge from your code and I thank you for that.
Re: irrNetz (another lightweight enet wrapper)
MS's C runtime, not any standard. Conio is only supported on Windows (/ late DOS).
Re: irrNetz (another lightweight enet wrapper)
Yeah, I didn't realize that conio is msvc only.
Replacing
with
should do fine.
The problem I ran into was the generation of memory leaks when terminating the program because the final drop statements for objects were not reached...
EDIT:
on the server side the while statement should look like this:
Replacing
Code: Select all
while(!(_kbhit() && _getch()=='q') && peer->getState() == net::ECS_CONNECTED)
Code: Select all
while(peer->getState() == net::ECS_CONNECTED)
The problem I ran into was the generation of memory leaks when terminating the program because the final drop statements for objects were not reached...
EDIT:
on the server side the while statement should look like this:
Code: Select all
while(1)
Re: irrNetz (another lightweight enet wrapper)
Ideally you could mix it with some irrlicht like demo, using irrlicht events for keys. this is (IRR)netz afterall.