Thread: My finished game! yay!

  1. #1
    Registered User JTtheCPPgod's Avatar
    Join Date
    Dec 2001
    Posts
    44

    My finished game! yay!

    Yay, i finished my battleship game!
    awhile ago someone said the partial code looked interesting and i should post it when i finished... so i am...

    see atachment for the cpp file. Oh and while i doubt anyone will wanna steal this (or learn from it, now that i think about it... whatever) please dont take credit for this, it has caused me many sleepless nights working on it.
    "No! I must have my delicious cupcakes, my sweet cakey treasures, piping hot from their 40 watt WOMB!!!"
    --Captain Murphy

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    hrm, interesting user name

    If this is you first game then you've done very well!!

    It's just a little unrealistic when the computer takes his turn. Usually, if a human hits one of their opponents ships, theyll continue to shoot around the same area until the ship is sunk, whereas your "Mr. CPU" just continues to fire randomly.... how about you put a little bit of AI in there to tell it to continue firing in the same area until the ship has been sunk, then go back to random shots or something like that??

    You could go one step further and get it to fire shots into open spaces rather than in the middle of a bunch of misses!!

    just a couple of suggestions.

    good luck
    U.
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

  3. #3
    Registered User JTtheCPPgod's Avatar
    Join Date
    Dec 2001
    Posts
    44
    Yea, it is my first game really...
    I know the AI sucks, but this was my programming final and I had just finished debugging my ultra buggy computer placement and i wasnt too worried about AI... Once I finish the snake game a friend of mine and I are working on, I might come back to this...
    Ill post the snake game too.
    "No! I must have my delicious cupcakes, my sweet cakey treasures, piping hot from their 40 watt WOMB!!!"
    --Captain Murphy

  4. #4
    Registered User
    Join Date
    Jan 2002
    Posts
    27
    Krusier is spelled Cruiser

    great game


    Though i had to comment these to lines to compile it:

    Code:
    --------------------Configuration: battleshipv3 - Win32 Debug--------------------
    Compiling...
    battleshipv3.cpp
    C:\Downloads\battleshipv3.cpp(694) : warning C4129: 's' : unrecognized character escape sequence
    C:\Downloads\battleshipv3.cpp(695) : warning C4129: 's' : unrecognized character escape sequence
    Linking...
    
    battleshipv3.exe - 0 error(s), 2 warning(s)

  5. #5
    Registered User
    Join Date
    Nov 2001
    Posts
    162
    Just add another '\' like this:

    outfile.open("C:\\scores.txt", ios::app);

  6. #6
    Man, DJGPP don't have windows.h, I'll have to re-install Dev-C++ to run Battleship.

  7. #7
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Originally posted by Crossbow
    Just add another '\' like this:

    outfile.open("C:\\scores.txt", ios::app);
    That way is cool in all, but if you want to be as lazy...I mean time efficient as possible, type it this way:
    Code:
    outfile.open("c:/scores.txt", ios::app);
    Windows is okay with either way.

  8. #8
    Registered User JTtheCPPgod's Avatar
    Join Date
    Dec 2001
    Posts
    44
    Originally posted by Hydro
    Krusier is spelled Cruiser
    Yea, I know, but Carrier also uses a C, so i figured having a "Kruiser" would eliminate confusion... Especially cos I use the first letter of the ship name to represent it on the board.

    You can still compile with warnings and I ran outta time to figure out why it didn't work.

  9. #9
    Registered User
    Join Date
    Feb 2002
    Posts
    1

    Unhappy

    Um, I'm using Dev-C++ 4 and whn i insert the code, and press compile, it comes up with a dos window saying "63" and the closes.

    I am quite new to C++.

  10. #10
    Registered User JTtheCPPgod's Avatar
    Join Date
    Dec 2001
    Posts
    44
    Originally posted by JTtheCPPgod

    You can still compile with warnings and I ran outta time to figure out why it didn't work.
    I take that back... (my friend in programming class actually wrote it, but whatever) When you put in a path like c:\scores.txt, c++ looks at the forward slash and thinks its some sort of command like \n. it checks the next character and finds out that its not valid as any sort of command, so it decides to ignore the fact that it thought it was a command in the first place. Doesnt hurt anything.
    "No! I must have my delicious cupcakes, my sweet cakey treasures, piping hot from their 40 watt WOMB!!!"
    --Captain Murphy

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Open Source / Semi Open source game idea. Help needed
    By CaptainPatent in forum Projects and Job Recruitment
    Replies: 10
    Last Post: 05-16-2007, 10:44 AM
  2. PC Game project requires c++ programmers
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 02-22-2006, 12:23 AM
  3. Engine <=> DX/OGL | c++ ?
    By darkcloud in forum Game Programming
    Replies: 6
    Last Post: 05-13-2005, 12:19 AM
  4. Game Designer vs Game Programmer
    By the dead tree in forum Game Programming
    Replies: 8
    Last Post: 04-28-2005, 09:17 PM
  5. finished my game, finally
    By agerealm in forum Game Programming
    Replies: 15
    Last Post: 10-12-2001, 08:01 AM