Thread: My first game!!!!

  1. #31
    Registered User
    Join Date
    Feb 2002
    Posts
    27
    Just to be a bit more contsructive, try this:

    Code:
    #include <iostream.h>
    
    int loop()
    {
    	int a;
    	char b, c;
    
    	cin>> b;
    	a = int(b);
    	
    	cout<<a<<endl;
    	a<<=1;			// bitshift with 1 to left
    	cout<<a<<endl;
    	a>>=1;			// bitschift with 1 to right
    	cout<<a<<endl;
    	
    	c = char(a);
    	cout<<c<<endl;
    
    	loop();
    	return 0;
    }
    
    int main()
    {
    	loop();
    	return 0;
    }

    if for example, you type "g", that reads 103, when you bitshift 103 1 to the left, you get 206. If you bitshift 206 back 1 to the right, you get 103 again, which is "g".

    So what you do is, when saving, bitshift every character you write to the file, to the left or the right by a certain amount. In the case of a "g" you would get 206. That's what you write to the file. So you only end up with numbers. When you then load the file, you do the same thing, but in the other direction and you end up with a "g" again. May take some time, but nobody will understand what the file contains.

  2. #32
    Registered User
    Join Date
    Mar 2002
    Posts
    12
    im not sure, but it think when you pick up the old lady you don't actually get the 15 exp.... i just looked at my stats (i had 345 exp) then explored, picked up the lady, but i still only had 345 exp

  3. #33
    Registered User
    Join Date
    Mar 2002
    Posts
    12
    also... when you ask questions such as "do you wish to drink it?" (the potion) you should give a format for the answer. so it would look like "do you wish to drink it? (yes or no) " i had a problem at first trying to figure out what you wanted there.

  4. #34
    Registered User
    Join Date
    Mar 2002
    Posts
    13

    encryption

    try applying this to the save-files (youll have to modify it, though)
    #include <io.h>
    #include <fcntl.h>
    #include <iostream.h>

    void main()
    {
    int i, j = 0;
    int key_length;
    int fh_in, fh_out;
    long buffer_length;
    long bytes_read = 0, file_length;
    char in_buf[65536], out_buf[65536];
    char infile[256], outfile[256];
    char key[64] = {0};

    cout << "SRC: ";
    cin.getline(infile, 256, '\n');
    cout << "DST: ";
    cin.getline(outfile, 256, '\n');
    cout << "PSW: ";
    cin.getline(key, 64, '\n');

    fh_in = open(infile, O_BINARY | O_RDONLY);
    fh_out = open(outfile, O_BINARY | O_WRONLY | O_CREAT);

    file_length = filelength(fh_in);

    for (i = 63; i > 0; i--) if (key[i] == 0) key_length = i;

    while (!eof(fh_in))
    {
    buffer_length = file_length - bytes_read;
    if (buffer_length > 65536) buffer_length = 65536;

    read(fh_in, in_buf, buffer_length);

    for (i = 0; i < buffer_length; i++)
    {
    out_buf[i] = in_buf[i] ^ key[j];
    j++;
    if (j == key_length) j = 0;
    }

    write(fh_out, out_buf, buffer_length);

    bytes_read += buffer_length;
    }

    close(fh_in);
    close(fh_out);
    }


  5. #35
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    Fun game. Good job.
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  6. #36
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    Thanks for sharing your opinions with me people!

    I'll try and fix those bugs that you encountered...

    Oh and big thanks for showing me the encryption thing Mbrio!

  7. #37
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937
    Oh, you could think of anything. Any algorithm will do.
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  8. #38
    Registered User Paro's Avatar
    Join Date
    Feb 2002
    Posts
    160
    without indentation its kinda hard to read all of that code
    Paro

  9. #39
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    Yeah i know it became a bit large =)

  10. #40
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    hehe =) Anyone who has seen "The Matrix" knows what this is:

  11. #41
    Registered User Paro's Avatar
    Join Date
    Feb 2002
    Posts
    160
    haha that matrix thing is cool...couldnt you make it so it loops instead of running one time?
    Paro

  12. #42
    Registered User Paro's Avatar
    Join Date
    Feb 2002
    Posts
    160
    it says it cant find a few of the header files:

    conio.c

    and others...what do i do?
    Paro

  13. #43
    Anonymous
    Guest
    So when is the next update going to be? I found the game to be quite fun

  14. #44
    Registered User blackwyvern's Avatar
    Join Date
    Jan 2002
    Posts
    60

    next thing you need to do for your game

    Make a map of the area and display it on the screen in a simple form.

  15. #45
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    Hey Paro: I'm using Dev C++ which has its own headers and i have also made my own header so you wont be able to compile it.

    And to blackwyvern: That sounds hard =(

    btw 500+ views!!!!

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-08-2010, 12:08 AM
  2. 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
  3. game engine advice?
    By stien in forum Game Programming
    Replies: 0
    Last Post: 01-23-2007, 03:46 PM
  4. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM