Tag Info

New answers tagged

1

The simplest way is to pass STL shared pointers of resources around to your objects, it's fairly painless but hard to catch errors in and it's not particularly obvious what system/object owns the particular resource. Personally I prefer the method of the resource system giving out handles, a handle (in this case) just something comprised an integer value ...


1

Like most things in software development, the answer is "it depends". Only you will be able to decide which is the right approach because you have intimate knowledge of what you need to accomplish and whether it is worth the extra effort to make it right. Properly designed, you might use both methods. Global anything in code is typically a bad idea. Though ...


-1

Entities should be stored separate from your terrain/voxels. Voxels are represented by integer positions, and therefore not possible to make them move smooth.


2

CharacterController controller Has a radius and height that define its space occupation. (the green cage in the image). That cage (capsule) interact with othe colliders (i.e : the terrain). If the cage its too big respect the enemy shape, you see it fluctuate, because the cage bottom touches the ground.


0

Your todo can be done with, FindGameObjectWihTag ("Player") as there will only ever be one player per instance unless you're doing multi-player. Damping has no value. You need a value for gravity on the empty otherwise you have 0 gravity and you're reducing to <0 which would cause it to float.


0

Your implementation is a bit off of the other Entity-Component systems I've seen. I recommend taking a look at EntityX. It should give a good idea of what a working implementation looks like. You could also read these which may help: Role of systems in entity systems architecture Component - Game Programming Patterns Understanding ...


0

Spatial partitioning is most definitely the way to go. The book 'Game Programming Patterns' has a very accessible chapter on the subject (http://gameprogrammingpatterns.com/spatial-partition.html) so I'd highly suggest reading that, as well his chapters on the game loop and update method. Also, if I understand your comment correctly, each different type of ...


0

What you're looking for is "spatial partitioning". You want to break up your world space into smaller chunks to cut down on how many objects you detect collision against. Since you're just doing 2D you'll probably want to use a "quad tree". There are other options including BSP trees but in my experiences quad trees are the best all around solution. As for ...


0

If I understand your intention correctly, you are trying to figure out how to reduce the number of collisions to check for, which is basically in the realm of 'potentially collidable set reduction'. If so, you'd do well to research spatial subdivision and/or nearest-neighbour search algorithms (such as octrees, KD trees, BSP and the like). One (or more in ...


1

Store the keys from the last frame and compare in the current frame. if(!old_keys[key] && keys[key]) { /* pressed since last frame */ } if(old_keys[key] && !keys[key]) { /* released since last frame */ } if(old_keys[key] && keys[key]) { /* held since last frame */ }


1

In simple terms a common design in SpriteKit games is scenes, layers, nodes and child nodes. You might make each part into a discrete class that encapsulates all of the parts, properties and methods. For example a Background class that has layered images, particles, various properties like the speed each layer should move and public methods to start and ...


2

Vector mathematics! Assuming you're using Unity, you could use the inbuilt functions of Vector2: transform.position = Vector3.MoveTowards(transform.position, target, speed); Otherwise, here's how it's done - first, calculate the direction from point A to point B: public static float Length(float x, float y) { return Math.Sqrt(x * x + y * y); } ...


0

Ok I decided to help you on your way. But we are simply not doing homework for you. UDK documentation seems down for maintainance but I have found this: http://www.moug-portfolio.info/udk-projectiles/ example. You should read it completely since it helps you understand projectiles. Towards the bottom they explain projectiles. Let it be clear that I have no ...


0

You can write your engine in super classes. Have a game, an entity, etc. Then to make a new game, extend the game class which has your game loop. To add an entity, extend the entity class. So the game class would have a generic game loop. Your game would extend that game class and override the parts you need. The game class can be coded to handle the ...


0

One way to do this is by having the game be a dll and the engine being the executable. There are side benefits to this as well. If your main menu / matchmaker etc screens are in the engine and only actual game sessions use the game dll, you end up completely tearing down the resources used by the game between matches. This can help with memory ...


3

The answer to the question "Is it possible, or even feasible, to have graphics engine completely decoupled from game logic?" is "yes". I would say it is even "advisable". But in general, you'll find a lot of your game ends up tied to the engine you choose for other reasons, like input handling or use of their facebook integration or other cross-platform ...


0

Looks like you have some problems with references. Strictly saying, you cannot return local object as a reference, nor you can bind non-const reference to a temp object like this: Add("something", GameObject()); I wonder how did you get it to compile... If you want to remove references be sure that they are not destroyed (e.g. by goingout of scope). ...


0

It seems that you have used different types in it->second.Update(ev) (ev - SDL_Event&). And in it second type is GameObject&.


3

It's OK to have component dependencies. And the more explicit the dependency the better. There's nothing worse than dependencies hidden behind useless layers of indirections. Your case doesn't look like a dependency hell to me. No circular dependency or unclear ownership of data: consider yourself lucky! Now I still believe that you need to reverse your ...


2

In my experiences there aren't too many ways around the fact that, you're right, all your different game entities and their components need to be aware of the state of the game and their own state. It's a mess unless you design with state machines in mind. The best way I've found to deal with it is to make sure that components are all doing small pieces of ...



Top 50 recent answers are included