Advertisement

Building a general programming library

Started by June 04, 2000 05:50 PM
3 comments, last by OreoBoy03 24 years, 7 months ago
Ok...Here''s the deal...I''ve screwed around with programming enough. I need to get down to business. What concepts should I implement in my library? I''m thinking of things along the lines of sorts, binary trees, linked lists, etc. Any advice would be greatly appriciated! Don''t forget, this is a GENERAL programming library I''m going to build for myself, and should not be limited to gaming concepts.
It is a good thing to implement your own linked list, hash table or binary tree the first time. If you are using c++ you should tak ea look into the stl (standard template library) which is a standard library (ansi/iso c++ standardized) for c++ and contains different containers (stacks, fifos, linked lists, maps, sets, and so on...), algorithms (searching, sorting, accumulating, ...) and so on. Everybody in the c++ programming boat will favour this standard ybout a new homebrew lib (and it would be very hard to write a general lib which could compete with the stl (ease-of-use-wise and speed-wise).

So don''t reinvent the wheel. Learn stl and write your specialized algos and containers for it (people will like to use your tree-containers :-)!

However if you aren''t using c++ I don''t know about comparable standard libraries.

Bjoern
Advertisement
Have you written a game before? If so, how many? I''ve found that when I sat down to write a generic C++ game engine, that I really had no idea what functions I really needed. I decided to take a break, and read up somemore on game engines and the entire game design process, and decided that (also read that) starting from one game, written with reusability in mind, would be a crucial starting point to the building block approach to a game engine. To clear it up a bit, you write one game, write the code for the menu''s to be data file driven as opposed hard coding menus. Just remember that you can''t write a game engine too generic. You can''t write an engine that is good at being a basis for 2D strategy game and expect it to accel at being something to write a FPS from. Well, for the most part anyways, you''d probably have to rewrite the graphics libs to support 3D, rewrite the AI to not be resource oriented with fixed assets, stuff like that...
Yeah, decide what you need first, then write the library. If you are writing the library to be usefull, don''t just write a bunch of general purpose functions, half of which you will never use. If you are writing a library to learn, write as many functions as you can (make sure they all work ).

-Andreas
-Andreas
Hiya,

I totally agree that you should learn the STL, but I think you should also build your own linked list just so you know how...not to mention a good many other things. This would help you to understand how things work a bit better. If you already understand all this stuff...well, then ignore me

To find lists of ideas you may wanna check out already built LIBS and see what they say they offer. Most of them show a list of the functions which should give you the idea.

Check out these for some basic ideas:

www.fastgraph.com
www.allegro.cc/
www.cdx.sk/
cg.cs.tu-berlin.de/~ki/engines.html

Hope this helps!

-Krylar

This topic is closed to new replies.

Advertisement