A related set of properties (height, colour, level) and methods (pick up item, jump, attack) that are used to describe an entity in the game.

learn more… | top users | synonyms

53
votes
9answers
4k views

How to avoid circular dependencies between Player and World?

I'm working on a 2D game where you can move up, down, left and right. I have essentially two game logic objects: Player: Has a position relative to the world World: Draws the map and the player So ...
18
votes
2answers
1k views

How to structure code for many unique weapons/spells/powers

I'm an inexperienced programmer creating a "roguelike-like" game in the vein of FTL, using Python (no PyGame as of yet as I'm still only concerned with text). My game will contain a large number of ...
15
votes
6answers
2k views

How object-oriented are videogames?

I've always wondered to what extent object orientation is used by videogames, especially huge 3D projects. I reckon it would be cool that both troll and werewolf inherited its attributes from enemy ...
13
votes
5answers
2k views

An object twice as close appears twice as big?

So I was thinking about creating a 2D game where you can also move along the Z-axis, by changing in which layer you are. Depending on the depth I want to scale my 2D sprites. Once, someone had shown ...
11
votes
1answer
1k views

How to gain accurate results with Painter's algorithm?

A while ago I asked how to determine when a face is overlapping another. The advice was to use a Z-buffer. However, I cannot use a Z-buffer in my current project and hence I would like to use the ...
6
votes
2answers
2k views

How can I handle inventory in an object-oriented way?

I'm trying to think of the best way to handle player inventory following an object oriented approach. For example, sword and axe are two different classes, both inheriting from weapon. Weapon and ...
6
votes
4answers
4k views

Object-Oriented OpenGL

I have been using OpenGL for a while and have read a large number of tutorials. Aside from the fact that a lot of them still use the fixed pipeline, they usually throw all the initialisation, state ...
5
votes
3answers
989 views

Object-oriented Snake game design

I'm going to make a snake remake with SDL library and right now I'm thinking heavily about the object-oriented design. I can imagine that I will have classes like GameEngine, Snake, Board and Food, ...
5
votes
1answer
179 views

Should Different “Types” of Animations be in the Same Class?

For example, say you want a character animation and a health bar animation. Since these require different algorithms, should they be in the same class? They both re-use some of the same code but ...
4
votes
4answers
5k views

What is the most efficient container to store dynamic game objects in? [closed]

I am making a first person shooter and I know about about a lot of different container types but I would like to find the container that is the most efficient for storing dynamic objects that will be ...
4
votes
3answers
643 views

Designing the main classes in a solar system simulation game in C++

If this is not the right place for this question, could you please direct me to a more suitable site/forum? I'm a beginner in game development (and in the use of this site). I've worked with C++ only ...
3
votes
4answers
3k views

Multiple Key Presses in XNA?

I'm actually trying to do something fairly simple. I cannot get multiple key presses to work in XNA. I've tried the following pieces of code. else if (keyboardState.IsKeyDown(Keys.Down) && ...
3
votes
2answers
1k views

Advice on a PHP RPG System

I am looking to make a php/mysql/javascript based rpg on a site. I am trying to figure out the best method when it comes to items, quests, etc. For instance should I make classes for each item type ...
3
votes
3answers
1k views

Game Object Design

I'm having a problem with the way I designed my first simple game in C++. I have GameObject (abstract class) and ObjectA which inherits the update() and draw() methods from GameObject. My main loop ...
3
votes
2answers
372 views

How should I design my classes in a game?

I'm stuck for ideas on classes in game programming. This is probably more of an opinion based question. I'm looking for information that is proving hard to find on the internet. Say I have a class ...
3
votes
2answers
112 views

Circular Method Calls

The title may be a little wrong for what I am asking, but that was the closest I could think of. My problem is I am making a game that includes a World class and a WorldObject class. the World class ...
3
votes
1answer
190 views

How and when to choose which objects to run collision tests on?

This might be problem with plenty of good solutions, but it's all not very clear to me, so I though I could ask and probably get some good hints. I'm having trouble figuring out how to handle ...
3
votes
1answer
164 views

Mesh objects and a draw function

I'm currently working with a mesh class so I can easily create mesh objects. Now I want a draw function in my mesh class so when ever i want draw it to the screen I can just call it without any fuss. ...
2
votes
1answer
537 views

Do game programming just let all the objects in the program to interact with themselves and what about preventing infinite loop?

Does game programming use the method of 1) using time as the main controller to let objects interact with each other, so each step, let 1 object send messages to N objects, and the second object to ...
2
votes
1answer
79 views

