Irrlicht Wrapper Library

A forum to store posts deemed exceptionally wise and useful
k1ll3rdr4g0n
Posts: 13
Joined: Tue May 22, 2007 5:25 am

Irrlicht Wrapper Library

Post by k1ll3rdr4g0n »

I have put together a small, as of today, somewhat functioning wrapper library for Irrlicht.
When I first started using Irrlicht I found it too much to learn about. Especially, when you want to use in a class for college!
So this weekend I put together a set of functions that are useful but will grow over time, and I thought I would share it with you.

Site: http://irrlib.sourceforge.net/
API: http://irrlib.sourceforge.net/docs/index.html

Instead of posting to some website in a zip file, I setup a SVN so you could either look at it file by file or setup a SVN checkout on your computer.
Note: You need this: http://tortoisesvn.tigris.org/ to setup a SVN checkout on your computer.

SVN Location: http://svn.datanethost.net/irrlib/
Note: You do NOT need a svn client to browse, you only need a web browser.

Its no where near completion, my ultimate goal is to integrate dozens of code snippets and a physics engine at the very least.
There will be simple examples in the SVN along with a book of sorts containing a (somewhat uptodate) record of all the functions.

Right now I am struggling to add functions for input, if someone would like to help me with that I will set them up with an account and we can work on it together. With that said, anyone who wants to add to it, I can setup a SVN account for you; the only reason why I don't allow anyone to add submissions to the SVN is to prevent abuse (which may change in the future).
Last edited by k1ll3rdr4g0n on Fri Sep 21, 2007 12:09 am, edited 2 times in total.
TheMiss
Posts: 14
Joined: Sun Apr 15, 2007 6:46 pm

Re: Irrlicht Wrapper Library

Post by TheMiss »

k1ll3rdr4g0n wrote: When I first started using Irrlicht I found it too much to learn about.
Really? Why I don't think so? :shock:

And I think this is quite a template/framework. 8)
k1ll3rdr4g0n
Posts: 13
Joined: Tue May 22, 2007 5:25 am

Re: Irrlicht Wrapper Library

Post by k1ll3rdr4g0n »

TheMiss wrote:
k1ll3rdr4g0n wrote: When I first started using Irrlicht I found it too much to learn about.
Really? Why I don't think so? :shock:

And I think this is quite a template/framework. 8)
This is easier than using DX itself, but there isn't functions like MakeSphere(x, y, z, texture).

I was also raised with BASIC then Visual Basic 6. I was spoiled with easy programming languages :P.

But, since C++ is very powerful I would rather make games in it than VB, so I decided if I am going to use Irrlicht, mayaswell make it easier for me (and others use).
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Uhm, we have addSphereSceneNode(...). You can do node->getMaterial(0).Texture1=getTexture(...). That's pretty simple and only two lines long.
k1ll3rdr4g0n
Posts: 13
Joined: Tue May 22, 2007 5:25 am

Post by k1ll3rdr4g0n »

hybrid wrote:Uhm, we have addSphereSceneNode(...). You can do node->getMaterial(0).Texture1=getTexture(...). That's pretty simple and only two lines long.
Right, but it would be easier to let a class handle that such that you can easily reference them like...

IrrLib Irrlicht;
sphereid = Irrlicht.CreateNewSphereNode(0, 0, 30, "../../media/wall.bmp", false);
Irrlicht.MoveSphere(0, 0, 35, sphereid);

Prehaps the sphereid could even be a class...but that would be too complicated. Actually, a class in the IrrLib class for working with spheres.

Irrlicht.Sphere.MoveSphere(0, 0, 35, sphereid);

This is looking more like java everyday!

Basically I did this for easier code reading and writing.

Think about too, when you create a game you are not going to create 1 node you are going to create several, and although my class creates 10 node objects (the class still needs a lot of work) in an array, both the class and you can easily reference them.

Its early and adding a sphere isn't going to be the only thing it does. Its a work in progress.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

But you know that pointers and references are made just for this purpose, and using an array (or map if you like) of ISceneNode pointers you can do exactly this. But you will save hundreds of method calls because you can use the pointers directly...
Cardinal4
Posts: 97
Joined: Sun Jun 11, 2006 1:20 am
Location: SG
Contact:

Post by Cardinal4 »

k1ll3rdr4g0n wrote: Irrlicht.Sphere.MoveSphere(0, 0, 35, sphereid);

