Should STL be used in game programming

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: Should STL be used in game programming

Post by MarauderIIC »

Rolling your own, by the way, decreases that overhead. Even if you use templates, too.

I think.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
Netwatcher
Chaos Rift Junior
Chaos Rift Junior
Posts: 378
Joined: Sun Jun 07, 2009 2:49 am
Current Project: The Awesome Game (Actual title)
Favorite Gaming Platforms: Cabbage, Ground beef
Programming Language of Choice: C++
Location: Rehovot, Israel

Re: Should STL be used in game programming

Post by Netwatcher »

Interesting, if ur going to "roll your own" I really want to see this.

To Marauder:
Stop saying "I think", it makes your claim uncertain.
If u haven't thought about that you wouldn't have written it!
and if you're wrong someone will correct you anyway.
"Programmers are the Gods of their tiny worlds. They create something out of nothing. In their command-line universe, they say when it’s sunny and when it rains. And the tiny universe complies."
-Derek Powazek, http://powazek.com/posts/1655

blip.fm DJ profile - http://blip.fm/Noobay
current code project http://sourceforge.net/projects/vulcanengine/
User avatar
programmerinprogress
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 632
Joined: Wed Oct 29, 2008 7:31 am
Current Project: some crazy stuff, i'll tell soon :-)
Favorite Gaming Platforms: PC
Programming Language of Choice: C++!
Location: The UK
Contact:

Re: Should STL be used in game programming

Post by programmerinprogress »

Netwatcher wrote:Interesting, if ur going to "roll your own" I really want to see this.
To Marauder:
Stop saying "I think", it makes your claim uncertain.
.
He's not sure, but he's pretty certain from his experience, so he's saying "I think" because he's trying not to be a know-it-all who might have his facts wrong, so cut the man some slack ;)

As for "rolling your own", logically you could make your own templates with a much lower overhead, as you would only implement the methods which you know you're going to use, therefore the size of the template, and it's footprint would decrease (but this of course depends on the number of methods, and how they're implemented of course, you could end up adding MORE, if you could think of any!)

also, making your own container templates isn't exactly "out there", it can be done, you just need to get your head around dynamic memory and data structures, i'm not saying I could implement one right now, but it's plausible with a little bit of research...

I think :lol:
---------------------------------------------------------------------------------------
I think I can program pretty well, it's my compiler that needs convincing!
---------------------------------------------------------------------------------------
And now a joke to lighten to mood :D

I wander what programming language anakin skywalker used to program C3-PO's AI back on tatooine? my guess is Jawa :P
User avatar
Netwatcher
Chaos Rift Junior
Chaos Rift Junior
Posts: 378
Joined: Sun Jun 07, 2009 2:49 am
Current Project: The Awesome Game (Actual title)
Favorite Gaming Platforms: Cabbage, Ground beef
Programming Language of Choice: C++
Location: Rehovot, Israel

Re: Should STL be used in game programming

Post by Netwatcher »

programmerinprogress wrote:
Netwatcher wrote:Interesting, if ur going to "roll your own" I really want to see this.
To Marauder:
Stop saying "I think", it makes your claim uncertain.
.
He's not sure, but he's pretty certain from his experience, so he's saying "I think" because he's trying not to be a know-it-all who might have his facts wrong, so cut the man some slack ;)

