Register
Email: Password:
Forum » Vacuus: Dying, living, or dead?
  • « previous
  • 1
  • 2
  • 3
  • » next
  • Vacuus: Dying, living, or dead?

    Vacuus 11 years ago
    Hello!
    I recently started to learn the basics of c++, and have decided to make a game. Vaccus is the Latin word for empty, or devoid and since my game will be a space simulator, I thought it would be a suitable title. Unfortuantly, my programming skills aren't currently good enough to enable me to add graphics to it. This is my largest project yet, and may take me some time to complete.

    If any one knows of any good, fast free web hosts with atleast 50mb of space, feel free to PM me.

    Oh, and does any one know the code to make the program read values from a previously exported file and set some values according to what is read?

    [EDIT 19.01.06]
    Finaly! A demo! You can download it here. More info can be found on the last post.
    #
    The Gemini 11 years ago
    Sounds great Vaacus, keep it up!

    (I don't know the answer to your question)
    #
    void 11 years ago
    Are you talking about importing values to the game through like a .txt or .dat file? If so it would look something like this I think:


    //opens the file to be read

    ifstream in("somefile");

    //then you do something like this

    in >> variable_to_hold_some_value;

    //then close the file

    in.close();


    You should google for 'C++ file i/o' . As for the webspace I don't really know... there are so many it's hard to tell what's good.
    #
    Grim Reaper 11 years ago
    I PMed Vacuus a couple of sites.
    #
    Vacuus 11 years ago
    Thank you for the host, Grim. My new site can now be found at
    http://vacuus.hostrim.com. Also, I was reading up on arrays in my out-dated C++ book, and had trouble understanding the following code:

    void  concatstring(char szTarget[], char szSource[])
    {
    int target index=0;
    while(szTarget[targetindex])
    {
    targetindex++;
    }
    int sourceindex=0;
    while(szsource[sourceindex])
    {
    sztarget[targetindex]=szsource[sourceindex];
    targetindex++;
    sourceindex++
    }
    sztarget[targetindex]='\0';
    }


    That code is supposed to 'concatenate' 2 strings (thats just the function) and add a - in between.
    Anyone know how this works?

    NOTE: Bata almost ready for release (wont include all features yet)

    EDIT: Some Help is required, due to my dodgy programming skills, this time its with functions. So if you could kindly go to http://vacuus.hostrim.com/source01.html and try to sort through my ridiculous code, (thought I should tell you this, all '\' have been removed from the source for some strange reason), I would be very grateful.
    #
    void 11 years ago
    YAY for Vacuus! Will be fun going though your code and helping you out. I'll answer your questions, if I can, after I've gone through your code.

    EDIT: ok I think I can help with the concat string after a little googling.

    Okay we'll pretend that we are passing the following information to the function:

    concatstring("jelly", "fish"); 


    Now here is what concatstring does with that:



    //turns the two incoming values into szTarget[] and szSource[]

    void concatstring(char szTarget[], char szSource[])
    {

    //now it makes the size of the szTarget array equal to target index //which starts off at zero.

    int targetindex=0;
    while(szTarget[targetindex])
    {
    targetindex++;
    }

    //after this little code block targetindex will hold the size of the //value we sent to szTarget +1, so targetindex = 6

    //Now this takes sztarget[targetindex] which is the end of "jelly" //and adds szsource[sourceindex] from it's start until it has got to the end, in this case it will stop just after "fish"

    int sourceindex=0;
    while(szsource[sourceindex])
    {
    sztarget[targetindex]=szsource[sourceindex];
    targetindex++;
    sourceindex++
    }
    sztarget[targetindex]='\0'; //some null termination thing :D
    }



    So if you wanted to put a "-" in between to strings you would just do something like this:

    concatstring(strFirst, "-");


    then you would do this

    concat(strFirst, strSecond);


    Did I explaing it well? This is the page I found it on
    http://forums.devarticles.com/t9471/s.html


    I'll get back to you on your game's source. Do you understand it now?
    #
    Zombie 11 years ago
    I wish I could be a programmy-ness person like all of you... *sniff*
    #
    void 11 years ago
    You can Zombie! This all looks scary but it starts alot easier. Give into your hate and join us. I sense a plot to destroy the jedi! THESE ARN'T THE DROIDS YOU'RE LOOKING FOR!!! LUKE, I AM YOUR FATHER!!!!!!!
    *fizzle*
    *explode*
    ........ . .
    ........ . ..
    ..... ... .
    ..
    .
    .

    Come on Zombie you'll never learn if you give up before you start.
    #
    Vacuus 11 years ago
    Did I explaing it well? This is the page I found it on

    Yes, yes you did! thank you for your help Void, without you I would of been completly lost, and probaly would of called off learning C++ for another 6 months.

    Also, Zombie, C++ isnt as hard as you, think, you just have to take your time with it ( I took almost 1 year to get where I am now, although I did stop for several months in that time), most of the stuff I learnt can be found @ cprogramming.com.

    Also Void, that I/O stuff you told me helped alot, however the in>> function would read the entire file, wouldn't it? or would it read to a space?

    Thank you for your help..
    #
    void 11 years ago
    "Vacuus" said:
    Yes, yes you did! thank you for your help Void, without you I would of been completly lost, and probaly would of called off learning C++ for another 6 months.

    Glad I could help .

    "Vacuus" said:
    Also Void, that I/O stuff you told me helped alot, however the in>> function would read the entire file, wouldn't it? or would it read to a space?

    ummm... I haven't really played around with it. I don't think it would read the whole file but I could be mistaken, just make a little app and test it out.. I'll do the same when I have some time.
    #
    Amarth 11 years ago
    "void" said:
    "Vacuus" said:

    "Vacuus" said:
    Also Void, that I/O stuff you told me helped alot, however the in>> function would read the entire file, wouldn't it? or would it read to a space?

    ummm... I haven't really played around with it. I don't think it would read the whole file but I could be mistaken, just make a little app and test it out.. I'll do the same when I have some time.

    AFAIK it reads until the next newline char (that is the '\n'). There are ways to get individual words etc... But I never quite got C++ file i/o. I never really needed it, neither .

    Anyway, if you have questions, and void can't help, perhaps I could... But not always shure about that, of course . Cool to have a new programmer here, welcome, and don't stop too soon .

    -Amarth
    #
    NeoGangster 11 years ago
    yes, yes...more...more...muahahaha
    more programmers ^^

    C++ isn't really hard to learn Zombie
    it's even easier if you have someone who can help you
    Zombie...it is your destiny to learn C++
    and Zombie use the C++ but watch out it has a darkside...

    btw if void and amarth can't help, you can expect help from me too ^^

    you can use too "ifs" for the input
    it reads until a space
    #
    Vacuus 11 years ago
    Hello again, everyone!
    I've fixed all of the errors on the source code page.
    Turns out that the prace, pship etc strings, were intialized in a local scope, that is they can only be accessed in that 1 function.
    To fix this all i had to do was add all of the local strings below the #include command, to give them a permenant block of memory.

    Insted, I could've added the location (in the memory) of these strings, to the heap to achieve the same effect.

    Sorry for wasting your time.'

    Also, I'm currently trying to work out how to store the player position. I was thinking of creating 2 ints (X, Y) and have them change according to what the player types. Would this work?
    Also, I was going to store a planets location in an array, so to read it could I use a pointer?

    Again thank you for your help
    #
    ville 11 years ago
    So you're doing a text adventure? Are you going to make a parser into it? Like you could say: "use computer".
    #
    Vacuus 11 years ago
    Like I said before, I have no idea on how to add graphics to C++, apart from go to 32bits.co.uk and read there tutorials(which I dont want to do just yet).

    Also, I will probaly eventually add a 'parser' to Vacuus, by eventually I mean "as soon as i finish the current version".

    Currently, the game is menu based, and supports a limited number of options.

    If you want a space simulator, probaly better than Vacuus will ever be you can find Noctis @ http://anywhere.i.am
    (Simply click on the Noctis link at the top)

    EDIT- Almost forgot, since Im not smart enough to run my own forum, I will be offering a Mod position to the first 5 people that join my forum and send me there monkkonen.net username. (Only if I can figure out how). The forum can be found @ http://vacuus.forumer.com


    -Vacuus
    #
    Amarth 11 years ago
    About the position...

    Most text-adventures only use one number (-> one coordinate) for a location, as in 'room number 35' being 'the outside of the saloon' or something. You could use 2-dimensional coordinates if you're sure it will be helpful, I mean, if you're sure you have a 2D map, or the map is easier to represent using 2D coordinates. You could, of course also use 3D or 4D coordinates... But that would be for complex maps .

    A space simulator... Don't know what to think about that . If it's realistic, you'd need 3D-coordinates. If it's more text-adventure-like, you'd need 1D-coor. But you'll need to see yourself.

    Lemme explain like this: if the player can move up and down and left and right, independant from where he is, you'll need 2D-coordinates. If he can only move to preset positions, 1D will do. If he can move up, down, left, right, forward and backward from almost any position, you'll need 3D coordinates. If he can jump in time, you'll need 4D coordinates .

    [EDIT]
    I started checking the source... 2D-coordinates will be the way to go, indeed. Be prepared for a lot of empty space, though .

    Will this be purely about exploration, or will it have some sort of story?

    -Amarth
    #
    Vacuus 11 years ago
    Vacuus will mainly be about exploration for the moment, however I might add a couple of 'quests' later on.

    Feel free to post any suggestions on my code though.

    Thx for your advice & interest

    EDIT: Also I think I will make the mGame() function a seperate module, to make it easier when I start adding ASCII graphics (when I figure out how) etc,.

    EDIT: Dont forget to join my forums! (http://vacuus.forumer.com) Im starting to feel a bit stupid constintly refreshing my forums page, only to find Im the only one online
    #
    Vacuus 11 years ago
    Now i'mm really stuck with this player postion thing.
    I've created a pointer that points to a pacific location in a 2d array.
    Now what I want to do is let the player input 1 number , which will then change what ever the pointer was pointing in 1 dimension of the array. Does anyone know how to do that, or would I need 2 pointers?

    The source can be found @ http://vacuus.hostrim.com/source_mgame.html
    (not layed out properly, but I can be bothered going through it and adding 1000 <br>'s)

    Thank you for your interest.
    #
    Zombie 11 years ago
    I just had an awesome idea...

    Vacuus... Would you mind trying to make a space 4X out of the base workings of your text sim? Seriously, I just had a killer idea for a space strategy game that would work quite well in a text-based environment... Or a semi-graphical environment... Graphical menus and whatnot, text map.

    E-mail or PM me, Vacuus, any time you need ideas or planning help for any games you make...

    I may suck at programming, but I have crazy ideas!

    Ooh! And another one!
    #
    Amarth 11 years ago
    Let's discuss on your message board, seems more appropriate .

    But I need to leave now, expect a message in a couple of hours on the board...

    -Amarth
    #
    void 11 years ago
    I've joined under the name Terminal.
    #
    Grim Reaper 11 years ago
    I have joined under the name "Grimsy".
    #
    MageKing17 11 years ago
    Joined as... well, "MageKing17."
    #
    Vacuus 11 years ago
    Well, I've finaly finished the text version. Only problem is, I get a heap or error messages that I dont understand when compiling, so if you want to help, go here

    Right now I'm working on the ASCII version, which will take place in a randomly generated world.
    I've got one questionthough, is it possible to copy a matrix? (2D array)
    As I would like my game to have an unlimited area to explore, but I'm uncertain how to achieve this.

    Thank you in advance.
    #
    Casanova 11 years ago
    You can copy arrays by using memcpy. it works like this:
    memcpy( new_array , original_array , bytes_to_copy ) ;

    Note that each array needs to be declared beforehand and be the same size. If the array being copied is larger than the one receiving the data, the program will crash.
    #
    Vacuus 11 years ago
    Thank you, however how many bites should I copy? 512? (size of the array).

    Again, thanks for your help everyone!
    #
    Casanova 11 years ago
    You need to copy the same number of bytes as there are entries on the array. So if its 20x20, then you copy 400 bytes.

    Do you want the sourcode for my ascii game and map loader? Maybe you could use some of the functions I used to load 2D arrays into a map screen.
    #
    Vacuus 11 years ago
    Hey yeah, that would be good thanks!

    You can either PM them to me, or, email them to <!-- e --><a href="mailto:Nebbuchadnezzar@dodo.com.au">Nebbuchadnezzar@dodo.com.au</a><!-- e -->

    Also, do you have any problems with Dev C++? I was getting a bunch of stupide errors, until I switched to MingW Dev. Studio (Dev C++ is based on that.)
    #
    Casanova 11 years ago
    Check your PM box in a few minutes.

    And yes, I am using Dev C++.
    #
    Vacuus 11 years ago
    Thanks, Casanova!

    Well, I've decided to create a ASCII text file reader, called "Map Scripter" (I should change that name, no?), which will allow me to easily modify my game, not to mention allow others to do the same.

    It actually looks pretty easy to read files!
    If you dont believe me, try this link.
    #
    Amarth 11 years ago
    "Casanova" said:
    You need to copy the same number of bytes as there are entries on the array. So if its 20x20, then you copy 400 bytes.
    I'm not very sure. You need to copy as much bytes as the array spans, that is, number of entries * memory per entry. For an ascii-array, those values are the same (as in, sizeof(char)=1), for most other arrays, it is not. Use the sizeof()-function. It returns the amount of memory one instance of a data-structure takes.

    -Amarth
    #
    eddeshun 11 years ago
    I will repeat what zombie said first page:

    I wish I could be a programmy-ness person like all of you... *sniff* Crying or Very sad

    I do have a lot of graphical arts skill, no hand-drawn skill, though. If you manage to add graphics, I want to help.
    #
    Vacuus 11 years ago
    I would realy like your help Eddeshun, as I'm a terrible artist at the best of times.

    I'll let you know when I need graphics.

    Thank you!
    #
    Casanova 11 years ago
    One piece of advice I can give you is that maybe you should not include the iostream library with your game. You could use <sdtlib.h> and <stdio.h> instead and save 450kb of space after compiling it. I did that and my game went from 500 to 25kb in size, and it compiles a lot faster too

    Also, why are there so many "&nbs p;" in your source code? Were these added when you put the code into the html file?
    #
    Vacuus 11 years ago
    The only reason there are so many "&nbs p;" s in the source is because of this code actually adds one blank space, however my internet connection crashed when I uploaded the file, and I havent had a chance of re-uploading it.

    [EDIT]
    I've re-uploaded, and still lots of nbsp's.
    So I've had it with this host, first of all, they tried to put add banners on my site without even telling me.
    #
    Forum » Vacuus: Dying, living, or dead?
  • « previous
  • 1
  • 2
  • 3
  • » next
  • Post Reply


    Your email:
    Your name: