Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 13 Jun 2007
Offline Last Active Jul 07 2012 05:40 PM

Posts I've Made

In Topic: Space partitioning for flocking

04 July 2012 - 03:48 PM

Well, you could use binary space partitions or quadtree's, which are probably easier for 2d things, or even octrees which are easier to use with 3d things.
Or, you can just use a grid, when each cell in the grid has a pointer to the objects in it, the objects only have to check for collisions with objects that are in the same cell.

In Topic: Help me change my life and career.

04 July 2012 - 03:45 PM

A little tip. If you're gonna make a game, first make some smaller, simpler games in the same genre. By simple I mean especially the graphics. Good graphics are pretty hard to archieve, most game studio's have whole teams of artists for character and level creation, and in my experience, good graphics are one of the hardest things to archieve (together with a general fun game experience: making the whole game not too hard or too easy, not confusing the player, and keep rewarding the player without giving him more of the same every time).

The first small game will probably be a mess, maybe you won't even finish it. But, as a result, you will have a better idea of the structure the program needs to have. Sometimes, when you're able to implement a new feature in your old engine, you will think 'OMG, if I redesigned the whole thing it would be so much easier!'. Keep your old projects, and comment everything well, so you have usable source to consult or even use directly if you're having trouble. Also, think about splitting things up in classes, if this doesn't hurt the readability or performance of your game. Also save useful functions in a seperate file.
For me, this way of working results in much cleaner and faster code. Please note I didn't ever code a big game, so I don't know how well this way of working scales with the projects, possibly this is too much work for big projects.

Last thing. You've probably heard this before or thought of it yourself, but seperate your engine from the levels, graphics, and gameplay as much as possible. It will be easier to make special effects (graphical effects or gameplay-wise, for exception, inversing the gravity will be easier when you have some force vectors instead of a hardcoded "player.y += 5;" each frame (as a figure of speech)). This can cost a little bit of performance, but things like this can usually be done pretty efficient. Else you just have to find a balance, or try both ways and then decide what's the way to go.

Good luck :)

In Topic: Line intersecting a face

28 June 2012 - 12:32 PM

Hmm, good question. This is the easiest to do with triangles, I think.
I done a little raytracing a long while ago, and this question came up when I was trying to build a little engine. I've forgot the specifics of the implementation, but don't worry, there is plenty of information out there. For example here and here.

If you want to do this for arbitrary polygons you may want to triangulate them first, but again, I forgot the specifics, so I'll leave it up to you to do some research. A little linear algebra skills may come in handy if you want to understand what's going on (or even try to find a way yourself).

In Topic: Rope/cloth simulation problems

28 June 2012 - 11:03 AM

Here is the result I got with Verlet Integration (the method I described in my first post):

I'm quite happy with it, since it was all done it a hurry (I got my finals this week, so I made this from the rope thing in literally one day). Gouraud shading, nothing fancy (I had no time to do research in OpenGL lighting methods, I had enough trouble with C++ alone, since this is the first thing I code in that language).

I have to admit, this is the result in optimal circumstances. I don't have any collision detection, so the cloth/flag often sticks through itseld when I move it.

In Topic: Rope/cloth simulation problems

26 June 2012 - 05:27 PM

Thanks for your reply!
I've fiddled with the variables a bit and I get a much better performance now (I would upload another video right now if that wouldn't take so long). At first I thought that setting my stiffness above 1 would result in instability per se, but it turns out that it works quite well. I've got a cloth simulation running with the method I've described above, and it works fine. I do about 7-50 iterations where I satisfy the constraints. Works quite well, however the strings are still quite elastic when I use a lower number of iterations.

Then I came across deformation constraints in a mass-spring model to describe rigid cloth behavior. It seems to be what my lecturer aimed at with his descriptions of a mass spring model, with a maximum length for the rope segments between the nodes. I am trying to implement this model right now. Sadly, I'm kind of stuck with Euler's method of integration. I get only way too elastic strings, which fall straight down to the ground, even if I set the stiffness to 1.

Maybe I will have a shot at it in the near future, but since it's for an assignment that I have to hand in in a few days, I will finish the project with the Verlet Integration first.