Tagged Questions

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

0
votes
1answer
41 views

System.StackOverflowException error [closed]

Hi all! I have a one problem. I trying to create 2D cave generation system in C# with XNA game studio, but then I running program I getting "System.StackOverflowException". As you can see in this ...
1
vote
3answers
76 views

Handle many objects to draw in XNA

in my 2D engine - using XNA 4.0 - I´ve an issue with handling many objects. The way my engine works is that I only draw visible sprites (base objects) and ignore those sprites out of the current ...
1
vote
1answer
57 views

Rendering order for units behind objects?

Im developing a 2D game with some fake 3D effects (parallell projection). 2D-units are able to walk in front of buildings aswell as behind them, although themselves being just 2d-objects. This leads ...
1
vote
0answers
89 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 ...
3
votes
1answer
206 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 ...
2
votes
1answer
83 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 ...
0
votes
1answer
608 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 ...
2
votes
2answers
1k 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)); ...
3
votes
2answers
381 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 ...
0
votes
2answers
126 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 ...
1
vote
1answer
81 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 ...
0
votes
1answer
117 views

When to use class/objects for graphics [closed]

I am fairly new to game development, but I have a good programming background with object oriented programming. But with games, I do not know when I should use an object (or class) for an entity on ...
0
votes
1answer
652 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 ...
-1
votes
1answer
294 views

Detailed Modern Opengl Tutorial? [duplicate]

I am asking for a specific modern opengl tutorial. I need a tutorial that does not skip to explain any lines of code. It should also include different independent objects moving/rotating (most ...
3
votes
2answers
118 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 ...
1
vote
3answers
220 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, ...
0
votes
1answer
102 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 ...
1
vote
1answer
70 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 ...
3
votes
1answer
191 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. ...
0
votes
1answer
79 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
902 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
104 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 ...
-1
votes
1answer
229 views

Refering to an object from an array in Java [closed]

In my game, the whole thing is based off of grids. So the map is a dual dimensional array of 32 (32 x 32 grid map). Now what I want to be able to do is to grab a grid and be able to access it and ...
14
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 ...
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 ...
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 ...
2
votes
1answer
169 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
0answers
86 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 ...
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 ...
0
votes
2answers
1k views

Foreach loop with 2d array of objects

I'm using a 2D array of objects to store data about tiles, or "blocks" in my gameworld. I initialise the array, fill it with data and then attempt to invoke the draw method of each object. foreach ...
1
vote
3answers
158 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
1answer
373 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 ...
-3
votes
1answer
154 views

How are certain objects named in OpenGL?

I am a beginner in OpenGL, and I would like to know how to distinguish specific objects in an OpenGL game. For instance, the game world contains 3 gems of different colors, how can I know which one ...
0
votes
1answer
478 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 ...
1
vote
2answers
713 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 ...
6
votes
4answers
6k 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 ...
0
votes
1answer
2k views

Interactions between game objects

I'm programming a basic Pacman clone to teach myself game programming. However, I'm struggling with the best way to have the game objects communicate/interact without my code becoming a huge mess. ...
5
votes
3answers
1k 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, ...
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 ...
1
vote
4answers
403 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 ...
3
votes
2answers
2k 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 ...
0
votes
1answer
809 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 ...
6
votes
4answers
5k 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 ...
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 ...
0
votes
2answers
157 views

Why are changes in one object applied to all objects in a list?

I've got two List: BasicModels: As Content has to be loaded at the start of the game I instanciate and load all models into this list. ModelsOnScreen: Every time when a Model is added to the screen ...
0
votes
3answers
461 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
341 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 ...
1
vote
2answers
118 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
165 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 ...
5
votes
1answer
181 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 ...