7
votes
Accepted
In an object-oriented game engine, should there be seperate classes for objects with and without parents?
what should the parent of the root Instance in the hierarchy be?
Nothing.
Does Instances without parent make sense?
If you, for example, might want a factory that ...
3
votes
Accepted
Unity2D: Vector3.Lerp - smooth movement
Before I go into the code, I want to go over how Lerp works.
Vector3.Lerp(Vector3 start,Vector3 end, float fraction);
The above code will return a Vector3 that ...
2
votes
Accepted
A logic error. canvas: balls physics, bounce
To figure out what is going on, I started looking at the code that moves the balls. In this case it is physics (fisicas). I see ...
2
votes
Tree of objects in 2D space - children relative to parent
With transform hierarchies (trees), the normal method is to work your way up or down the tree, applying any transformations of the parent to the child, at each level, till you have processed ...
2
votes
Accepted
Evenly distribution of 2 or more shapes given their x and y points inside a bounding box
If you have a set of bounding boxes and the first and last one shouldn't get moved, then you can create a line out of the center points of these two and line the ither center points up with it.
So, ...
2
votes
How to have random and different colors on multiple objects with one material?
You can change the color of the same material, on different objects, from script. Do the following:
Create a materialand assign it to the target game object.
Create a new C# script, and copy in the ...
2
votes
LIBGDX - group as child of an actor?
We don't know which things are containers and what they can contain.
But let's assume your world work this way:
Empires can contains Kingdoms, but also Cities (which are not contained by any ...
2
votes
Instantiating a GameObject at my desired position not working
So the answer was that I needed to set the localPosition after setting the parent.
I thought everything was correctly calculated at runtime (taking parental relationships into account), but ...
2
votes
Accepted
C++ create array of multiple types
When you have an array of type Entity then you can only call methods on the entries which are declared in the class Entity.
If ...
2
votes
Can a character interact well with surroundings in-game?
Yes. This is all doable.
Limitations in games most of the time come from features being too heavy for the physics engine ("we can't simulate that many bodies at once, otherwise it trashed the ...
2
votes
Accepted
Calculate coordinates of boundaries containing group of objects
This is a broad question, so a broad answer is required. You can follow up individual implementations / algorithms yourself, and post separate questions if you need to.
The basic approach for games
...
2
votes
Accepted
Painter's theorem inside and outside test
I'm not familiar with the exact situation being discussed here — it's been a while since I've worked with plane equations — but in general, much of the math in computer graphics has opportunities to ...
1
vote
Accepted
How to set keys for emission on/off for a prefab?
If it were me, working on Unity or not, I would have two classes/prefabs and swap. The idea is that the active object will be replaced with a different object that is inactive. Simple.
To do that, in ...
1
vote
C++ create array of multiple types
In this case you want to use virtual functions on the base class like so:
class Entity // base class
{
virtual void ai(Entity n){}
}
Even though this is just ...
1
vote
How to deal with data that needs to be accessed by all objects?
You are looking for an alternative to dependency injection. I'll offer you a perspective shift: The game world is external. You are just sending and receiving messages. It is not a great idea to have ...
1
vote
Given a base class and many derived classes with additional features, what's the best practice for accessing those features?
There's nothing wrong with keeping a container of derived class observing pointers for direct and immediate access while keeping an overall base class container for management:
...
1
vote
Accepted
Ideal way to instantiate abilities in a class give a dynamic list of abilities to use?
You could have a function that takes in a string, which can be loaded dynamically, and returns a new ability.
...
1
vote
How to differentiate between object types and roles?
I would suggest two different ways of solving your problem. One close to your current implementation and another more abstract concept, but that is easier to use in the long run.
First the simple ...
1
vote
Wonky perlin noise
Found The answer! My linear interpolation values were just flipped and when I flipped them back, instead of being inverted and creating layers, it was reverted to its normal state.
Code Changed:
<...
1
vote
Querying game objects in real-time
It all depends on the query types, but broadly speaking...
If world is very large, as in an MMO, use a database, whether SQL or noSQL style is up to you, but it is a lot simpler to read (with your ...
1
vote
Why has my object detached itself from the parent?
Your normals are flipped, search for shortcut or how to flip normals in Blender, that is causing invisible faces. Make sure your sword is parented correctly to the bone that is holding the sword.
I ...
1
vote
Accepted
C++: passing gameobject as a parameter and then into vector
Your crashes is mostly because of improper handling of the object's ownership.
When you add something to a collection, you should clearly understand who's owning the object. Is that handler owns the ...
1
vote
Accepted
Read access violation, pointer was nullprt
As far as I can see you never initialise your pointer.
You declare Splav *sp but never create a new Splav instance which means ...
1
vote
Accepted
Sprite/Object/Room limits in GameMaker 8.1?
GM 8.1 Lite has a lot of limitations. And there is no any reason to use it.
Documentation says:
Standard Edition contains considerably more functionality and does not display any logos or popup ...
1
vote
Equal objects with independent variables in Game Maker?
There are many ways to do it. For example:
obj_runner Create
...
1
vote
Accepted
Difference between Object.Destroy() and GameObject.Destroy() in Unity
None. GameObject.Destroy() is inherited from Object.Destroy(). Both statements refer to the same method.
This is not explicitly ...
1
vote
Make character move behind object
This is one of the main reasons why we don't use tiles for objects, like trees. Sprites are much easier to manage.
Anyhow, most engines, frameworks and APIs allow you to render the sprites based on a ...
1
vote
An object twice as close appears twice as big?
You have to define "twice as big". A line will be twice as long, or tall, at half the distance, but simple mathematics tells us that the surface area of a rectangle, for example, is the height ...
1
vote
How to gain accurate results with Painter's algorithm?
In such cases for me it always worked using bsp-trees. Split the scene until you have convex set of polygons in bsp-tree's node and then you can easily sort polygons within the nodes. Note that by ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
objects × 112c++ × 23
unity × 20
architecture × 15
gameobject × 14
java × 8
design-patterns × 7
c# × 6
opengl × 6
javascript × 6
oop × 6
2d × 5
movement × 5
software-engineering × 5
collision-detection × 4
3d × 4
animation × 4
game-loop × 4
levels × 4
gamemaker × 4
xna × 3
libgdx × 3
game-design × 3
rendering × 3
sprites × 3