Zakeru's Recent Forum Activity

  • Hello,

    I am working on a little "game" that I'll use for my research on Japanese language. This "game" takes the form of a survey in which Japanese speaker will create abbreviations of pairs of loanwords.

    I made a draft of the game that works pretty well (even though it may not be very elegant. I'm still a beginner at programming).

    The thing is, I'm going to upload it to a server (from the lab where I work) and of course I want to collect the answers of the participants on the server. Basically, all the data I need is in the .csv file the browser download at the end of the game. So I need to get that .csv file to be saved on the server instead of the user's computer. I thought the AJAX object might help, but it seems more complicated than I expected. So I'm asking for your help on that.

    Here is the .capx. Note that I used the BHT smart random plugin :

    drive.google.com/open

    Another, less important question :

    The abbreviations I am studying are made of two words (or "constituants", hereafter C1 and C2). In the draft, I only included 8 C1s and 2 sets of 8 C2s. Thus, you can see 24 text instances with different instance variables on the main layout, but outside the window. In the final version, I will have 120 C1s and 2 sets of 120C2s. All the informations about those C1s/C2s are all ready in a Excel file. So I would like to know if there is any way not to create manually each instance of text, or even not using text instances at all. Basically my question is "do you know an elegant way to put all informations on my C1s/C2s in the game" ?

    Anyway, it's not gonna take too much time to do it manually, so my question is more about learning new stuff than anything.

  • Hum, for once it sounds more complicated than I would have expected.

    I would have thought that the AJAX object could post a file to a URL in some way...

    Guess I'll have to look deeper into that ! Thanks.

  • Yes that works ! Thanks ! I found that solution too, but I couldn't edit my post for some reason...

    Anyway. What you say about creating files without user interaction is very interesting for another project. But I'll ask my question pretending I am going to use my Japanese verb generator instead :

    What if I want to do an online survey? I export my program as HTML5 and upload it to a server, and in the end I want the .csv file to be saved on the server, and not on the user's computer. Can I do that ? The solution you described seems to be NW.js specific. So it wouldn't work on a server, right ? But I am sure construct 2 has a way to do it :D

  • It works ! But the Japanese characters won't appear. I get weird symbols instead... any idea why :D ?

    By the way, I had no idea you could create all kinds of files with construct 2. That's really good to know !

  • Oh ok.

    Indeed, I don't need to load them back. I'm directly using the data in the dictionaries for my research. In short, this program helps me to create stimuli for a linguistic experiment, all I need in the end is an excel file with the list of verbs I created and their inflections.

    So now I just download them separately, open them in firefox and copy/paste in excel. That works just fine even if that may not be the most convenient way to do it.

    So thank you very much for your help !

  • Oh yeah !! It worked ! Thanks a lot !

    However, I did not manage to get everything into one file. As you said, it would be a lot more convenient. Actually I can get the file as JSON but when I try to open it on Firefox I get this error message :

    "SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data at line 2 column 1 of the JSON data"

    The problem appears only when I try to combine several dictionaries. It works fine if I download them one by one, which is already great.

    Here is the new .capx, the file that does not work for me is the "FullList.json" :

    drive.google.com/open

  • Hello everyone,

    I am very new to programming and found myself stuck with a problem I am sure you will be able to help me solve in no time.

    As a PhD student in linguistics, I am not exactly making games but little programs that help me in my research.

    The one I am having trouble with is a "Japanese -ru verb generator". In short, it creates random (non) verbs ending in "-ru" in Japanese while respecting the basic phonotactic rules and phoneme frequencies of the language.

    The good thing is: everything works just fine on my computer when I am previewing from Construct2. I may not have programmed everything in the most elegant way, but it works ! It generates the verbs, saves everything I want to save on 5 dictionaries (the list of verbs and some of their basic inflections), and downloads those dictionaries as JSON when I click the right button.

    However, I want to share my program with some colleagues. Since I could not find a way to upload it on a server (again, I am quite a noob), I thought the best option was to export it as a desktop app. So I downloaded and installed the NW.js support to do that. But if I run the game from the desktop app, when I click the "save" button, the downloading of the dictionaries doesn't work. Instead, 5 blank pages pop up (one for each dictionary).

    What did I do wrong ?

    By the way, here is the .capx file :

    drive.google.com/open

  • Ooooooh now I understand what you mean.

    The game will be translated and played only in Japanese. So capital letters won't be a problem since it doesn't exist. I already thought about it .

  • Oh I see. But maybe that would be more convenient the other way around :

    When host get an "answer" message from peer, he adds a key "CreatureCount//Multiplayer.message" with value "1". Or add +1 to the value if the key already exists.

    Then peers score if "HostAnswerList" has key "CreatureCount//Answer".

    At the end of the game, the "HostAnswerList" dictionnary should look something like that :

    1//blablabla 3

    1//bliblibli 2

    1//blobloblo 5

    ...

    2//blebleble 7

    2//blublublu 2

    2//blyblybly 1

    ...

    Which would be cool to analyse.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeap, dictionnaries for life lol. My first idea was to use families though. Something like creating 30 sets of 3 items (at the beginning, only "?" would appear) : a sprite, a "answer" text and a "score" text. Put the 3 items in 3 different families with an instance variable (corresponding to the creature count). When timer reaches 0 :

    Pick sprite (currently a question mark picture) by instance variable = creature count => Replace with sprite of current creature

    Pick "answer" text (currently a question mark) by instance variable = creature count => Replace it with Answer.Text

    Pick "score" text (currently a question mark) by instance variable = creature count => Replace it with "HostAnswerList.get(Answer.Text)-1"

    Do you think I can do something along those lines ?

    [quote:1hkiznfi]Don't know whether you added this yet or not, but it may be sensible to catch the case that every player submits an empty answer, by accident.

    So that it doesn't display "", but "No answer given" for example.

    I don't understand what would be the problem if everybody submit an empty answer. So far, empty answer = you don't send anything to host and you don't score anyway when getting the answer list.

    Also, I notice a little problem with the way the scoring system works now : if someone always answer the same thing, like "ZZZZZ" for example, even if it is nonsense, it will add 1 to "ZZZZZ" value every round. So this player would score round number-1 every round. I should find a way to prevent previous rounds to influence later ones. I thought about 2 solutions :

    • Reset HostAnswerList every round => cool, but a complete list of all answers could have been interesting data to analyze for my research, so I'd rather not.
    • Learning to use array, then I can have x = Answer (text), y = Value for this answer, z = round number. And players would score y points only if there Answer.Text = x and round number = z. => I have to learn how to use array T_T
  • Hey ! No problem, I was on holydays too.

    Actually, I will be quite busy with other stuffs until the middle of february, so I may have to put the game aside for a while. But I think it is already in good shape (thanks to your good advices).

    The next thing I will have to think about is this : the "previous creatures" hint.

    I want it to be a page that appears when "previous creatures" button is clicked. It would show the previous creatures sprite (in reduced size) + the answer given by the player and the points he got for that round. I am sure there is a quite simple way to do this. I just haven't had time to think about it yet. If you have any advice...

  • Oh ok I get it. (Well it's still weird that ".FromID" doesn't work though).

    Well I actually managed to implement the scoring system too and changed the way the "timer" works to what you explained earlier. So now I could say the game is "fully operational". Here is the .capx : https://www. dropbox.com/s/gv08nlsdwl1xbcx/ChatProject.capx?dl=0

    There is still place for improvement though, here is how it works now :

    • When the peercount = "the number of player I want", host broadcasts his timer, then everybody substract 1 every second (it's only visual for peers).
    • When host's timer reaches 0, he broadcasts "timer0" to everyone. He also registers his answer (if not empty) on a dictionary with value 1. And puts "timer" back to 10 seconds.
    • When peers get "timer0", they send their answers to host (if not empty, tag "Answer"). They put their "timer" to 10 seconds too.
    • When host gets "Answer", he adds this to the dictionary (either a new key with value 1 or +1 to an already existing key).
    • When host's "timer" is 9, he checks if the dictionary has a key corresponding to his "Answer.Text". If so, add key value -1 to your score (you don't get a point for yourself). He then broadcasts the dictionary as JSON and peers do the same.

    Note that everybody saves their own answers only with the "Spawn" value for later analyzes purposes. But this has nothing to do with the scoring system.

    My problem here is the last step has to happen at host's timer = 9, which is already 1 second in the next round (so there is a delay between the end of the round and the actual scoring). But when trying with timer=10, it seemed that the host did not have time to get the peers' "Answer" messages. Which is weird, since this should happen at timer = 0, thus, one frame earlier than timer = 10. Also, this would be a problem for scoring the last round (well, it's not really hard to solve that). Do you think this is actually just because it takes time to exchange all those messages ? Do you have a better idea to improve that ? I thought about asking the host to count the answers he gets and set timer to 10 only when that number reaches peercount-1. But then I should allow peers to send empty answers and find another way to exclude those from the dictionary, so nobody get points for not answering.

Zakeru's avatar

Zakeru

Member since 5 Dec, 2016

None one is following Zakeru yet!

Trophy Case

  • 8-Year Club
  • RTFM Read the fabulous manual
  • Email Verified

Progress

10/44
How to earn trophies