Nilom's Forum Posts

  • I tried it and it worked without using a function. When I put Wait 0 or Wait for previous actions to complete it will have the correct peer count.

    Thank you!

  • Hello there.

    For the ready check of my game I was trying to do the following logic:

    On peer disconnected {
    	If peer count = 1 {
    		Destroy Ready Button
    	}
    }
    

    Because if there are no other players there is no need for a ready button. The problem is, inside On peer disconnected it will still count the disconnected peer(s).

    For example:

    There are two players. Host and peer. The peer disonnects. Hosts On peer disconnected will trigger. Inside I have an Browser Alert Multiplayer.peerCount. It shows 2 although the second player just got disconnected.

    Is this a bug or intended? As that makes some if player leaves change stuff things difficult. Thanks in advance.

    Edit:

    This is my temporary fix. It works, although it looks funny. :D

    Multiplayer.PeerCount -1 = 1

  • Hey there!

    While testing the "ready-feature" before game start, where the host can only start the game after every player is ready, I had quite problems figuring out why it didn't work.

    Then after some time I realized that in the dictionary that I use to store values, every players ready-key had a value of "1" (string) and the hosts value was 1 (number).

    That happened because only strings can be sent through multiplayer and while doing the local stuff I accidantally put a number instead of a string for the ready value.

    But the unfortunate thing is, that I could not see that in Debug Mode. I almost thought I'm stupid or something because the dictionary values cleary showed a 1 on every of the keys.

    Is it possible to indicate strings with " " inside the debug mode, like usually? Thanks.

  • Ah yeah that makes sense. I will test it later when I'm home. Thanks again!

  • Thank you for your detailed reply!

    Okay I see. So it is mostly up to me.

    I will continue using a single layout and groups for now and hope that I will not realize one day that I should have used seperate event sheets instead. :D

    I have a last question though. When using nested groups, if the main group is deactivated on startup and a group inside it is active on startup, does it mean the active group inside the inactive group is inactive as long as the upper level group is inactive? Maybe a stupid question but the fact that this nested group is not greyed out in the editor made me wonder.

    Thanks again :)

  • Hello there.

    I'm wondering about what the best practices are in regard to performance and development efficiency with the eventing system for a multilayer game.

    Currently in my game people can set up a room, connect to a room and create their character.

    I'm using a single layout and a single event sheet for this as I thought things like reconnecting might be easier with a single event sheet. I use groups that I enable or disable to change the state of the game like signalling, hosting, character creation etc. .

    But now I'm wondering if I should instead use different event sheets for the different states. Like one for the connection, then if connected go to the lobby layout (and event sheet) and then if the game is started to a different one.

    Also I wonder if it is better to have a group for being the host and one for being the peer (like in the multiplayer tutorial) or instead simply check "is host"...Do This..."else"...Do That... .

    How do you do it? What do you think is more efficient while developing and performance wise?

  • Ohhhh. Stupid me! I will test it tomorrow with pick all. No I did not do that because I didn't think of that. Thank you for that hint. :D

    Edit:

    Tested it and still the only way it works as inteded is from my screenshot above. I guess that's because On Text created is triggered simultaneously and not after the text creation which will not make the local variables accessible.

  • Okay that was a good hint about the top level event. Both the text creation function call and the z ordering where inside the on selection changed event of the list object.

    Now I have a top level trigger_order_z check that will order z when it's 1 and set itself to 0 afterwards. Works perfectly now. Thanks.

    Edit: Got it even simpler. Now I made an On Text created -> order z event. So I do not need to trigger or use variables at all.

    Edit 2: On Text created won't work. Don't know why. Guess I have to trigger variables..

    Last Edit:

    Okay I did some testing. The only way I got it working correctly while still being automated without me needing to manually trigger the z ordering was as follows:

    When I used z ordering inside the On Text created event it just did not order any text at all. Even when wait was used. So I need to trigger a variable and in the following event I can order z. I guess it has to do with something like On Text created it can not access instance variables yet.

    When using the Sort event the first time the text is created will appear on the bottom of the layer for no reason. The second and following times the class is changed it works as inteded. Just the first time the class icon will not appear because z index will be below the character frame.

    Anyway. The way I sat it up in the screenshot works.

  • Hello there!

    I have some text objects that I need to order.

    For every text that I "spawn" I use a function for setting the size, color etc. . And one of these function parameters is z-order, which defaults 50.

    So I have one text. The character name. It should always stay over another text.

    I got it kinda to work this way:

    The name now always is above the other text. But what I find confusing is that it will be the case no matter what I set for the z_order value. Remember z_order defaults 50. I want to sort the objects from 0 to 100, 50 being the average middle. This way I have enough "virtual layers" for placing objects above or below another.

    But no matter what I set the z_order value of the text object, it will always stay below the name. I wanted it to appear above the name for testing, so that I know it is working correctly as it should. Which it doesn't.

    Oh and this by the way did not work at all:

    What am I doing wrong? Or am I ordering too soon?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Okay thank you. Then I'll just go for it.

  • Hello there!

    I'm wondering what's the best way to have all the data of a "typical RPG" stored.

    I really like the modularity of javascript objects. So is there anything wrong with using JSON to store most, if not all of the data instead of using arrays, dictionaries or global variables?

    Some time ago I worked with RPG Maker MV and liked the way the battle system handled the battle formulas. I'm thinking of a similar system where I can do things like

    player1.hp = player1.hp - (player2.atk-player1.def)

    (Just a very basic/bad formula for easy demonstration.)

    Sure I could use dictionaries for this and call them player1, player2 etc. . But with JSON I imagine to be a lot more flexible with storing the data.

    Are there any downsides in using JSON as a database and for runtime calculations (turn-based rpg)?

    As always, thank you in advance!

  • I'm good for now, thank you! I noticed that I can not send the project via private message. Although it is strange I will just use a sub-event for the evaluation. It works that way.

    Thank you for your help. :)

  • Ah I wrote resource indeed wrong. But I did it on all places where I used it. It is written with double s in my native language. Corrected it. :D

    I now finally got it to work! But I think it is a little strange. Comparing the instance variable of the TextObject didn't work either. But when I made a subevent and moved the evaluation there it suddenly worked.

    But what I find quite strange is with the first ListObject (role) the picking inside on selection changed totally works.

    Both ListObjects use the same logic and call the same function to just spawn a different description text.

    Edit without an edit:

    Ahhh I now found out that if I remove the | (OR) statement and just have a single evaluation it stops working in the first list too.

    Is this a bug or did I do something wrong?

  • Hey there!

    In my project I use a function to let text (TextObjects) spawn. For being able to differentiate between these TextObjects I use a local variable usage inside these TextObjects.

    Okay now I have 5 different TextObjects. Two of them are just titles above the two ListObjects. They just stay there. Two of the other ones are descriptions of the ListObjects, below them. These descriptions change when selecting items of the corresponding ListObject above them. The last one is another TextObject which changes depending on the selection of the first ListObject.

    How I tried it is as follows:

    Every TextObject will be checked for its usage local variable by evaluation. If it is "role_icon" or "role_description" it should be deleted before spawning another one of these (or there will be overlapping text). That works perfectly fine.

    But when I try the same with the second ListObject and its description text below it just will not be triggered at all.

    Even if I remove the delete text command there will be no description text. Only if I remove the evaluation there will be description text. But either all other TextObjects will be deleted or text will overlap (depending if I remove the delete text or not).

    Am I missing something?

    Thanks in advance!

  • First, thank you very much for trying to help me! Very appreciated.

    I am running this function only once and at the end of the drawing. Because as you say it is processing intense. Good idea, I might reduce the size of the DrawingCanvas to 500x500 or even 400x400.

    The user will have all sorts of colors. Maybe I will even add a color picker tool.

    I also thought about storyng the picked colors rgb values and then count the colored pixels on the fly.

    But I'm not sure how to do that. I could use getred(mouse.x,mouse.y) etc., but I don't know what to do if the brush is not 1, but 10 pixels wide. Also it would be complicated if I implement a paint bucket / fill tool.

    I would like to know what I did wrong with my events. Maybe someone has an idea.