Page 1 of 2

Using Libraries

Posted: Mon Sep 10, 2012 1:48 am
by Raylin
Just a random thought here.

Does anyone here dislike using libraries or code that they didn't write themselves in their games?
I always feel that when I do this, I rely too much on said library and if something happens, the entire game could be all for naught.
What do you guys think?

Re: Using Libraries

Posted: Mon Sep 10, 2012 1:57 am
by dreadkillz
This is an age old question in programming. There have been earlier discussions about this:

viewtopic.php?f=4&t=8608&p=53181#p53181
viewtopic.php?f=3&t=9826&p=60279&hilit= ... ies#p60279
http://c2.com/cgi/wiki?NotInventedHere

I personally enjoy using libraries as long as they have good documentations and examples, especially for more more complex tasks such ask tile handling, collision, animations etc. Sometimes, I like to read its internal working and see if I can improve upon it rather than building the same thing from scratch (unless its really poor code, I'll try to make my own version).

If it hasn't been done yet, you could also be the nice guy and share your work so other people can improve upon it. But really, if you have a lot of free time, go right ahead and try to do things on your own.

Re: Using Libraries

Posted: Mon Sep 10, 2012 2:11 am
by slime
Raylin wrote:Just a random thought here.

Does anyone here dislike using libraries or code that they didn't write themselves in their games?
I always feel that when I do this, I rely too much on said library and if something happens, the entire game could be all for naught.
What do you guys think?
Why are you using this, then? https://bitbucket.org/rude/love/src/a66afb2d4fd0/src

:P

Re: Using Libraries

Posted: Mon Sep 10, 2012 2:29 am
by coffee

Re: Using Libraries

Posted: Mon Sep 10, 2012 1:59 pm
by Robin
Not finishing a project because of a library you used does not happen very often. Not finishing a project because you try to do too much yourself is, however.

Re: Using Libraries

Posted: Mon Sep 10, 2012 2:41 pm
by mickeyjm
Peronally I always make my own libraries wherever possible because otherwise I feel the game isnt really entirely mine

Re: Using Libraries

Posted: Mon Sep 10, 2012 5:27 pm
by SFX
I can understand the desire to write and use your own stuff. However, the more time I spend writing libraries, the less time I spend making games. This is part of the reason I'm using LÖVE instead of C++ with SFML.

Re: Using Libraries

Posted: Mon Sep 10, 2012 7:01 pm
by Larsii30
Personally I only use some basic libs like AnAL and some of the HUMP libs (Class, Gamestate).
Most of the other libs didn't handle things like I would like to use them so I write "simple" libs like gui / collision / fade / text libs on my own.

Re: Using Libraries

Posted: Mon Sep 10, 2012 8:00 pm
by Inny
Given the nature of Lua where the entire global state is your responsibility, more or less, I feel like some of the more traditional library design styles, i.e., the multiple file and multiple directory module, are too imposing. Most of the Lua community seems geared more towards a one-useful-function or one-useful-file style. It's no surprise that module function was deprecated and the Return Local Module style is starting to become very common. But that's not to say that some of the larger Libraries are shunned because they have too many files. Penlight certainly sees a lot of traction.

If I had to make a recommendation, and see it take on a large community role, I would say that Library makers should design their libs to be ripped apart function by function and used as the app and game programmers see fit. Fortunately, most code written in Lua is zlib or mit licensed, so we can in fact do this kind of thing. Just, well, expect it. Kikito's middleclass follows this mentality. Though if I had to make one change, it should probably be upgraded to the return local module style, rather than changing anything in _G.

Re: Using Libraries

Posted: Mon Sep 10, 2012 8:03 pm
by kikito
Inny wrote:Though if I had to make one change, it should probably be upgraded to the return local module style, rather than changing anything in _G.
Funny that you mention that. It's totally on my TODO list for middleclass v3.0 (which I plan to release at some point this year).