Space between randomly generated objects

Im not sure there is a going to be a simple answer for this question but Ill ask anyway. I am programming an endless scrolling game where the player's character is constantly "falling." As they fall ...
2
votes
2answers
3k views

Creating an object in javascript with unity (unityscript)

So I have a ton of experience with JavaScript (its what I do for a living) but I am new to unity. I have built a game engine in javascript but now want to move it over to unity. I have been trying to ...
2
votes
2answers
373 views

Retrieve the original prefab from a game object

How would one proceed to retrieve the original prefab used for instantiating an object? In the editor these two functions work : Debug.Log(PrefabUtility.GetPrefabParent(gameObject)); ...
2
votes
1answer
126 views

How do I gain access to objects in order to change their properties in Unity?

I have created a GUI text object named "GUIText" in the Unity editor, and I want to change what the text says via code (I'm using C#). How do I access GUIText1 to change its string properties? I want ...
1
vote
3answers
154 views

Level and Player objects - which should contain which?

I've been working on a several simple games, and I've always come to a decision point where I have to choose whether to have the Level object as an attribute of the Player class or the Player as an ...
1
vote
2answers
692 views

Is there any option other than Component Based for game architecture?

Having read a lot recently on Component Based systems (for games), i find it hard to go back to my earlier state of mind. If static object hierarchies fail to model "objects with a dynamic set of ...
1
vote
2answers
116 views

How do I make a pointer point to the current running level if each level is its own class?

I'm hard-coding my levels and coding each level in its own class...The problem is that I need to have a pointer that points to the class of the current level. I don't know how I would go about doing ...
1
vote
3answers
159 views

Changing game object type: reinstantiating the object, or switching an object state

I work on a strategy game, where the player occasionally has to transform ordinary citizens into the so called "leaders". Leaders are temporary units, which the player can control directly, in order ...
1
vote
3answers
193 views

How should I handle the relationship between my Player and keyboard input classes?

Just a quick one really, as I can't find anything definative. Started developing in Java, to learn and take on a bit of Game Dev. Have a PHP background, and I'm a massive sucker for best practices, ...
1
vote
1answer
67 views

How can I show information from a variety of sources in my debug menu?

I'm creating a debug menu, and I want to be able to show a lot of information (variables) on that menu. This information will come from a lot of classes (instances). How can I show a lot of ...
1
vote
4answers
2k views

How to differentiate between instantiated objects in Unity?

I'm currently trying to solve a way to go about the following problem before I start writing any code (the old fashioned pen and paper way) but I'm not sure how I could achieve the following. I'm ...
1
vote
4answers
359 views

What is the best method to use to write and handle multiple levels?

I have a level class that does all of the updating and drawing and everything pertaining to the level. My question is, what would be the best approach to creating different levels? Should I just ...
1
vote
1answer
352 views

How should I share variables between instances/classes?

I'm making a game using LOVE, so everything is programmed in Lua. I've been experimenting with using classes and object orientation recently. I've found out that a nice system to use is having most of ...
1
vote
1answer
1k views

How to make one solid object in Maya?

How can I "glue" more objects to each other so I get one object? (It is for resizing models), couldn't find anything about it on the internet, but I'm dutch, so maybe that's why. Thank you very much! ...
1
vote
1answer
73 views

Multiple concurrent Tweens

I'd like to be able to direct a game object to move to a new target position over a certain amount of time. There are lots of different easing functions available, but for now let's say I'm just ...
1
vote
0answers
75 views

How do I avoid circular dependencies with game events in C++? [closed]

My question concerns three objects in my game: EnemyConfig (a derived class of Event - it's an event that concerns throwing enemies at the player and making her deal with them) and Enemy. The ...
1
vote
0answers
84 views

Collision detection code style [closed]

Not only there are two useful broad-phase algorithms and a lot of useful narrowphase algorithms, there are also multiple code styles. Arrays vs. calling Make an array of broadphase checks, then ...
0
votes
1answer
250 views

Combination of DLL/Plugins with Object/Components

I worked on a personal game project (learning) for about the last year or so off and on in Ogre3D. Now that I am starting a new project, I want to avoid the Class Heirarchy for objects and having all ...
0
votes
1answer
210 views

How to load and draw this *.obj correctly?

I have a loader class for *.obj files (called GLModel) which has 2 main methods - public GLModel(BufferedReader ref, boolean centerit, GL gl,Texture texture) which use for *.obj load , and ...
0
votes
1answer
98 views

watching for changes in object state

I'd like to know what others do to watch for changes in object states while the game is running. Say you have an object and that object has a timer. The timer completes. What is the best way to know ...
0
votes
1answer
1k views

3D Paint tool in Maya

Hey everyone, could someone help me out on this question? When I am trying to texture objects in maya (for example a barrel) I want to texture it with a brush. When I try to use the 3D painting tool ...
0
votes
1answer
745 views

cocos2d-x - object creation and management in game design

How do others keep track of everything going on in their games? I am working on a new game and I am quickly realizing everything that I need to keep track of. Example: Maybe a layerManager that ...
0
votes
1answer
732 views

In some games, we just let the main() loop be the Player object or Table object?

I was thinking that let's say if there is a game of Blackjack or MasterMind, then we should have a class called Dealer or ComputerPal, which is how the computer interact with us (as a dealer for ...
0
votes
3answers
431 views

How do I make a message based communication system between objects?

Just as I was told here, I need to make some kind of communication between objects in my game. Mainly, for achievements. How do I do this? My idea was to make every object have an array attached to ...
0
votes
1answer
328 views

Problem creating levels using inherited classes/polymorphism

I'm trying to write my level classes by having a base class that each level class inherits from...The base class uses pure virtual functions. My base class is only going to be used as a vector ...
0
votes
2answers
284 views

Question on methods in Object Oriented Programming [closed]

I’m learning Java at the minute (first language), and as a project I’m looking at developing a simple puzzle game. My question relates to the methods within a class. I have my Block type class; it ...
0
votes
1answer
173 views

Error when using GetComponent (Object reference not set to an instance of an object)

I'm using a textmesh to check variables in real time. Thing is if I use AddComponent within Update(), it obviously starts spamming and slows the game. If I try with GetComponent the error is the ...
0
votes
2answers
119 views

How do I connect my objects to my meshes?

I am creating a simple 3D engine and I've run into a problem. I have an array of objects [Camera, Player, Player, MonsterA, MonsterB, MonsterA] and a number of mesh files that I need to associate ...
0
votes
1answer
74 views

Object generation from an existing object in a game engine

To simplify, let's say in en engine I'm coding for a game, I have the Main class an Object class. In the Main class' update method, I loop through the array of all Objects in the game. I also have a ...
0
votes
1answer
102 views

Why does this LUA code not render any objects on the screen? [closed]

Did I mess up something somewhere? If i put a putsxy in the same box, it renders a string just fine, but for some reason this code hates objects. What this code is supposed to do is render a set of ...
0
votes
1answer
451 views

android basic Movement for array-objects

I was adviced to start a seperate question for this so here I go. Been stuck so long with this do if you can help, please do. Lets get to it! Im trying to set the speed for my bullets, but since Im ...