This is looking more like java everyday!
Err.... no. Java would look more like sphereid.Move(0,0,35).
Irrlicht's current API is way more OOP than that to have to rely on a single class IrrLib to house all the methods for everything... You should be able to act on that entity using that entity's own methods rather than asking another class to do that.
Sketches of a rambling mind
Still a long way on learning Irrlicht...
kburkhart84
Posts: 277
Joined: Thu Dec 15, 2005 6:11 pm

Post by kburkhart84 »

Cardinal4 wrote:
k1ll3rdr4g0n wrote: Irrlicht.Sphere.MoveSphere(0, 0, 35, sphereid);

This is looking more like java everyday!
Err.... no. Java would look more like sphereid.Move(0,0,35).
Irrlicht's current API is way more OOP than that to have to rely on a single class IrrLib to house all the methods for everything... You should be able to act on that entity using that entity's own methods rather than asking another class to do that.
This is true....partly. I have a little class that wraps up some of Irrlicht myself, but very little of it. It mainly renaims some Irrlicht functions, but helps me. Most Irrlicht functions I just use manually as I need them. I DO have classes for sound and input, but that is outside of Irrlicht.

The reason I say this is only partly true is that in a higher scale game, you probably have created classes for "enemies" and such, and within said classes have the scene nodes. The classes upon update will update their scene nodes themselves, so your main loop will only call the update functions of the "enemy" class, but in the end, the Irrlicht Scene Nodes still get updated. So this quote above is mostly true. The problem with games programming is that it is too complicated to try to put everything into one object/class. It is much easier to design and test if things are kept separate.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

lmao @ "MoveSphere"

What, so cubes and meshes move differently and require their own movement functions? :lol:
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
k1ll3rdr4g0n
Posts: 13
Joined: Tue May 22, 2007 5:25 am

Post by k1ll3rdr4g0n »

BlindSide wrote:lmao @ "MoveSphere"

What, so cubes and meshes move differently and require their own movement functions? :lol:
How else would you move a sphere?
KickSphere?

Meshes don't move on their 'own'. A mesh is appiled to the object (2D circle square, or in this case a sphere) and would move with the sphere.

Making it so each object has its own method such as sphere would require more work on the programmers (both me and the person using the library) end, plus it would also add more overhead to the complied program.
Plus, that also adds another possibility that their program can 'break' if they create a dymanic array of sphere objects, and forget to delete them at the end. Or reference a sphere object that doesn't exist.
With the library, it would handle all the higher order things, such as dynamic memory allocations, and all communication with Irrlicht.

You have to realize this isn't Java, C++ works on a whole different concept of classes and inheritance. In C++ there isn't a Java.lang.Object that everything descends from.

Also, there is an art form to C++, its however the end programmer would want to do it.

And please explain when you say this:
hybrid wrote:But you know that pointers and references are made just for this purpose, and using an array (or map if you like) of ISceneNode pointers you can do exactly this. But you will save hundreds of method calls because you can use the pointers directly...
This would only require one or two.
And also you are not going to be using the pointers directly anyways...
At least not in this library, because why would I add another layer of complexity to an already complex library?

I'm sorry if some people don't find this library useful, but I'm sure for every one person that doesn't, 10 people will.
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

For me it looks like you just created a new class, that has methods named similar to irrlicht's ones calling irrlicht's functions.

I don't get the point what makes this library easier than irrlicht.

And btw:
Why do you use std::string and not irrlicht's core::string ?
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
k1ll3rdr4g0n
Posts: 13
Joined: Tue May 22, 2007 5:25 am

Post by k1ll3rdr4g0n »

Sylence wrote:For me it looks like you just created a new class, that has methods named similar to irrlicht's ones calling irrlicht's functions.

I don't get the point what makes this library easier than irrlicht.

And btw:
Why do you use std::string and not irrlicht's core::string ?
For your first part, it seems like you only glanced at it. Yes the methods are similar but they will offer ease of calling them. Irrlib is designed to keep handle the actual interaction to Irrlicht. Take a look at some of the examples that are up there.

For the second part, I wanted to make everything revolving around standard classes that everyone knows about, I want to stay away from Irrlicht objects. In the future I may open the possibility to use Irrlicht strings, but thats not the goal of this.

For the people who just look at it and go "Thats useless, and I would never use that". Please don't spend one second looking at it, spend some time and dig into the code and examples.

For those that do criticize me, ask yourself, would you use something like say DirectX directly to make a game?
Would you call the windows API directly?
Would you use Irrlicht out-of-the-box to write a game?
Of course not, you would use a library of some kind to do it for you.
Wether it is designed by me or you. And/or helper functions to make things easier/more productive.
Such as the nature of C++ and OOP. You would be silly to put all your code in main (though the examples do that, they are only examples to guide you).
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

