Data Structures and Sorting Algorithms

Anything related in any way to game development as a whole is welcome here. Tell us about your game, grace us with your project, show us your new YouTube video, etc.

Moderator: PC Supremacists

Post Reply
User avatar
Khearts
ES Beta Backer
ES Beta Backer
Posts: 50
Joined: Sun Oct 10, 2010 5:07 pm
Current Project: Super Mario Bros Clone and 3D Engine
Favorite Gaming Platforms: Dreamcast
Programming Language of Choice: C/++

Data Structures and Sorting Algorithms

Post by Khearts »

Usually when I work on my development, usually I stick to the basic STL things like vectors and hash maps. Do programmers here tend to use other structures like LinkedLists, Queues, or other structures to hold data or algorithms to sort stuff?
User avatar
short
ES Beta Backer
ES Beta Backer
Posts: 548
Joined: Thu Apr 30, 2009 2:22 am
Current Project: c++, c
Favorite Gaming Platforms: SNES, PS2, SNES, SNES, PC NES
Programming Language of Choice: c, c++
Location: Oregon, US

Re: Data Structures and Sorting Algorithms

Post by short »

You can get away with vectors for now, but really I use all of them now. Since you have a lot of the different structures available from the STL or boost once you figure out what type of operations you perform most frequently on your data structure (lookup, insertion in the beginning/middle/end) look up what data structure best suits your needs. It's really about how fast the operations you perform are what should determine what data structure to use. Some data structures are smaller then others if memory use is a concern. Just jump on Wikipedia it will tell you the complexity of all the operations for each data structure
My github repository contains the project I am currently working on,
link: https://github.com/bjadamson
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: Data Structures and Sorting Algorithms

Post by Falco Girgis »

It really all depends. STL used to be a gigantic taboo for game development with the previous Dreamcast/PS2/Gamecube/Xbox generation, due to limited resources. With modern console/PC development and things like XNA, you're seeing more and more developers use STL.

For embedded devices like phones or microprocessors with applications that demand performance, you really won't see too much STL, though.
User avatar
bnpph
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 75
Joined: Thu Mar 10, 2011 12:30 pm

Re: Data Structures and Sorting Algorithms

Post by bnpph »

Usually when I work on my development, usually I stick to the basic STL things like vectors and hash maps. Do programmers here tend to use other structures like LinkedLists, Queues
Every data structure has a purpose, and I have used all of them. My favorite is the stack, but unfortunately STD has a shitty version of it :(
algorithms to sort stuff?
I usually write my own if I know my data has certain quirks that can be optimized.
It really all depends. STL used to be a gigantic taboo for game development with the previous Dreamcast/PS2/Gamecube/Xbox generation, due to limited resources. With modern console/PC development and things like XNA, you're seeing more and more developers use STL.

For embedded devices like phones or microprocessors with applications that demand performance, you really won't see too much STL, though.
This. If you are writing anything that won't need to have extreme performance, then please use the STD!

There is also EASTL made by EA, which is designed for their games: http://www.open-std.org/jtc1/sc22/wg21/ ... n2271.html
I have never used it.

Been working on my own library which is being designed to be a replacement for STD for video games. It should run extremely fast if you use it right.
Post Reply