As for "rolling your own", logically you could make your own templates with a much lower overhead, as you would only implement the methods which you know you're going to use, therefore the size of the template, and it's footprint would decrease (but this of course depends on the number of methods, and how they're implemented of course, you could end up adding MORE, if you could think of any!)

also, making your own container templates isn't exactly "out there", it can be done, you just need to get your head around dynamic memory and data structures, i'm not saying I could implement one right now, but it's plausible with a little bit of research...

I think :lol:
I agree,it's going to increase deving time by a hell lot :nono:.

Edit: The following line was Deleted by the author due to temporal stupidity :roll:...
Last edited by Netwatcher on Mon Jun 22, 2009 10:56 pm, edited 4 times in total.
"Programmers are the Gods of their tiny worlds. They create something out of nothing. In their command-line universe, they say when it’s sunny and when it rains. And the tiny universe complies."
-Derek Powazek, http://powazek.com/posts/1655

blip.fm DJ profile - http://blip.fm/Noobay
current code project http://sourceforge.net/projects/vulcanengine/
User avatar
Innerscope
Chaos Rift Junior
Chaos Rift Junior
Posts: 200
Joined: Mon May 04, 2009 5:15 pm
Current Project: Gridbug
Favorite Gaming Platforms: NES, SNES
Programming Language of Choice: Obj-C, C++
Location: Emeryville, CA
Contact:

Re: Should STL be used in game programming

Post by Innerscope »

I agree,it's going to increase deving time by a hell lot :nono:.
You should be writing you're own templates though, it's a lot better than writing multiple classes that use the same implementation or including STL. So I wouldn't consider it a bad thing.
Current Project: Gridbug
Website (under construction) : http://www.timcool.me
User avatar
Netwatcher
Chaos Rift Junior
Chaos Rift Junior
Posts: 378
Joined: Sun Jun 07, 2009 2:49 am
Current Project: The Awesome Game (Actual title)
Favorite Gaming Platforms: Cabbage, Ground beef
Programming Language of Choice: C++
Location: Rehovot, Israel

Re: Should STL be used in game programming

Post by Netwatcher »

Innerscope wrote:
I agree,it's going to increase deving time by a hell lot :nono:.
You should be writing you're own templates though, it's a lot better than writing multiple classes that use the same implementation or including STL. So I wouldn't consider it a bad thing.
I actually (and I bet everyone does) like writing my own stuff.
I also have no idea how to write templates(that and AI).
So I write one huge class instead of a little template.
there's much for me to learn, grasshopper.
"Programmers are the Gods of their tiny worlds. They create something out of nothing. In their command-line universe, they say when it’s sunny and when it rains. And the tiny universe complies."
-Derek Powazek, http://powazek.com/posts/1655

blip.fm DJ profile - http://blip.fm/Noobay
current code project http://sourceforge.net/projects/vulcanengine/
User avatar
Ginto8
ES Beta Backer
ES Beta Backer
Posts: 1064
Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java

Re: Should STL be used in game programming

Post by Ginto8 »

Netwatcher wrote:I also have no idea how to write templates.

Code: Select all

template <typename T>
class myTemplate {
    T myTemplateVar;
public:
template<typename T2>
    T2 myTemplateFunctionInsideTemplateClass(T param); // lol long function name
    T myNormalFunctionInsideTemplateClass(); // lol another long function name
};

T2 myTemplateFunctionInsideTemplateClass(T param)
{
    return (T2)param;
}

T myNormalFunctionInsideTemplateClass()
{
    return myTemplateVar;
}
remember to define the functions of the class inside the same header as the class declaration. This is because template classes aren't compiled until an instance of them is used. Don't worry, your compiler should be smart enough to combine/compress template definitions of the same typename and definitions together (a template class Moose and a template class Cow wouldn't get combined).
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
User avatar
MarauderIIC
Respected Programmer
Respected Programmer
Posts: 3406
Joined: Sat Jul 10, 2004 3:05 pm
Location: Maryland, USA

Re: Should STL be used in game programming

Post by MarauderIIC »

programmerinprogress wrote:
Netwatcher wrote:To Marauder:
Stop saying "I think", it makes your claim uncertain.
He's not sure, but he's pretty certain from his experience, so he's saying "I think" because he's trying not to be a know-it-all who might have his facts wrong, so cut the man some slack ;)
Correct.
Netwatcher wrote:nobody will kill u if ur wrong
Saying "I think" changes the tone of the response, and also invites others to correct me or back me up. It also keeps me from looking like an idiot. Further, not saying "I think" or equivalent when I am unsure opens the possibility of presenting incorrect facts that inexperienced users -- who don't know that what I've stated is wrong -- will take at face value without verification, producing bad habits and decreasing their value to later employers.
Netwatcher wrote:I also think that Marauder is just experienced enough, and even when u say something ur not sure about you need to say it at the tops of your lungs, :roll:...
Thanks for the vote of confidence :)

Rolling my own template classes is not something I've needed to do on a large scale, yet, hence, I was unsure.
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.
User avatar
zodiac976
Chaos Rift Regular
Chaos Rift Regular
Posts: 156
Joined: Thu Jun 18, 2009 10:03 am
Current Project: Booklet & Text RPG
Favorite Gaming Platforms: PC, PS3, PSP
Programming Language of Choice: C++
Location: AL
Contact:

Re: Should STL be used in game programming

Post by zodiac976 »

Netwatcher wrote:
Innerscope wrote:
I agree,it's going to increase deving time by a hell lot :nono:.
You should be writing you're own templates though, it's a lot better than writing multiple classes that use the same implementation or including STL. So I wouldn't consider it a bad thing.
I actually (and I bet everyone does) like writing my own stuff.
I also have no idea how to write templates(that and AI).
So I write one huge class instead of a little template.
there's much for me to learn, grasshopper.
I am still learning templates and I have yet to use them but I do
hope I start finding a use for them soon. I usually split my stuff
into multiple classes and use inheritance and friends if needed.
User avatar
Netwatcher
Chaos Rift Junior
Chaos Rift Junior
Posts: 378
Joined: Sun Jun 07, 2009 2:49 am
Current Project: The Awesome Game (Actual title)
Favorite Gaming Platforms: Cabbage, Ground beef
Programming Language of Choice: C++
Location: Rehovot, Israel

