Alpha of my first game

This is a discussion on Alpha of my first game within the Game Programming forums, part of the General Programming Boards category; Lurker, I thought you were pulling my chain with that Data/Graphic thing. I checked the EXE in Hex Editor, and ...

  1. #16
    Registered User BillBoeBaggins's Avatar
    Join Date
    Oct 2003
    Posts
    107
    Lurker, I thought you were pulling my chain with that Data/Graphic thing.
    I checked the EXE in Hex Editor, and what was there?! a directory.. Data/Graphic.... whoops.. thanks dude.

    Safe Codin

  2. #17
    Registered User BillBoeBaggins's Avatar
    Join Date
    Oct 2003
    Posts
    107

    Thumbs up

    Perty cool man, I like how they remember their destination even after they stop for a while in traffic. Awesome.

    Yes I get the idot of the day award!
    Last edited by BillBoeBaggins; 05-26-2004 at 04:29 PM. Reason: Spelling error

  3. #18
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Yeah Shakti was hard at work on that one and I'm glad to see he got it working.

  4. #19
    Registered User
    Join Date
    Aug 2003
    Posts
    1,205
    Thnx for your comments. Yes the folderstructure is very important. This weekend I will try to work on them shooting, improve my selectioncode (thnx to Bubba for the idea), and I will try invoke some more things that should happen when They are stuck against another tank. And a special thanks to Bubba who is helping me with this project!
    Last edited by Shakti; 05-27-2004 at 03:57 AM.

  5. #20
    Registered User
    Join Date
    Aug 2003
    Posts
    1,205
    Here is a little update on the work:
    I have improved the multiselection code by tons (that is the code that handles the selectionbox). I tried it with 10000 units and I was able to select them all in 0.03 seconds ! I dont know if that is very fast but to me that is really fast. With my old code I didnt have the patience to wait for it to finish

  6. #21
    Banned
    Join Date
    Dec 2003
    Posts
    367
    It runs pretty smoothly. I ran it with wine on Linux. Good work.

  7. #22
    Registered User
    Join Date
    Aug 2003
    Posts
    1,205
    Here is my newest demo.

    Ive improved my selectioncode (I posted about it in a reply above) and Ive added shooting, so now you can shoot those tanks .
    Attached Files Attached Files

  8. #23
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Sound engine is near completion. Only need a way to effectively handle DirectMusic segments. Music is ready to go as well. 3D sound is also ready.

    Will provide you with the sound code as soon as I make sure it all works and shuts down correctly returning all allocated resources and COM objects.

  9. #24
    Registered User
    Join Date
    Aug 2003
    Posts
    1,205
    RGR that Bubba! I really thank you for helping me with this little project of mine!

  10. #25
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Ok Shakti I've got some code for you to test. I won't post it here but it is a simple CDXAudio class.

    Here is how you use it (as of version .10):

    CDXAudio TheAudioSystem;

    TheAudioSystem.Init();

    TheAudioSystem.Play("filetoplay.wav");


    Lots of work left to do on it. Currently it only plays one sound at a time which is no good. However I am implementing Audiopaths as well as 3D sound immediately. This code is simply to test and see if it works on your system. I attempted to make the interfaces to the class very straightforward and extremely simple.

  11. #26
    vae victus! skorman00's Avatar
    Join Date
    Nov 2003
    Posts
    594
    could you include a readme, or post a quick description of how to play? I've got the guys moving around the big green square, but I see you have a bullet image, which leads me to believe I can get into some action some how.

  12. #27
    Registered User
    Join Date
    Aug 2003
    Posts
    1,205
    Ok bubba, Send it to me the next time you catch me online.

    As for gameplay the only thing you can do now is shoot those tanks, no sides or anything. To shoot another tank select a tank and rightclick on another tank.

  13. #28
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Ok, Shakti, quick update.

    I've done a lot more research and a thorough read of my DX9 audio book. Here is my current idea for your sound engine. I will need to work closely with you on some key issues but more on that in just a bit.

    I'm not sure how much you know about DirectAudio programming or how it all works so I'll keep it fairly simple...but you must know some of it to use it.

    First of all DirectAudio is both DirectMusic and DirectSound combined. With the advent of DirectX 8.0 they were combined into DirectMusic. What this means for us is that it is easier to get sound up and running.

    Here are some key structures in the sound design:

    Audiopaths
    Segments
    Tracks
    Bands
    Motifs
    Styles
    Groove levels
    DMOs -> effects like reverb, etc.
    3D sound positioning

    In the design of this sound engine I separated DirectMusic and DirectSound - or succintly the music and sound effects use two different classes. The reasons for this are a bit involved so I'll leave that for later.

    To get this system working you need to understand audiopaths. Audio paths are quite simply the path that any sound(s) take to get to the final PCM wave data that leaves the soundcard and goes to the speakers. This includes effects, spatial positioning, panning, etc.

    In short each tank or CSoundEmitter as I called it is assigned to one of 32 different Audio paths. However this does not leave an audiopath for music which I'm sure you'll want to add later. We need to get together on how you want this thing designed. Don't get an audiopath mixed up with how many sounds can play. Any number of sounds can play on any audio path an unlimited number of times...however there are only 32 3D hardware sound buffers. This means that you and I have to figure out a way to prioritize sounds.

    One solution is this:

    1. Calculate the squared distance from any CSoundEmitter to the camera...or the center of the screen.
    2. If distance lies outside of a certain value then that object has a very low priority and probably will not be heard and as such will not be assigned an audiopath.
    3. For CSoundEmitter objects that do pass the test we then assign it an audiopath.

    For special reverb effects, etc. I suggest we create 2 or 3 audio paths that have these DMOs already on them. When we want the sound effect to play with reverb effect...we simply call Play with that audiopath pointer. Note that any sound that is played on that audiopath will have the reverb effect.

    The 3D sound will be taken care of simply by updating all CSoundEmitter objects that have been assigned an audiopath...and thus are audible....and then calling the CDXAudio function to set the position of the sound in 3D space. Don't worry about 2D vs 3D. If we position the camera directly above the playing field then that is the camera's Z coordinate, not its Y. Since Z increments into the screen on Direct3D and decrements in OpenGL - we simply take the absolute value of the camera height from the playing field and use it for Z. X and Y will then correspond correctly with the camera's orientation and the sound's will be correct.

    What this will do is when a tank begins to move you may fire off one segment that is the sound of the tank 'starting up' or beginning to move. Then we transition to another segment that is the tank moving. I can alter the pitch of the sound to simulate the engine revving up and revving down. As the tank moves off center of the screen....it's sound slowly fades away. When the tank moves out of earshot of the camera....it is no longer heard and its audiopath is unassigned. We may wish to make the sound quad much larger than the visual quad of the camera so that offscreen gunshots, explosions, etc... can be heard....albeit barely heard.

    I simply cannot go into every detail here as there are tons of them. But I can program the entire 3D sound engine for your game as well as the music portion...when we get there. We, however, need to talk much more about the design and goals of the game and the types of sounds you want as well as the memory footprint you will give for the sounds (how much RAM you'll allow for sounds).

    When we get it working with quality sounds (might have to purchase these) and music (I have some composers I know that might be able to help)....it will sound like it was professonally done.

    I will get teamspeak up ASAP so we can get to work on the sound engine and so that I can send it to you for testing.

    I'm also working on an editor for editing maps to be used in the game.

    Also, have you implemented waypoints yet and are you using DirectInput? I've got a very rudimentary DirectInput class that handles keyboard and mouse input. Your waypoint code could look something like this:

    Code:
    ...
    ...
    if (Mouse._mousestate.rgbButtons[1])
    {
       if (DIKEYDOWN(TheKeyboard.keystate,DIK_CTRL))
       {
    		 CurrentObject->AddWaypoint(Mouse._mousestate);
       }
    }
    ...
    ...
    struct Waypoint
    {
       long x;
       long y;
       float vx;
       float vy;
       int eulerangle;
       waypoint *next;
    };
     
    void CObject::AddWaypoint(DIMOUSESTATE &mstate)
    {
      long x=mstate.lx;
      long y=mstate.ly;
     
      waypoint newwaypoint;
     
      vectorx=x-prevwaypoint.x;
      vectory=y-prevwaypoint.y;
     
      length=sqrt((vectorx*vectorx)+(vectory*vectory));
     
      if (length>0)
      {  
    	newwaypoint.vx=vectorx/length;
    	newwaypoint.vy=vectory.length;
     
    	newwaypoint.eulerangle=(int)(atan2(newwaypoint.vy,newwaypoint.vx)*PI/180.0);
     
    	newwaypoint.x=lx;
    	newwaypoint.y=ly;
    	newwaypoint.next=NULL;
      }
      prevwaypoint.next=&newwaypoint;
      prevwaypoint=&newwaypoint;
    }

    Pointers might be goofed up and I haven't tested it buy you get the idea.
    Last edited by VirtualAce; 06-09-2004 at 12:07 AM.

  14. #29
    Registered User
    Join Date
    Aug 2003
    Posts
    1,205
    Ok rgr that bubba, I will try to catch you ASAP! As for the waypoints I dont have that code ready, but I do have a basic idea of how to do it but I will probably have to rewrite big parts of the moving code but it shouldnt be too hard.

    Edit: Scratch the part about not having the waypoint code, its there, its working but it aint pretty! I am really happy that I got this one working!
    Last edited by Shakti; 06-09-2004 at 08:12 AM.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do the game engine and the api interact?
    By Shadow12345 in forum Game Programming
    Replies: 9
    Last Post: 12-07-2010, 11:08 PM
  2. Open-source Game Project
    By Glorfindel in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 03-24-2009, 01:12 AM
  3. Replies: 23
    Last Post: 07-09-2007, 04:49 AM
  4. Try my game
    By LuckY in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 09-15-2004, 11:58 AM
  5. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21