Results 1 to 25 of 25

Thread: Western Game 1.0 [C++ & OpenGL & Glut & Aux]

  1. #1

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Western Game 1.0 [C++ & OpenGL & Glut & Aux]

    Disclaimer:

    I am "proud" to represent my first OpenGL application. When I say proud I must admitt that I have never finished anything that big in this little time, so there is no optimisation, and there is a whole lot of sloppy code inside. There is a lot I would have changed if I had the time, and effort. But since it is a school project, and it should have been finished 2 days ago then I have to end it here, even if I havn't used more then 12 days to learn OpenGL and do this project.

    I have had one buddy on my team. He havn't written much, but what he has written is messier then my code, it also gave me a hard time implement it with my code, and his code has some Norwegian variable names, and comments and so on. Sorry for that.

    And I am also sorry for the game play. I threw that in the last minute. It wasn't a part of the assignment.





    How to use it:
    • Mouse: Move your mouse to move the camera (FPS camera).
    • Left click: To shoot.
    • Right click: Reload.
    • Arrow keys: Move the camera back and forth, and strafe.
    • S: Turn the skybox on and off.
    • T: Turn the terrain on and off.
    • D: Turn detailed terrain on and off.
    • R: Turn rooky mode on and off (turn the time off).
    • F: Turn fantasy mode on and off (turn the cowboys into blue smilies.
    • G: Make the gamera fly or follow the ground.
    • H: Turn on and off the hud.
    • P: Pause the app.
    • Esc: Quit the app.



    How to play:

    You are the good guy. Shoot the slim cowboys that appears around the terrain. When a new guy appears you have 10sec to shoot him. Time starts when he appears, so if one appears after 3 seconds you have 10 seconds from that time to shoot him. If an other guy apperas after 5 seconds, and you havn't shot the first guy yet, then it will be the time for the first guy you will see up in the left corner, and when you have shot the first guy, it is the time for the second guy you will see up in the left corner.

    Up in the right corner, you can see how many bad guys how are left.

    In the lower left corner you can see how many bullets are left in your magazine, and in down in the right corner you can see how many bullets you have left to put in the magazine.

    You have to press quit when it says game over, or you have managed to shoot them all, and then restart the app to start again (sorry for that).





    What is done:
    • Loading BMP.
    • Loading TGA with alpha values.
    • Rendering skybox.
    • Reading height map from a BMP file.
    • Rendering a terrain.
    • Blending details into the terrain.
    • Using masking.
    • Using alphablending.
    • Rendering in both projection mode (3D), and ortho mode (2D).
    • Camera class.
    • Vector class.
    • Math class (for the shooting and the camera).
    • Mip maps.
    • Simple Target class.



    What I would have changed/added if I had better time:
    • Cleaned up the code and changed all the Norwegian to English.
    • Made you fall from big heights, so you wouldn't follow the ground that fast. Right now it looks like shaking if you run fast.
    • Extended the game play.
    • Used Alpha blending all the way in stead of masking as I did on most of the HUD.
    • Made a larger terrain.
    • Used space partitioning.
    • Added fog.
    • Made better graphics.
    • Added 3D models to shoot, and not just simple Alpha blended quads.
    • Made some AI.
    • Moving clouds.
    • More levels.
    • Diffrent weapons.
    • Made Alt + Tab possible.
    • Get rid of the horrible glut stuff.
    • Made it possible to run in fullscreen, and other screen resolutions.
    • And optimised the whole thing, like the render states (they are messy), using a vertex array with indexes.
    • And a bunch of other stuff.




    The game

    The game can be downloaded from my site, I appologize for the big file (7.31Mb), but it is a lot of BMP and some Wave files there, and they have to be there to pull this off. Enjoy the game


    Tested on:
    • dsheller: Athlon 2400 XP, ti4200 (64MB), 768MB, Win2K = 61FPS [OK]
    • Electroman: P4 3GHz, FX5900 (128MB), 1Gb DDR, WinXP = 61FPS [Failed: While shooting]
    • NoteMe: AMD 1900+ MP, 9800PRO (128Mb), 1,25Gb DDR, Win2K = 61FPS [OK]
    • Acidic: Athlon 2000, TNT2 (32Mb), 768MB, WinXP (SP1) = 15FPS [Failed: While shooting at targets]
    • Svein Rune: P4 2.2GHz, GeForce4 MX 440 (32Mb), 512MB RAM, WinXP = xFPS [OK]
    • VisualAd: AMD 750Mhz, NViDIA (32Mb), 400Mb, Win2K = xFPS [Failed: Did not support multitexturing]
    • Stian HJ: P4 2.53Ghz, 512Mb RD, Ti4600 (128Mb), WinXP = 65FPS [Failed: While shooting]



    Glut:

    We where supposed to use glut for this project. I have never used it before, and as I am a DX guy, I found it hard to work with. So the only thing it is used for is to make the window. Something that isn't hard to do by your self. After that I have tricked it (ugly hack) so I am not actualy using it after that. Not for keyboard, nor mouse, or anything else. But since it is there, you have to have glut installed. It is supposed to more or less come with never versions of Windows, but if you don't have the files on your machine you have to download my attachment. Everything in the system32 folder has to be placed in your system32 (or what ever it is called) folder (PS: don't replace the files on your machine if you have a newer version there). But if you want to compile my project you also have to add the two other folders to your compilers linker. There is also an all ready compiled version of the game in the game zip. So if you trust me, you can use that one, and don't think about the compiler settings.
    Attached Files Attached Files
    Last edited by NoteMe; Apr 13th, 2005 at 10:08 AM.

  2. #2
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Worked a couple of times but most the time it crashes when I shoot .

    Looks really good, glad to see you found a skybox that matched your terrain in the end .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  3. #3

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Weird...maybe it has to do with the sound....did any sound at all come?

  4. #4

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Debug release.

    Can you please fo me a favour. And download the the zip file here, and extract the exe, and put it in the folder where all the cpp/h/bmp/tga files are, and run it.

    Shoot ONE shot, and then press exit. Then locate the stderr.txt file, and post it here?
    Attached Files Attached Files

  5. #5

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Well I have given up on the problems on Electromans machine. Please tell me if there is more problems with computers crashing when you shoot.


    ØØ

  6. #6

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Hard to find the error here, but I think I got a stage furuther. Acidic tested it, and he has XP too, so it looks like there is something wrong on XP machines....

    In the upper left corner you can see the time tick down (only when a man is on the map) if not then it will say 10. All XP uses should check if they can shoot before there is someone there, and after someone has popped up.

    Thanks

  7. #7

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    I found a nice buddy that have been sitting with me the two last hours debuggin, and we have found out what the error is, but not why.



    The first if test here succeds. While the second one does not. At this time all Win2K users can use it with no problem, but SOME XP users have a problem with the second if test here:

    Code:
    	}else if((GetAsyncKeyState(VK_ESCAPE) & 0x8000) && timePassed > 0.4f){
    		//foo
    	}else if((GetAsyncKeyState(VK_LBUTTON) & 0x8000) && timePassed > 0.4f){

    The fix I can think of at the moment is to use Space or something for shooting in stead of left mouse button. I bet the problem is with GLUT again. I am soooo never going to use it any more.


    Will add a fix for it an other day.


    Thanks too all.
    ØØ
    Last edited by NoteMe; Nov 21st, 2004 at 09:42 PM.

  8. #8
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Strange cos whne it crashed on mine I was still able to click and hear the shots just the display didn't update. I was also able to right click and it would reload and I could continue firing while the screen was stuck.
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  9. #9

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    I know, it is realy strange. And the strangest parts is that the same call works for buttons, but not the left mouse button, and the left button calls work on some machines but not all. It is the weirdest but I have met in a long long time...

  10. #10

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: Western Game 1.0 [C++ & OpenGL & Glut & Aux]

    Found out a way to post screenshots, so I am just adding some, to those who don't have a PC that is good enough, or to those who have and XP machine it crashed on.


    ØØ




















    Last edited by NoteMe; Mar 1st, 2005 at 12:36 PM.

  11. #11

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: Western Game 1.0 [C++ & OpenGL & Glut & Aux]

    And the last one...


    Last edited by NoteMe; Feb 15th, 2005 at 12:15 PM.

  12. #12
    PowerPoster Halsafar's Avatar
    Join Date
    Jun 2004
    Location
    Saskatoon, SK
    Posts
    2,339

    Re: Western Game 1.0 [C++ & OpenGL & Glut & Aux]

    Nice screen shots! I love the sky -- I need a sky like that
    I really enjoy the game over screen.

    You are goona have to teach me how to do that quad-texturing there for the bad guys and the hand/gun I believe.

    As for your problem on XP machines.
    I experienced a problem like that -- different place and different manner but it seemed only apparent on most Xp machines...maybe all, I didn't get to try it on thousands.

    In the end it seemed the solution was solved in two places:
    I used one of the Xp machines that it would fail on and I would compile the game on that machine using the same compiler as on my machine...That exe from the broken xp machine would now work on all Xp systems.

    The second place...Well I do not know, because lately the bug has just gone away and now I only need to compile on my machine. It does not make sense though, I know where the bug occurs and I have not touched that code since my last game engine...It was a little snippet that managed to live through me ripping my old engine to pieces.

    Try that--compile on a broken xp machine.


    Well, good work NoteMe -- for only 2 people you have great job -- especially with OpenGL.
    "From what was there, and was meant to be, but not of that was faded away." - - Steve Damm

    "The polar opposite of nothingness is existance. When existance calls apon nothingness it shall return to nothingness." - - Steve Damm

    "When you do things right, people won't be sure if you did anything at all." - - God from Futurama

  13. #13
    Computer Science BS Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,339

    Re: Western Game 1.0 [C++ & OpenGL & Glut & Aux]

    noteme.com is a dead link

    So I can't download it

  14. #14
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349

    Re: Western Game 1.0 [C++ & OpenGL & Glut & Aux]

    Quote Originally Posted by Jacob Roman
    noteme.com is a dead link

    So I can't download it
    He's changing hosts at the moment, changing to the same host as me infact. But seen as thoguh his domain expired at the same time he transfered it will be down for 2 or 3 days I think.
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  15. #15

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: Western Game 1.0 [C++ & OpenGL & Glut & Aux]

    Quote Originally Posted by Halsafar
    Nice screen shots! I love the sky -- I need a sky like that
    I really enjoy the game over screen.

    You are goona have to teach me how to do that quad-texturing there for the bad guys and the hand/gun I believe.

    As for your problem on XP machines.
    I experienced a problem like that -- different place and different manner but it seemed only apparent on most Xp machines...maybe all, I didn't get to try it on thousands.

    In the end it seemed the solution was solved in two places:
    I used one of the Xp machines that it would fail on and I would compile the game on that machine using the same compiler as on my machine...That exe from the broken xp machine would now work on all Xp systems.

    The second place...Well I do not know, because lately the bug has just gone away and now I only need to compile on my machine. It does not make sense though, I know where the bug occurs and I have not touched that code since my last game engine...It was a little snippet that managed to live through me ripping my old engine to pieces.

    Try that--compile on a broken xp machine.


    Well, good work NoteMe -- for only 2 people you have great job -- especially with OpenGL.


    All the terrain and skybox textures is borrowed from Counterstrike. The HUD and the cowboys are from Outlaws, and the Game Over screen google found for me. I have tweaked all texturs to suit my needs though, and made masks for all of them, so you can see through the game over screen and so one


    The problem in the game is a conflict between XP (with some SP) and GLUT. I know a work around, but it is going to take some time to make to implement it, and I don't have that kind of time now.


    ØØ

  16. #16

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: Western Game 1.0 [C++ & OpenGL & Glut & Aux]

    Quote Originally Posted by Electroman
    He's changing hosts at the moment, changing to the same host as me infact. But seen as thoguh his domain expired at the same time he transfered it will be down for 2 or 3 days I think.


    I got an other mail this night, and told me that they will send an other one....now I have 3 mails telling me that they will send me the password and so on...


    Halsafar:
    Just saw you writing to me on MSN when I was asleep. The HUD, gun and game over screen is in Ortho mode, and the skybox and the terrain is in projection mode.



    ØØ

  17. #17
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Western Game 1.0 [C++ & OpenGL & Glut & Aux]

    Noteme, that terrain is dead cool, it reminds me of the "Incoming" (very sexy DX free-flyer from 1998) landscape.

    Nice gun/hand image (Doom anyone? )

    Sweet. Good work.

    (I haven't tried to play it because I'm busy trying to learn DX myself.) My brain if fried from thinking in 3D.
    I don't live here any more.

  18. #18

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: Western Game 1.0 [C++ & OpenGL & Glut & Aux]

    Hehehhee....thatks.......welll this was my last OpenGL assignment at school. I didn't do anything in that class before I did this "game". I used 10 days to figgure out how to use OpenGL, and to make this "game". Pretty wicked to do that in only 10 days...




    I think anyone that likes it should rate me....

  19. #19
    Hyperactive Member
    Join Date
    Jan 2003
    Location
    The Netherlands
    Posts
    386

    Re: Western Game 1.0 [C++ & OpenGL & Glut & Aux]

    It's a pity that it's not on your website anymore, because I really wanted to play it...

  20. #20

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: Western Game 1.0 [C++ & OpenGL & Glut & Aux]

    Ohhh...I am really sorry. I must have changed that URL a 10000 times now..:...well the link in the first post is corected, and for your reference, here it is again:


    PS: it is uploaded in 5min:
    http://download.noteme.com/prog/Outlaws.zip



    It isn't much of a game actualy. More like a FPS demo. There is so much more I wanted to do with the game, but I was limited to learn OpenGL and make the Demo in 10 days, and I had a lot of school and work too do at the same time.


    Hope I get the time soon to recreat it in DX, and then add everything I wanted too it.




    ØØ

  21. #21
    Hyperactive Member
    Join Date
    Jan 2003
    Location
    The Netherlands
    Posts
    386

    Re: Western Game 1.0 [C++ & OpenGL & Glut & Aux]

    How would I obtain glut and where would I put it?

    EDIT:
    Nevermind, I got it
    Last edited by Venom555; Apr 13th, 2005 at 03:38 PM.

  22. #22

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: Western Game 1.0 [C++ & OpenGL & Glut & Aux]

    Hope you got it working. Tell me if it didn't. And if you liked the game, it would be fun if you rated it..

  23. #23
    Hyperactive Member
    Join Date
    Jan 2003
    Location
    The Netherlands
    Posts
    386

    Re: Western Game 1.0 [C++ & OpenGL & Glut & Aux]

    Well when I walk around, the graphics look quite nice, but the only thing is that there is a 10 second counter up there or something and after 10 seconds, it is automatically game over, or am I just getting shot?

    I too am an XP user, and when I shoot, the game freezes and stops responding... I hear the bullet sounds, but nothing more...

  24. #24

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: Western Game 1.0 [C++ & OpenGL & Glut & Aux]

    Yeah, the counter starts when there is a villon somewhere on the map. You have to shoot him before the 10 sec is up. If not, then you die. thats the small game play I managed to make in those 10 days......not much more to it sorry.


    ANd the problem you are having is the same as the others have gotten. It is a bug with GLUT and some XP machines. No idea why. No one else figgured out either. But I know a work around. but it is about 4 hours long. And I never had the time. Might remake it in DX one day though. Shouldn't take me much more then an evening, but I havn't had the time.

    So sorry for the freeze up.

    ØØ

  25. #25

    Thread Starter
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: Western Game 1.0 [C++ & OpenGL & Glut & Aux]

    Quote Originally Posted by wossname
    Noteme, that terrain is dead cool, it reminds me of the "Incoming" (very sexy DX free-flyer from 1998) landscape.

    Nice gun/hand image (Doom anyone? )

    Sweet. Good work.

    (I haven't tried to play it because I'm busy trying to learn DX myself.) My brain if fried from thinking in 3D.

    No, DoomSharp();....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width