Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

DirectX8 and Multiple Meshes

GrumpusGrumpus Member Posts: 5
Hello,

I'm building a solar system model for a basic game I'm working on in Visual Basic 6. I haven't done programming in years, but I'm pretty good - or at least I used to be. My problem is coming in with DirectX8.

Here's what I'm doing:

1) I've got one sphere.x file that I want to load once for the sun and put it at 0,0,0 in my scene. That works fine using the DirectX8 example.

2) Now I want to add planets. So, I dim a new mesh object, and create it in the same way as the first one.

3) No matter what I do (varying my code in the InitObjects, Matrix Setup, or Render) I only get the last mesh in set up in the object init.

MY QUESTION: Is there some sort of an example out there that shows loading one mesh, positioning it, and then loading a second mesh (from an x file) and positioning it in relation to the first one? (Or any example at all of loading two separate meshes from two separate x files?)

Thanks in advance!


Comments

  • SephirothSephiroth Fayetteville, NC, USAMember Posts: 1,035
    Sounds like DX is being pointed to the previous object for some reason. I toyed with DX for a month and got nowhere, whereas I leanred how to do the basic OpenGL stuff in about 4hrs. Anyways, I am not sure how DX looks at your objects, but if you can somehow force DX to look at your second (third, fourth, etc) object using pointers, I would try that. If your objects are stored in an array somehow (ie: OBJECT objects[128];), try selecting objects[x] right before you draw. If youc an paste a few snippets I might be able to help you in a better way.

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

  • GrumpusGrumpus Member Posts: 5
    I figured most of it out. Here's how - for those who are interested:

    My problem was that I was loading a mesh, translating it, then loading a mesh and translating it. Every time you'd try to move either one of them independantly, the other would translate, too.

    After reading the DX SDK documentation for about 4 hours I finally managed to figure out that I needed to load a mesh and then put it into something called a "Frame". (Which, not really to my surprise, I didn't notice at first because if you look in the docs at the definition of a frame, is that it's something that holds the geometries that are to be displayed on the user's screen - I assumed for days that it was a term for a "picture frame" not a "Box" to put my mesh into - what a dork, huh?)

    Now I've got a really nifty solar system that is generated at runtime using a data file. It should turn out pretty nifty. Only problem I'm having right now is finding a better way to skin the planets so I don't have to generate a separate mesh file for each texture. It's easy enough to do if you know what's coming at code-time, but in a dynamically generated universe, it's turning out to be a bit trickier. I'll get it though.

    Thank you very much for your help! (I didn't actually utilize it, but I'm very appreciative that you took the time to try!)

    Bo Grumpus


  • SephirothSephiroth Fayetteville, NC, USAMember Posts: 1,035
    See all that info you posted? That's why I went to OpenGL! DX is too dang twisted and complex for a user's "first" hardware accelerated program. Glad you got your proggy working though, since I wouldn't have figured that out. In OpenGL translations are done independantly, without the use of these "frames", so I'd never have caught it. However, I am intrested in DirectSound. Do you know much about DS? If so I'd like to ask you a few basic questions since I will soon be looking for something to use as an audio engine for my OpenGL 3D engine!

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

  • GrumpusGrumpus Member Posts: 5
    Of all the DirectX stuff, Direct Sound is probably the easiest to understand (at least for me). In basic terms, you simply initialize the DSound Object, Point it at your media directory, and play the sound when an event occurs. It gets somewhat trickier when you are looking at 3d sound (i.e. the "Grunt" actually sounds like its coming from the 3d mesh of the dude whose head you just blew off.) Even that isn't so tricky. I'd say that if you're pretty good a VB programming, learning to use DirectSound will take you a hour or so to figure out.

    Now, DirectPlay (for Multi-User connections) is a wholefrigginutherstory. That's what I've been playing with today and lemme tell ya - it'll take someone most of a day just to figure out whether to use a lobby, a server/client, or a peer to peer connection - and then you've got to go from there! Can't wait til I get to coding the stupid voice chat functions!

    Oh well.

    Good Luck!
    Bo


  • SephirothSephiroth Fayetteville, NC, USAMember Posts: 1,035
    Actually, I started programing in 1982, and have always used the notepad/command-line compiler method (=. I tried VB once and lost such a degree of control without doing all kinds of annoying crap that I stopped it. It also wanted to include files sometimes that I didn't even need. Right now I use the world-famous "Notepad" :D and BC++ 5.1 to do my work.
    Now, how would I go about getting the stuff required to do the DS programing, and where may I find it? I am using trakcer formats for my music (like in the Unreal Engine), so DS will have to mix that audio stream with whatever it plays. I assume it can do that. 3D audio doesn't intrest me, yet. The DP stuff won't matter in this game since it is a role-playing game on the scale of say, Daggerfall. Imagine guy 'A' spawning in Uthiros while guy 'B' spawns in Altea, which is seperated by several hundred miles. Quick-travel would have to be disabled in multiplay so they would have to walk, run, or ride a horse to eachother. Man that'd take AGES!!
    Thanks for the information, I really appreciate it. Oh, and once I get my sound/music engine started, you'll probably catch me posting all voer our sound board :P.

    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

  • GrumpusGrumpus Member Posts: 5
    : Actually, I started programing in 1982, and have always used the notepad/command-line compiler method (=. I tried VB once and lost such a degree of control without doing all kinds of annoying crap that I stopped it. It also wanted to include files sometimes that I didn't even need. Right now I use the world-famous "Notepad" :D and BC++ 5.1 to do my work.

    That's pretty cool. I first started playing around that same time. I almost miss the times of the good ole TRaSh-80'. :)

    : Now, how would I go about getting the stuff required to do the DS programing, and where may I find it? I am using trakcer formats for my music (like in the Unreal Engine), so DS will have to mix that audio stream with whatever it plays. I assume it can do that.

    Yeah, the different "channels" to play sound on are limited by the end-user sound card more than anything else. I'm not sure about the "tracker" format, but I'd assume a good search would produce a module that would translate the format so that it could be played properly. As far as getting the SDK, Microsoft provides a C++ kit, though I'm not 100% certain the details on compatibility with the Borland compiler. I'd assume it works just fine. (And, the direct sound examples are pretty easy to understand and follow - unlike the DPlay and D3D examples).



    :3D audio doesn't intrest me, yet. The DP stuff won't matter in this game since it is a role-playing game on the scale of say, Daggerfall. Imagine guy 'A' spawning in Uthiros while guy 'B' spawns in Altea, which is seperated by several hundred miles. Quick-travel would have to be disabled in multiplay so they would have to walk, run, or ride a horse to eachother. Man that'd take AGES!!

    That's pretty cool. The game I'm working on is similar to that in scale. The alpha version will work with just one solar system, but I'm writing some routines so that the first player who ventures out to the edge of the defined system will trigger the routine to randomly generate a new system, and so forth. (The plusses to this are many - mainly, once the user load gets heavy on one server, I can divide the known universe into "quadrants", or whatever term you'd like to use, and each quadrant could run on its own server.)

    In the end, I'd like to see the ability for the game to handle an unlimited number of simultaneous players and a virtually unlimited size to the universe. (Like your game, the size will be limited mainly because no one in their right mind would want to spend the time it would take to drive to the very outermost systems in the universe).

    Neato, huh?

    : Thanks for the information, I really appreciate it. Oh, and once I get my sound/music engine started, you'll probably catch me posting all voer our sound board :P.

    Cool. I'll keep my eyes out here. Hopefully, we'll both be working on our sound routines at about the same time so we can scream and yell about how stupid Microsoft is in unison. :)

    Bo
    :
Sign In or Register to comment.