Are arrays worth?

Mar 28, 2014 at 9:57pm
I´m learning the basics of C++ and I reached Arrays Chapter, arrays are truly boring so I wanted to know if arays are needed in game design and what is really needed in game design.

Mar 28, 2014 at 10:02pm
You should start with arrays before working with other containers. Also, yes they are important in game design or else how would you store some of the information. Say for example the character has a name, the name would be an array(string) of characters. Same with storing other information like the current map, current inventory, ect..
Mar 28, 2014 at 10:05pm
No arrays are not needed, but prepare to write repetitious code yourself and a lot of it. For example try to write a program that adds the average of a series of numbers to each number then prints back the series.

Actually this can be solved with recurrsion, but imagine if recurrsion was not allowed
Mar 31, 2014 at 10:24pm
aaa ok Know i understand but anyway there are lot of arrays and some of them seem worthless
Mar 31, 2014 at 11:14pm
Arrays and containers based upon them are used in games extensively. I'd say it's not just important, but crucial, to learn them.
Mar 31, 2014 at 11:27pm
Hello. Everything you learn in C++ tutorials will be important for game development. Literally. Everything. Yes. Remember this small table with operator precedence? It's important too.

In programming there aren't really many shortcuts. Most of the time, you need to have as much knowledge as you can, because you never know what you may need.
When it comes to language, you need to know it to make games in it. And tutorials really do cover basics of C++. If you skip anything, you'll have to come back to it in future. Learning now will save you a lot of headache later.

Good luck, Cheers!

PS. Arrays are crucial in game programming. And programmer who doesn't know what an array is, isn't a programmer.
Apr 1, 2014 at 4:49am
here are lot of arrays and some of them seem worthless

http://homepages.e3.net.nz/~djm/cppcontainers.html
Apr 1, 2014 at 11:14am
As others have said, arrays are horribly important (couldn't find another word lol) in game development. Even if you write a command line interface game, you'd still (70 - 80%) need arrays. For example if you are writing a Tic-Tac-Toe game, you'd need arrays for the board.

As you'll see here: https://bitbucket.org/StormboyXZ/journey-to-mars/src/e0eb91cb3129b13fa19989970e407ba9c2cd2a81/main.cpp?at=default (one of my old 2D game that I've written) on line 80 that there is an array declared which stores the enemies. Arrays are used in this case because a fixed number of enemy objects had to be stored. You'd use other containers like Vectors (kinda similar to arrays) to store an unfixed number of things.

(You should in no way take pointers from that code lol, it was my first 2D game and I've written it in an unorganised way.)

Some of the things you'll need in game design:
-> Arrays/Some other container
-> Loops
-> Random number generation
-> Functions
-> If/Else/Switch statements

So yeah, my point is that they look boring now, but you'll find yourself using arrays a lot more than you expect once you start doing some small projects or solving some problems. Therefore, don't skip it (TBH, don't skip anything).

Good luck! :)

EDIT: Punctuation marks xD
Last edited on Apr 1, 2014 at 11:26am
Topic archived. No new replies allowed.