Thread: Awesome game Idea, need direction.

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    13

    Lightbulb Awesome game Idea, need direction.

    Hi, I'm just looking for either some help, or a place to get good help, cause these tutorials, after function, got me confused, tho I'll try again. I'm making a 2 player game, where you are at opposite ends in spaceships. You shoot at eacher and move side to side trying to dodge the other's shot. The score would be at the very bottom outa the way of the ship. Not all too complex, that is if I make it very simple graphically. I'm not all too experienced, but I have been able to make a guess the number game, then a blackjack game, then an adlib. The blackjack game I didn't use complex code, even if I probably could've. The other 2 just weren't complex at all. So help me by either actually tell me how to do certain things, give me a source code that explains everything that I need to know, point me to a tutorial or another person who can help, or another place to get the source code with all the info.

    No, I cannot go to school and figure this out, for I'm too young. I'm limited to free things, and my compiler is Dev-C++. Please help me.

  2. #2
    Banned SniperSAS's Avatar
    Join Date
    Aug 2005
    Posts
    175
    damn son that ........ sounds awesome

    anyway what graphics library would you use? if you plan to use opengl go with nehe's tutorial (just type nehe into google)

    you could use gdi but everyone around here hates that so i would say go with opengl

  3. #3
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    You might want to try the SDL: http://www.libsdl.org/
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  4. #4
    Registered User
    Join Date
    May 2006
    Posts
    13
    which tutorial do I use, and where/what do I download? I tried the tutorial that said beginner game design, and it says I need to download the file SDL-devel-1.2.8-mingw32.tar.gz and when I do, I can't open it or do anything with it, and the tutorial says "open gz archive and there should be a *.tar archive inside..." I'm lost with this. I tried opening the file with wordpad, that didn't work.

  5. #5
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    tar.gz is a type of compression file for *nix type systems, you need a decompressor to open those files. You can try WinRAR which handles a whole bunch of types of archives.

  6. #6
    Registered User
    Join Date
    May 2006
    Posts
    13
    I did have winrar, which made me wonder, but then I realized I have not yet loaded it. Thx I think I can take it from here, keep yall posted!

  7. #7
    Registered User
    Join Date
    May 2006
    Posts
    13
    I got an error while trying to compile the script that the second tutorial of "Beggining Gamer Programming" or something like that. The error goes "screen undeclared (first use this function)" I believe that means that screen wasn't declared as a variable. Same thing goes with message and background. But I don't know what to do. Should I make it a variable? Then what kind? Could it be that I have missing files, because the tutorial might have used images that I don't have.

  8. #8
    The Reel Thing
    Join Date
    Jun 2005
    Posts
    44
    Make sure you are including all the proper SDL headers, and linking with the SDL library.
    Bagpipes – putting the fun back in funeral.

  9. #9
    Registered User
    Join Date
    May 2006
    Posts
    13
    I found the problem, in the first function I forgot a piece of code. But instead I got even more clueless errors. "multiple definition of 'SDL_main'" "first defined here" "Id returned 1 exit status" "[Build Error] [SDL_Tutorial.exe]Error 1"

    I have no clue on these.

  10. #10
    Banned SniperSAS's Avatar
    Join Date
    Aug 2005
    Posts
    175
    post your code it sounds like you copy and pasted something wrong

  11. #11
    Registered User
    Join Date
    May 2006
    Posts
    13
    Code:
    //The headers
    #include "SDL/SDL.h"
    #include <string>
    
    //The attributes of the screen
    const int SCREEN_WIDTH = 640;
    const int SCREEN_HEIGHT = 480;
    const int SCREEN_BPP = 32;
    //The surfaces that will be used
    SDL_Surface *message = NULL;
    SDL_Surface *background = NULL;
    SDL_Surface *screen = NULL;
    
    SDL_Surface *load_image( std::string filename ) 
    {
        //Temporary storage for the image that's loaded
        SDL_Surface* loadedImage = NULL;
        
        //The optimized image that will be used
        SDL_Surface* optimizedImage = NULL;
            //Load the image
        loadedImage = SDL_LoadBMP( filename.c_str() );
          //If nothing went wrong in loading the image
        if( loadedImage != NULL )
        {
            //Create an optimized image
            optimizedImage = SDL_DisplayFormat( loadedImage );
            
            //Free the old image
            SDL_FreeSurface( loadedImage );
        }
           //Return the optimized image
        return optimizedImage;
    }
    void apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination )
    {
        //Make a temporary rectangle to hold the offsets
        SDL_Rect offset;
        
        //Give the offsets to the rectangle
        offset.x = x;
        offset.y = y;
           //Blit the surface
        SDL_BlitSurface( source, NULL, destination, &offset );
    }
    int main( int argc, char** args )
    {
        //Initialize all SDL subsystems
        if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 )
        {
            return 1;    
        }
        //Set up the screen
        screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE );
        //If there was in error in setting up the screen
        if( screen == NULL )
        {
            return 1;    
        }
        //Set the window caption
        SDL_WM_SetCaption( "Hello World", NULL );
        //Load the images
        message = load_image( "hello_world.bmp" );
        background = load_image( "background.bmp" );
            //Apply the background to the screen
        apply_surface( 0, 0, background, screen );
         //Apply the message to the screen
        apply_surface( 180, 140, message, screen );
        //Update the screen
        if( SDL_Flip( screen ) == -1 )
        {
            return 1;    
        }
         //Wait 2 seconds
        SDL_Delay( 2000 );
            //Free the surfaces
        SDL_FreeSurface( message );
        SDL_FreeSurface( background );
        
        //Quit SDL
        SDL_Quit();
        
        //Return
        return 0;
    }
    all copy and pasted.

  12. #12
    Banned SniperSAS's Avatar
    Join Date
    Aug 2005
    Posts
    175
    and which lines are giving you errors kind sir

  13. #13
    Registered User
    Join Date
    May 2006
    Posts
    13
    It didn't tell me which lines are wrong, just those messages, I double clicked, didn't bring me anywhere.

  14. #14
    Banned SniperSAS's Avatar
    Join Date
    Aug 2005
    Posts
    175
    even the "first defined here" thing? That is crazy wierd.

    I don't know anything about SDL so someone else will have to help you sorry

  15. #15
    Registered User
    Join Date
    May 2006
    Posts
    13
    I remember that there was this SDL.dll file that I was supposed to move to windows/system32 folder. But it wouldn't let me. I forgot the error message.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Mouse Maze Problem
    By Furbiesandbeans in forum C++ Programming
    Replies: 13
    Last Post: 04-28-2008, 04:20 PM
  2. beach bar (sims type game)
    By DrKillPatient in forum Game Programming
    Replies: 1
    Last Post: 03-06-2006, 01:32 PM
  3. Engine <=> DX/OGL | c++ ?
    By darkcloud in forum Game Programming
    Replies: 6
    Last Post: 05-13-2005, 12:19 AM
  4. i need an idea for a first major game
    By revelation437 in forum Game Programming
    Replies: 10
    Last Post: 09-26-2003, 02:32 PM
  5. My Memory Game
    By jazy921 in forum C Programming
    Replies: 0
    Last Post: 05-05-2003, 05:13 PM