Need help with saving data

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • For my online game I want an account to be created (in the form of an ini++) when the user logs in for the first time. I got this to work. However, if a second person logs in it will not save their data, only the first person.

    My code:

    Start of frame --> Send "1" to server on subchannel 2

    Serverside:
    "1" is received, PeerID of player = PeerID of lacewing --> Save INI to file


    I came up with the conclusion that each INI++ object can only save 1 file. Is this right or wrong? How can it be fixed?

  • If you only have this one action serverside then the client will always return the same id thus overwriting the current ini.

    What I would do is this:
    --> Save INI to file (Filename: peername.ini)

    This would then create an ini file based upon the peer's name which would be more unique than peer ID. I hope I understood your post correctly and this is helpful, if not let me know...

    Game Launcher Creator V3 - Please login to see this link.
    Bespoke Software Development - Please login to see this link.
    Learn Clickteam Fusion 2.5 - Please login to see this link.

    Danny // Clickteam

  • Why use more than one file instead of groups?

    Set Item "Userpassword" in Group "Client_Name$( "Lacewing Relay Server" )" to received text.

    The Ini file will look like this:

    [peername]
    Userpassword=whatever
    [anotherpeername]
    Userpassword=whatever

    Or am i completely missing the point?

  • blub, I think it's jut preferable to save each user's data into their own file... It makes more sense because you won't have a gigantic single file representing all users, and if you need to review/modify a user's data, it's super easy to just locate their file and modify only that instead of having to modify the giant file that contains every person's data. I'm pretty sure he means he wants to save all of the user's data to these files... like health or score or stats or whatever... So having a hundred lines of text for each player in a single text file would be unwise.

    Hydra, I think you just need to make sure you're setting to the right INI file when you save/load data. Also you should definitely be saving the INI file as the account name for the player, as ByteDex suggested.

    I've set up a user login/account system using Lacewing already and this is how I did it. Basically the user creates a username/password which is then created in a mysql database. When the user logs in, I'm using Get object to actually retrieve the database info to make sure the password and such is accurate. Then it uses that username that was accepted as the account username for that person, and will then access the proper accountname.ini file from the server for that specific user.

    You have to just make sure that you are pointing toward the right INI file whenever you are saving/loading user data... otherwise it's using whatever ini file was initially set. (in this case, the first player that logged in)

    Please login to see this link.

    My examples:
    Please login to see this link.
    Please login to see this link.
    Please login to see this link.

  • Konidias, that is EXACTLY what i'm doing. I have the username and password stored securely in a MYSQL database. But I find MYSQL difficult and would rather store information such as health and points (stuff that requires less security) into INI files. Yes, I have made it so when the server needs to create a file, it creates a file called "PEERNAME".ini in a folder called "User Info". Because I did figure it would be easier storing all information into separate files instead of one big file. But the problem is, the server will only save one file.

    Im using this code: Please login to see this attachment.

    I know im a complete noob, but i cant figure out this lacewing server extension. When I host on port 6121, clients cannot connect. I dont know how to fix this. For now, clients automatically have global value A set to 0 while my application is always set to 1. Therefore, all server operations occur when that value is 1. I know, bad idea. But hopefully i'll find an example that will explain how to set up a custom server using mmf2.

  • Quote


    I know im a complete noob, but i cant figure out this lacewing server extension. When I host on port 6121, clients cannot connect.


    You have to open/forward the port on your router.

    And your attachment doesn't work.
    "Invalid Attachment specified. If you followed a valid link, please notify the administrator"

    Can you reupload it?

    Edited 2 times, last by blub (July 4, 2012 at 9:39 AM).

  • If you are familiar with using SQL, it better better to save everything into a sql database. If not you can still use the ini object:

    The Problem: As you are writing to the ini object, it is an use when another player saves their data.

    Solution:

    Objects You Need: String Parser, list box

    (Not all the actions are by exact expression name

    On the client end:

    1. Start of frame ------> Send "1" + "-" + "LaceWingSelfName"

    (1 would be you data. "-" would be your parsing character for the string parser object. The lacewing Self Name, is the name you have chosen in lacewing for your player

    Server Side:

    1. On text received on subchannel - Insert line 'LaceWing Text Received' from line -1)

    (You want it to insert into line -1 at the end. We are creating a que list.

    2. If Number of Lines of List Box is Greater than 0 - Set current line to 1 / Set Delimiter to "-" / Set Source String to Current Line / Delete Current Line, Set Global Value A to 1
    Global Value A = 0

    3. If Global Value A = 1 - Set Group "Data" Set Item to "Element 2 of string parser" / Set String to "Element 1 of string parser" / Save ini / Set global value to 0

    The list box on the server will keep a constant que, any lines collected in it will handled when the lines in the list box are greater than 0.

    Global value A of 1 will take that information and save it to your ini object, at a one at a time basis.

    If you use a fast loop, the que will be emptied in no time.

    -Mike

  • MikeB, Lacewing already queues messages, so your solution is not necessary at all. :p

    If 5 people save at the same time, Lacewing would save each person's data one at a time over 5 game loops.

    This definitely just sounds like an issue of the INI++ file not being set properly to each player's account name when saving data. I'd be happy to take a look at the file if it was re-attached.

    edit: also saving everything to SQL is not practical in most online game situations. SQL databases aren't the fastest things in the world, you know :p

    Please login to see this link.

    My examples:
    Please login to see this link.
    Please login to see this link.
    Please login to see this link.

    Edited once, last by Konidias (July 5, 2012 at 8:36 PM).

  • Thanks Konidias, for trying to help.
    Please login to see this link. ok i put it on tinypic.

    If you want my entire MMF2 application id be happy to give it to you.

    Again, this code works with saving the file. But the problem is that it will only work one time. After I start another application, no more INI's are saved.

  • Do you have the server sending data to itself? Shouldn't the client send stuff be in the client app?

    Please login to see this link.

    My examples:
    Please login to see this link.
    Please login to see this link.
    Please login to see this link.

  • I know this is very confusing. First of all, I am able to connect to myself and have others connect remotely. The problem is, I have not figured out how to make a custom "Lacewing Relay Server". I followed Dizzy's guide. His guide only covered how to have each user host a server on their own computer. Sooo... I am in a sense, right now, hosting a server by opening the lacewing.exe and then opening my MMF2 application and opening a channel. Im continually trying to create a custom Relay server but am having trouble with that. I dont know if setting up a relay server is incumbent for this INI problem to work but i wouldnt think so, as it works somewhat correctly as of now.

    Back to this, the server is identified by GLOBAL VALUE A (1 = server, 0 = user) so when the user sends a message to his peers, the server, which is a peer and has Global value A = 1, will be the only application handling this message.

    Probably the dumbest person alive. But I just cannot get this relay server working. I just updated lacewing to build 20, as i learned that i had build 17 from that guide i followed. Now, most of my lacewing commands are messed up and not working the same. I have pressed further with my success on creating a relay server, but am not there yet.

  • Oh I see, so the client/server is the same app, just one is dedicated to hosting while the others connect... Right.

    I'd have to actually look at the app to help out, I think.

    INI++ can definitely save multiple INI files, so fear not. This is fixable. :)

    Please login to see this link.

    My examples:
    Please login to see this link.
    Please login to see this link.
    Please login to see this link.

  • I actually figured the whole thing out. I guess i needed a relay server to save multiple INIs. I got it to save just fine, but i have a small question now:

    How do i load data? For example when a user needs his data retrieved....

    This is my idea:
    Start of frame send "1" to server

    Server receives "1" ->> load data under file "peername"
    -Send data back to "peer"

    But i cant get the specifics correct. Could anyone possibly walk me through exactly how to load a specific user's name?

  • What you described is pretty much how it's done. Just walk through the steps and test each bit... First see if the server receives the message, then test if the server is loading the data from the proper peer name, then see if the server is sending the data to the player, then you can figure out if the data is correct.

    It's just:

    1. player tells server "hey I'm here, send me info"
    2. server receives message, grabs the info, sends it to player
    3. player receives
    4. profit!

    Please login to see this link.

    My examples:
    Please login to see this link.
    Please login to see this link.
    Please login to see this link.

  • i think i got it after a lot of trial and error! im going to post my method for others to see in case they have the same problem and also to see if it's an efficient way to do it!

    Client:
    Start of frame ---> (Send number 3 to server on subchannel 2), (Send text "self name" to server subchannel 2)

    Server:
    On number message to server SC 2, on text message to server SC 2, server received number 3 --> (send number get item value of INI to client on subchannel 2) , (Appdir$+"\User Info\"+Client_Name$( "Lacewing Server" )+".ini") (load file, keep old data, keep path name)

    Client:
    Received number greater than 0, on number message from server on SC 2, run event once when loops --> (set counter to received lacewing number)
    every 3 seconds --> (Send number value of counter to server on subchannel 3), (Send text "self name" to server subchannel 3)

    Server:
    On number message subchannel 3 to server, on text message subchannel 3 to server -> (load file, keep path, keep data) (set value to number received)

    phew that took a while. anyway i have one more question:
    How do i send multiple numbers at once? would i somehow use the string tokenizer or something? im gonna take a look at an example of the string tokenizer but that is my plan of action! thanks for the generous help my friends!

  • To send multiple numbers you can just add them to a stack and blast it.

    On the other end you'd get them by their index. Again, you'll want to watch DizzyDoo's video on stack messages to understand what's going on with them.

    Please login to see this link.

    My examples:
    Please login to see this link.
    Please login to see this link.
    Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!