k1ll3rdr4g0n wrote: Making it so each object has its own method such as sphere would require more work on the programmers (both me and the person using the library) end, plus it would also add more overhead to the complied program.
Plus, that also adds another possibility that their program can 'break' if they create a dymanic array of sphere objects, and forget to delete them at the end. Or reference a sphere object that doesn't exist.
Isnt that EXACTLY what you are doing? :P
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
k1ll3rdr4g0n
Posts: 13
Joined: Tue May 22, 2007 5:25 am

Post by k1ll3rdr4g0n »

BlindSide wrote:
k1ll3rdr4g0n wrote: Making it so each object has its own method such as sphere would require more work on the programmers (both me and the person using the library) end, plus it would also add more overhead to the complied program.
Plus, that also adds another possibility that their program can 'break' if they create a dymanic array of sphere objects, and forget to delete them at the end. Or reference a sphere object that doesn't exist.
Isnt that EXACTLY what you are doing? :P
Isn't that what iostream does for C++?
Wrap everything nicely for you, that is written by someone else?

Isn't that what Java.lang does?
Wrap basic objects for you, that is written by someone else?

Isn't that what GTK does?
Wrap GUI objects for you use, that is written by someone else?

Hows about RadCPP?
That wraps windows API into a nice library.

Hows about NTL?
Thats a pretty good big number library for C++.

(The list goes on)

Look, this immaturity has to stop. If you don't have anything constructive to say, don't say it. You are just showing how unintelligent you really are. If you want to show off how unintelligent you are, hey I am not stopping you but you have been warned.
Some words are better left unsaid.
"This sucks, I wont ever use it"
Or
BlindSide wrote:lmao @ "MoveSphere"
See how it makes you look?
"This sucks, however
If you implment x
Change y
Get rid of Z"
Notice how much more intelligent that sounds?
Or
"This sucks because
1. Reason
2. Reason
3. Reason
however you can make this usable by changing:
1. Thing to change
2. Thing to change
3. Thing to change"
That sounds very intelligent and you sounds like you know what you are talking about. This builds ethos, or creditability.

Off topic:
Lets explain ethos for a second:
Imagine 2 commercials for a drug:
1 pictures a doctor talking about a medicine.
He has a lot of ethos, because he is a doctor and is supposed to know what hes talking about.
The second has some homeless guy with ripped clothes saying "this drug is really good, you should buy it"
He has very little ethos due to the social status and ripped clothing.

Anyone that posted to this thread I guarantee they don't have a doctorate or is teaching at a university full time. Thus, you have no ethos to say "this sucks". You know how I know this? Is because no one identified themselves as such. And even then, someone of that status would not talk in the maturity level that you guys are.


If I didn't know any better, I swear I was talking to a bunch of high school students.
Cut the crap. This is the real world. This isn't who can we pick on today at lunch, this is how can I contribute to the world.

And isn't Irrlicht just wrapping DirectX and OpenGL calls?
This wraps Irrlicht calls.

Summary: If you post a comment, post some reason to back it up.
Not posting reasons is childish and immature. And any respectable employer/teacher would fire you or fail you.

Read some scholarly journals sometime, they back up their opinions and reasons, why can't you?
Also, a good argument involves going back and forth, like a Q&A. You state a point, I state a counter point, then you state a counter point to my counter point (basically pointing out a flaw, in my computer point). Not you state a point, I state a counter point, then you state the same point over again. That will not win an argument, that just shows how immature you are if you can't even argue correctly.
Wrong -
"Person1: Black M&Ms are the best.
Person2: all M&Ms are made with virtually the same ingredients
Person1: But the black M&Ms are the best."
Correct example -
Person1: Black M&Ms are the best.
Person2: all M&Ms are made with virtually the same ingredients
Person3: But black M&Ms are made with a different food coloring
[Note: Not the best argument, but its just an example to show my point]

I have requested for this thread to get deleted.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I think you still don't get the basic problem. It's not the idea of creating a wrapper. That's a good idea, basically many game engines that build upon Irrlicht will do so. the problem with your proposed solution is also NOT that you do invent new classes or methods. But it's a problem of how you create the API. You mix things, you impose dependencies where they are not necessary, you loose adaptivity and extensibility. It's just a matter of design, and design is not easy.
So if you find this useful and usable, then fine for you, but don't insist that everyone will think so. In case you have some time left and also some fun with programming you should refactor things of your design. Maybe read some books on OO Design first, and have a look at some other OO wrappers. Make your design such that it simplifies things (not only by having to type some characters less, but by making usage of structures simpler and uniform). And always expect to face some people that may teach you new things.
Locked