Re: Should STL be used in game programming

Post by Netwatcher »

zodiac976 wrote:
Netwatcher wrote:
Innerscope wrote:
I agree,it's going to increase deving time by a hell lot :nono:.
You should be writing you're own templates though, it's a lot better than writing multiple classes that use the same implementation or including STL. So I wouldn't consider it a bad thing.
I actually (and I bet everyone does) like writing my own stuff.
I also have no idea how to write templates(that and AI).
So I write one huge class instead of a little template.
there's much for me to learn, grasshopper.
I am still learning templates and I have yet to use them but I do
hope I start finding a use for them soon. I usually split my stuff
into multiple classes and use inheritance and friends if needed.
What about creating a struct in an existing class instead of writing a new class(when possible).
"Programmers are the Gods of their tiny worlds. They create something out of nothing. In their command-line universe, they say when it’s sunny and when it rains. And the tiny universe complies."
-Derek Powazek, http://powazek.com/posts/1655

blip.fm DJ profile - http://blip.fm/Noobay
current code project http://sourceforge.net/projects/vulcanengine/
User avatar
zodiac976
Chaos Rift Regular
Chaos Rift Regular
Posts: 156
Joined: Thu Jun 18, 2009 10:03 am
Current Project: Booklet & Text RPG
Favorite Gaming Platforms: PC, PS3, PSP
Programming Language of Choice: C++
Location: AL
Contact:

Re: Should STL be used in game programming

Post by zodiac976 »

Netwatcher wrote:
zodiac976 wrote:
Netwatcher wrote:
Innerscope wrote:
I agree,it's going to increase deving time by a hell lot :nono:.
You should be writing you're own templates though, it's a lot better than writing multiple classes that use the same implementation or including STL. So I wouldn't consider it a bad thing.
I actually (and I bet everyone does) like writing my own stuff.
I also have no idea how to write templates(that and AI).
So I write one huge class instead of a little template.
there's much for me to learn, grasshopper.
I am still learning templates and I have yet to use them but I do
hope I start finding a use for them soon. I usually split my stuff
into multiple classes and use inheritance and friends if needed.
What about creating a struct in an existing class instead of writing a new class(when possible).
Ever since I learned classes I don't see a use for structures but
you never know I may end up eating my words :lol:.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Should STL be used in game programming

Post by Falco Girgis »

Netwatcher wrote:I also think that Marauder is just experienced enough, and even when u say something ur not sure about you need to say it at the tops of your lungs, nobody will kill u if ur wrong :roll:...
I don't think you're ever experienced enough to say something (that you don't know for sure) as fact. That's called being an arrogant douche bag.
User avatar
Netwatcher
Chaos Rift Junior
Chaos Rift Junior
Posts: 378
Joined: Sun Jun 07, 2009 2:49 am
Current Project: The Awesome Game (Actual title)
Favorite Gaming Platforms: Cabbage, Ground beef
Programming Language of Choice: C++
Location: Rehovot, Israel

Re: Should STL be used in game programming

Post by Netwatcher »

You are partially right.
There's a difference between a personal opinion (i.e. "We're making the best indie game ever") and a professional opinion.
Last edited by Netwatcher on Mon Jun 22, 2009 11:22 pm, edited 3 times in total.
"Programmers are the Gods of their tiny worlds. They create something out of nothing. In their command-line universe, they say when it’s sunny and when it rains. And the tiny universe complies."
-Derek Powazek, http://powazek.com/posts/1655

blip.fm DJ profile - http://blip.fm/Noobay
current code project http://sourceforge.net/projects/vulcanengine/
User avatar
rolland
Chaos Rift Regular
Chaos Rift Regular
Posts: 127
Joined: Fri Dec 21, 2007 2:27 pm
Current Project: Starting an Android app soon
Favorite Gaming Platforms: PS1, N64
Programming Language of Choice: C++
Location: Michigan, US

Re: Should STL be used in game programming

Post by rolland »

GyroVorbis wrote:That's called being an arrogant douche bag.
Elegantly put. :)
I'll write a signature once I get some creativity and inspiration...
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Should STL be used in game programming

Post by Falco Girgis »

Netwatcher wrote:You are partially right.
There's a difference between a personal opinion (i.e. "We're making the best indie game ever") and a professional opinion.
So what is consistent with the two? Opinion. Neither is confirmed fact, and neither should be advertised or treated as such.
Post Reply