username / profiles

This forum is currently in read-only mode.
  • Hello,

    I will start develop a new casual game soon. I have finished small game project last year, but still I consider myself as a beginner to game developing...

    Now I am trying to solve this problem. Most of casual games has this option - if you start the game, you can change your profile (so game can be played by more players and saves are made under their usernames)...

    Have you got an idea, how to make this thing in construct classic?

  • You need to be a bit more specific with your requirement there.

    But if it's just a game to be played on one computer only, then I will simply write all of the user information into files.

    When you double-click on any layout, you see Data & Files section? You can use Binary object to write data into the files on your computer.

  • thanks,

    i can see data and files section and binary object. I think also ini can be good solution for saving informations(but i am not sure about that), am I right?

    this username/profile thing looks very complicated and complex to me. i dont know where to start... but i need something like almost every casual game have

  • i am trying to make a profiles step by step...

    now i am stucked with this thing-

    i am using "edit box" for writing text for player name,

    then i am trying to use "ini" for saving this information. so if application loads again i want to have this player name loaded.

    i know it is propably very simple, but still i dont know how to do it :(

  • ok, i tried many and many times and now i have something what seems starting to work.

    but still there are problems i dont know how to solve.

    here is cap: datafilehost.com/download-6fc95f6c.html

    when i write text in the box i want to save it on file. and when program is starting again i want to load this text again.

    it works, but there is not only this text, but also strange marks. can someone help what it is wrong in it?

    thanks

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If you want to save other things too, dont use the text manipulator object, it doesnt designed to this kind of job.

    You can use the hashtable, array, binary, ini or the file object(or python of course.)

    I don't know much about the binary object, so I won't suggest to use that(but this isnt mean its not perferct for your problem.) I usually using the array and\or the hashtable, lets just say you want to save the player's name and the current level(if the game isnt linear it's a bit more complicated, but you can figure it out if you get the main idea.)

    So, the hashtable. It's working with "keys" and "values", this means you can save variables under named strings, like "player1name"(key) - "joxer"(value). In the profile menu you can get the profile names like this(if you have 10 profiles for example - of course you don't know how many profiles will be on the player's computer, but you can limit it):

    + System: For "profile_names" from 1 to 10

    -> Text: Set text to Text.Text + NewLine + HashTable ("player" + str(LoopIndex) + "name")

    Now you have every user name. You can save the data the same way, just use an another key. "player1level" - 5, from this you will know that player1 is completed the first 5 level, and so on.

    If you don't understand how the event works:

    System: For "profile_names" from 1 to 10   - this will start a loop 10 times

    Text: Set text to Text.Text   - you have to check the existing data, or you will only see the last one

    NewLine    - this one just adds a new line to the end

    HashTable ("player" + str(LoopIndex) + "name")   - the syntax of getting a value from the hash is this: hash's_name(key_name), we know that the our usernames are in this format: "player" - slot number - "name", so we'll looping through every possible solution(from 1 to 10), and check it's value.

    str(LoopIndex) - the LoopIndex function return the value of how many times the current loop was executed, at the first time it'll return 1, second time 2, and so on, but it's returning a numeric expression, so we have to convert it to string with the str() function.

    Sorry about my terrible english, I hope you can understand me more or less.:)

  • your english is good, but my understanding of hashtable is really bad :( i have read tulamide�s tutorial many times, but still dont understand how to use it.

    do you think you can make a cap for me with this "profile" saves? i am trying and trying and cant reach anything that works :(

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)