Author Topic: Any game developers out there?  (Read 380 times)

Offline StSanta

  • Gold Member
  • *****
  • Posts: 2496
Any game developers out there?
« on: March 06, 2002, 06:36:42 AM »
Alright, been playing around with graphics programming - started off in Java and  is now working with C++.

What I've done, quite basically, is I've taken age old books on graphics programming and used the math in there to create a quite basic 3d world.

First time I do it, so the code is probably toejame slow. And yeah, I should use d3d/OpenGL, but I wanna try out the basics, and see if I can understand and implement the math.

At any rate, in my wonderful little 3d world, I have some very cute polyhedrons.  Use back face culling, and have implemented Painter's algorithm - still working on making Z-buffering run acceptably, although the worst case run time seems a bit worse.

So, I have some objects, and I have this cute little box I can fly around with. Now, how the hell do you introduce physics into this world? The whole aspect of doing this isn't immediately obvious to me, and I've been unable to find good books on the subject.

So any references on books on this (bet HTC know how :D) would be greatly appreciated.

Am doing this as part of my studies - gonna have an exam in this stuff. Well, the exam is in graphics programming and there's lots more of that to implement, but I want to have some basics down. I want the box to accelerate according to a curve, and I want there to be g-forces, so the box can jump off cliffs and stuff. I.e very elementary physics stuff, nothing fancy.

Hope some of you can direct me towards a good source of info.

Offline Badger

  • Copper Member
  • **
  • Posts: 153
      • Military Surplus Collectors Forums
Any game developers out there?
« Reply #1 on: March 06, 2002, 06:52:21 AM »
StSanta....

Not sure if this site will help you or not, but it contains a lot of interesting material relating to physics engines.

Click HERE for FREE NASA Software, that permits anyone to simulate all kinds of different physics motion, including airflow around various shapes of airfoils, baseballs, engines etc.  I'm not sure if they come with source code examples, but it's a good place to start looking around for this type of stuff.  I notice that there's a number of teacher/student dialog areas with problem solving sections.

Regards,
Badger

Offline SageFIN

  • Copper Member
  • **
  • Posts: 176
Re: Any game developers out there?
« Reply #2 on: March 06, 2002, 10:36:28 AM »
Quote
Originally posted by StSanta
So, I have some objects, and I have this cute little box I can fly around with. Now, how the hell do you introduce physics into this world? The whole aspect of doing this isn't immediately obvious to me, and I've been unable to find good books on the subject.


Well, in my piece of work I actually had a physics engine done before the 3d visuals (it was the physics I was more interested in, anyway). My physics engine was done with vector mechanics (dunno what it shold be called).

Soo... on the very basic level it was just plain and simple forces acting on my objects. Done with vectors they had a starting point, the vector itself and the magnitude of the force stored. From those I could get the linear acceleration of the object and could also calculate rotational accelerations. IIRC I made it so that the objects would always rotate around the origin of the 3d-model. So I assumed that the object would always rotate around the CG and was content setting the origin of the 3d-model at it's CG.
 
From accelerations I would just interpolate velocity from v = at (ie. assuming a is constant for duration of t) and from that location. If the physics loop is run at high enough a frequency, then t is small and the results are at least somewhat accurate.

While writing physics for my prog I didn't have any books and did it just relying on basic high school math and intuition. The 3d part was much more tricky.

If you want, I can email you my code. It's an old work-in-progress I later abandoned and it's not pretty and not altogether functioning as it should and probably buggy too, but perhaps it might help. It's written in C++ too.


Offline CptTrips

  • Plutonium Member
  • *******
  • Posts: 8634
Any game developers out there?
« Reply #4 on: March 06, 2002, 01:42:36 PM »
Try searching http://www.gamasutra.com for articles by Chris Hecker.

He had a really great 3 part series a while back.


I'd also recomend:

"Physics for Game Developers"
ISBN: 0-596-00006-5
O'Reilly Press

Its a great introductory text.

Regards,
Wab
Toxic, psychotic, self-aggrandizing drama queens simply aren't worth me spending my time on.

Offline SageFIN

  • Copper Member
  • **
  • Posts: 176
Any game developers out there?
« Reply #5 on: March 06, 2002, 07:37:02 PM »
Gee, those links would sure have come in handy, too bad I didn't come ask for advice here when coding my stuff :D

I might dare to argue though that when you figure it all out by yourself from the bottom up you might comprehend the particulars of the issue at hand better. Then again, one could say that reinventing the wheel is of no use whatsoever. YMMV.

Offline CptTrips

  • Plutonium Member
  • *******
  • Posts: 8634
Any game developers out there?
« Reply #6 on: March 06, 2002, 08:35:29 PM »
>I might dare to argue though that when you figure it all out by
>yourself from the bottom up you might comprehend the
>particulars of the issue at hand better.

(shrug)  Maybe, maybe not.

In school, when I took Calculus, I wasn't forced to invent it on my own before be allowed to open the text and learn from it.  Maybe I would have learned it more deeply, or maybe it would have just taken me longer.


Your mileage may vary,
Wab
Toxic, psychotic, self-aggrandizing drama queens simply aren't worth me spending my time on.

Offline StSanta

  • Gold Member
  • *****
  • Posts: 2496
Any game developers out there?
« Reply #7 on: March 07, 2002, 01:01:43 AM »
Thanks for the links! And sure, send me yer code: would love to have a look at it.

Have just been trying to add particles to the 'graphics engine' (too pathetic to be called that). Yuck. YARK. Hell of a lot of math in graphics programming.

Seems the physics will be even worse.

Heh.

Offline straffo

  • Persona Non Grata
  • Plutonium Member
  • *******
  • Posts: 10029
Any game developers out there?
« Reply #8 on: March 07, 2002, 02:12:19 AM »
Quote
Originally posted by StSanta
Hell of a lot of math in graphics programming.

Seems the physics will be even worse.

Heh.


Yep.
so true :)

Offline SageFIN

  • Copper Member
  • **
  • Posts: 176
Any game developers out there?
« Reply #9 on: March 07, 2002, 07:58:17 AM »
Quote
Originally posted by StSanta
And sure, send me yer code: would love to have a look at it.


I would, if I only could get your e-mail address from somewhere.

"Sorry! That user has specified that they do not wish to receive emails through this board etc yadda yadda"
« Last Edit: March 07, 2002, 08:00:51 AM by SageFIN »

Offline StSanta

  • Gold Member
  • *****
  • Posts: 2496
Any game developers out there?
« Reply #10 on: March 07, 2002, 10:26:42 AM »
Odd: my profile says I have it on.

Anyway: stclaus@stofanet.dk

Appreciate it SageFIN :)