Tag Info

Hot answers tagged

4

The questions you should be asking yourself is if it makes even sense to treat different character classes as different code classes. You usually use code-classes when you have objects which behave differently in terms of programming. But in many games, this isn't actually the case. Fighter, Warrior, Knight and Barbarian all can use the same programming, ...


2

From a quick glance at the SDL wiki at the function you provided, it says: "The returned resource is owned by SDL and should not be deallocated." from - https://wiki.libsdl.org/SDL_GetTouchFinger Therefor, you shouldn't need to worry about destroying the object, SDL will manage it for you.


2

Use the smallest type that makes sense. 3-components vectors are smaller, but may involve "overhead" when converted to 4-component vectors for some operations. 4-component vectors, on the other hand, are larger and thus have some space "overhead." In most cases "overhead" in either case is negligible. However, the additional storage taken up by a ...


2

This depends on what operation you are performing on vectors. vectors are actually really fast. iteration is as fast as possible, since the vector does not store pointers but an array of objects in one straight block of memory, so iterating over a vertex is as fast as iterating over an array. And even the iterator-objects do not add a overhead, in ...


2

I think you may need to look further than simple collision detection to make this happen. Due to the discrete nature of a simulation such as this, it's hard to achieve a smooth "flooring" of one object onto a surface as it will constantly collide, then be adjusted, then collide, then be adjusted again. One approach in projects I've used in the past is to ...


1

The transform method of Vector class is wrong. If you want to perform a transformation of the vector that is equivalent to multiplying a vector by a transform matrix, you should modify your code as follows: void Vector2::transform(double a, double b, double c, double d) { double newX = a*x + b*y; y = c*x + d*y; x = newX; }


1

Your first problem - why not have a component for each buff? They do similar things, sure, but many buffs might operate quite differently. For example, the simplest would be to increase the player's health by some amount. However, you may have a more complex debuff that say damages allies that are near the player every x seconds. If you don't want to ...


1

I don't think there is much you can do to prevent this, because essentially your graph shows you the problem. The physics system has to apply the force according to the tick (or substep) delta, meaning that at some point it is just not possible to update the position of an object independent of the framerate. That is also the reason why you can specify the ...



Only top voted, non community-wiki answers of a minimum length are eligible