#1
Posted 07 April 2012 - 02:31 PM
#2
Posted 07 April 2012 - 03:06 PM
#3
Posted 07 April 2012 - 03:26 PM
#4
Posted 07 April 2012 - 03:47 PM
#5
Posted 07 April 2012 - 04:54 PM
#6
Posted 07 April 2012 - 05:30 PM
I'm not an expert at games, so perhpas someone else may give you better advice. Regardless, whether you use a loop or events or both, they all do the same in the end.
#7
Posted 07 April 2012 - 08:21 PM
#8
Posted 07 April 2012 - 09:17 PM
If you set your frame rate to 60, make sure that any moving object such as a bullet, are moving at a constant rate no matter what frame rate you use. If your monter walks at 10 FPS, then you need to make it walk slower at 60FPS.
You can also use events to modify your list. Like mouse and keyboard events. Just lock your list first and unlock it when done, because you don't want a frame to update it at the same time the mouse is.
#9
Posted 07 April 2012 - 11:25 PM
#10
Posted 07 April 2012 - 11:44 PM
#11
Posted 07 April 2012 - 11:53 PM
#12
Posted 10 April 2012 - 12:30 AM
There are many ways how to actually do it, all designed for specific cases -> you'll most probably invent your own way how to structure the code. Anyway just a little advice - don't stick to only single way to structure game engine, I've moved/changed huge amounts of stuff since beginning and it sitll isn't perfect in my opinion, by well I'll let it in pretty decent state for now (and work on other stuff - like games on it).
So don't be afraid to not-doing stuff perfectly, do it just so much when it becomes decent in your opinion (e.g. when it's simple to work with for you)
If you don't know how to speed up application, go "roarrrrrr!", hit the compiler with the club and use -O3 :D
#13
Posted 10 April 2012 - 08:36 AM
Pass the frame time into all objects when you update them, don't assume the frame rate will be exactly 60hz. It often isn't. Also if you wanted to do slow motion effects you can do them easily by passing in a slower frame time to each object while still updating the screen at 60 hz
Have a base class that only has constructor, destructor, draw, and update methods in it and base all your objects on this. Even if you are working in c you can do this with a base struct. You can add methods to other objects as you need them, but having a base class is a must.
Have multiple lists of objects instead of a single global list. When you come to doing collision detection you will be really happy you did.
Other than that, experiment. Try stuff out and see what happens. If you find out that it's not good enough later, you can change it. At least you have learned something and can see something on screen.
Good luck.
#14
Posted 13 April 2012 - 03:42 PM
#15
Posted 14 April 2012 - 09:04 AM
So when you create your class to hold an object, add a pointer to a second object.
In pseudo code it would be.
class Object
{
private:
public:
<usual stuff>
Object * child;
void Draw();
};
Object::Draw()
{
pushmatrix
translate
rotate
drawmesh
if (child)
child->Draw();
popmatrix
}
Then the object will always be attached to the parent.
This link does not have to be a fixed link, you can rotate the child around the parent, move it relative to the parent, do what you like.
#16
Posted 17 April 2012 - 11:27 AM
#17
Posted 17 April 2012 - 12:25 PM
This method is called at a few points, when you load a mesh into an object, when you add a child mesh, and when I distort a mesh. (explosions et al)
This is recursive on the children as well.
The parent object has two bounding volumes, one that contains itself AND all the children, one that just contains itself.
When I need to do a collision detect, I check against the big one first, then check against the sub volumes.
Note I always use rays for collision detection, so I can handle the case when the ray strikes multiple objects (parent and one or more children). I calculate the position along the ray for each object and take the shortest length as the only collision.
#18
Posted 30 April 2012 - 03:39 PM
finally I have another question about collisions what if I have one object with multiple triangles. I know how I would detect a collision between triangle and triangle but how would I check a full mesh to another mesh? break up the triangles and detect each alone
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users












