Original Post
🔒 Locked
programming questions
Advertisement
1. how are arrays used in games ??
Arrays are used to store a linear quantity of data. For example, if you had an array of monsters - you could easily cycle through and draw each one of them using the array rather than having to make X different variables.
2. how do you write a file saving and loading system ??
This all depends on how your game is setup. If you wanted to do this, your game would have to be data driven to support a model such as this. Basically you will save the state of the game to a file and then reload it. Depending on how you make your game and what it uses (3D models,etc), will determine how you make your save file.
3. how are veriable used in games ??
They are used to represent any thing that can vary in data. Instead of always making the game run in 640x480x32 mode, you can use a width,height, and bpp variable to store the desired display. Ultimately, variables are the base of a data driven design.
4. what does ++ do??
++ is an increment operator that applies to numbers; If you had X++, and X was 5, it would not be 6. There is a difference between X++ and ++X if you are using this operator in a compound statement. Ie:
int X = 5;
if (++X == 5)
...
would result in false, but
int X = 5;
if (X++ == 5)
...
would result in true. If you just have
int X = 5;
X++;
it is the same as:
int X = 5;
++X;
- Drew
Arrays are used to store a linear quantity of data. For example, if you had an array of monsters - you could easily cycle through and draw each one of them using the array rather than having to make X different variables.
2. how do you write a file saving and loading system ??
This all depends on how your game is setup. If you wanted to do this, your game would have to be data driven to support a model such as this. Basically you will save the state of the game to a file and then reload it. Depending on how you make your game and what it uses (3D models,etc), will determine how you make your save file.
3. how are veriable used in games ??
They are used to represent any thing that can vary in data. Instead of always making the game run in 640x480x32 mode, you can use a width,height, and bpp variable to store the desired display. Ultimately, variables are the base of a data driven design.
4. what does ++ do??
++ is an increment operator that applies to numbers; If you had X++, and X was 5, it would not be 6. There is a difference between X++ and ++X if you are using this operator in a compound statement. Ie:
int X = 5;
if (++X == 5)
...
would result in false, but
int X = 5;
if (X++ == 5)
...
would result in true. If you just have
int X = 5;
X++;
it is the same as:
int X = 5;
++X;
- Drew
1. Arrays allow the programmer to allocate multiple objects in a row in memory. For instance you could have 10 names, being name[0] through name[9], all in one call, and its easy to parse as you can pass an index to them. This is an easy concept to understand, tough one for me to explain for some reason
2. This is complicated, as there is more then 1 way of doing it. Pretty much this comes down to API and language specifics though. generaly in C/C++ you could use fopen fclose, etc. or streams.
3. The same way they are in math. To represent a value, usualy a dynamic one at that.
4. ++ is the increment operator. It increments a number to the next logical step. such as 1 becomes 2, and 2 becomes 3, and so-on.
2. This is complicated, as there is more then 1 way of doing it. Pretty much this comes down to API and language specifics though. generaly in C/C++ you could use fopen fclose, etc. or streams.
3. The same way they are in math. To represent a value, usualy a dynamic one at that.
4. ++ is the increment operator. It increments a number to the next logical step. such as 1 becomes 2, and 2 becomes 3, and so-on.
Quote:
Original post by cellman
I have a few questions on how somethings are used in a game development
1. how are arrays used in games ??
2. how do you write a file saving and loading system ??
3. how are veriable used in games ??
4. what does ++ do??
1. Arrays are used in various ways. Sometimes they're used to store map data, graphics, and even for inventory systems.
2. Exactly how you code it depends on the language you're using, but the concept is the same. You basicly dump your variables to a file, such as the ones that store character stats, level information, item data etc. In other words all the data necessary to allow the player to pick were they left off.
3. There used in too many ways to list.
4. ++ is the increment operator. It will increment a variable by one. Inversely, -- is the decrement operator and it will subtract one from a variable.
++ is equivlent to a = a + 1 and a += 1 "a" being a variable.
-- is equivlent to a = a - 1 and a -= 1 again "a" being a variable.
pointers are necessary in most design patterns, as they are used in complex memory management. essentialy, yes they are needed, but may not be explictly called to in loading files if you are using a few hacks. If you are going to use any sort of dynamic memory management in standard C calls, you need to actualy understand pointers. Dynamicaly allocating memory for loading a file for instance.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement