• Advertisement

Archived

This topic is now archived and is closed to further replies.

Help Getting Started with 3D engine

This topic is 5974 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok i am working on making a 3D space flight game, and have read almost all of the tuts, on this web site which have been a great help, and thanks to everyone involved with that. but i have hit a little problem, im not quite sure where or how to start creating the environment for the ship i created to fly through, and eventually it would be multiplayer, much like a cheap version of Xwing vs Tie fighter. i just need something basic in space. i would appreciate any help or suggestions anyone has.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
im assuming that your making this game in opengl and c++. well a great way to start is with the game tutorials on nehe''s site.

i receently started my own engine a little while ago.. its progressing smoothly. heres what i did. first off i like to code with classes. so i started by writing the core class.. creating the window. initializing opengl etc. next i wrote a basic sprite and a 3d object class. as well as a font and input class.

its working great for me.. actually amazingly well, i start off with basic classes and then expand them as they become more advanced.

well thats a simplistic version of what i did. hope it does help.

later

Share this post


Link to post
Share on other sites
ok well i have looked at all the gamming tuts, and i may have missed something becouse i am still not sure how to keep track of two moving objects in the area. im pretty sure i can make the classes for getting input and all that stuff. its just how to go about the actuall area where you move around in. i would suppose i just move the camera position around but the problem arises when a second player would join. that idea is what is giving me the problems. how would i keep track of both of them moving around and then show it? sorry i guess i didnt make myself very clear earlier, i dont really know if this is clear either. thanks though i hadn''t thought of splitting up some of those things into diffrent classes.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
One approach is to store a transform matrix with each object.

The transform matrix is just an application of all the rotations and transformations that you need to apply to the object to move it from the world origin to the orientation and the position where you want it.

If you implement the matrix as an array of GLfloats you can use
glMultMatrix() to translate the frame of reference of your object so that you can draw it as if it was located at the origin. (pseudocode)

GLfloat matrix[16]; //object''s transform matrix

update_matrix(); //update the objects transform to move it
move_camera(); //translate/rotate for camera viewpoint
glPush(); //save the camera frame of reference
glMultMatrix(matrix); //move to your objects frame of reference
draw_object(); //code to draw your object
glPop(); //restore camera for next object

To move your objects around in world space you just need to update the transform matrix with appropriate translations and rotations. Any good tutorials or book on 3D graphics should show you how to do matrix operations.

A different player would see the view from a different ''camera'' so the second player just needs a different camera transformation.

This approach works well for me! hope this helps

Keith


Share this post


Link to post
Share on other sites
(maybe I won''t be anonymous this time)

One approach is to store a transform matrix with each object.

The transform matrix is just an application of all the rotations and transformations that you need to apply to the object to move it from the world origin to the orientation and the position where you want it.

If you implement the matrix as an array of GLfloats you can use
glMultMatrix() to translate the frame of reference of your object so that you can draw it as if it was located at the origin. (pseudocode)

GLfloat matrix[16]; //object''s transform matrix

update_matrix(); //update the objects transform matrix
move_camera(); //translate/rotate for camera viewpoint
glPush(); //save the camera frame of reference
glMultMatrix(matrix); //move to your object''s frame of reference
draw_object(); //code to draw your object
glPop(); //restore camera for next object

To move your objects around in world space you just need to update the transform matrix with appropriate translations and rotations. Any good tutorials or books on 3D graphics should show you how to do matrix operations.

A different player would see the view from a different ''camera'' so the second player just needs a different camera transformation.

This approach works well for me! hope this helps

Keith


Share this post


Link to post
Share on other sites
thanks for the help keith. i think i got the idea now, i have spent the last day looking through everything and i think i got it. i guess if i post another question in a few days i was wrong. thanks for the help though.

Share this post


Link to post
Share on other sites

  • Advertisement