Rushino's Forum Posts

  • Its k anyway i decided to not use the boolean form but 0 and 1 from now. Thanks for clarifiying this out.

  • Hi,

    I sent you a private message regarding this.. but this would be better to answer this here since it could help someone else with the same kind of problem.

    How much flexible is your plugin (in term of accessing multi-level JSON and arrays)? I am exchanging data between a WebSocket server in this format..

    OpCode-Token { ... }

    The end is obviously JSON data. So would it be better to fully handle nested-levels JSON with your plugin (if its flexible enough).. or use your plugin to only parse the first level and prepare the c2array or c2dictionnary JSON directly on the server-side so i end up with..

    1-1234 {"valueA":123, "data":{"c2array":true, "size":[3,1,1], "data":[[[0]],[[1]],[[2]]]}}

    so all i could do in this case is getting data with your plugin and load it to the array. But at the expanse of bandwidth!

    Thanks!

  • I tried converting it. Doesn't work either.. i tried

    int(Dictionary.Get("TestWithBoolean")) = 1 THEN something..

    and

    int(Dictionary.CurrentValue) and i still get 0 after the conversion.

    (you can get the updated sample here.. mediafire.com/download/f3777k3kblq1gac/DictionaryLoadBugWithBooleanAsJSONv2.capx)

    I know booleans aren't number nor string.. but the dictionary object seem (like you said) to allow only string and int comparaison which is a bit odd when you can have booleans values as JSON. Boolean can be (or at least should be) converted to int which could have solved the issue but it doesn't seem to be the case here. You have to agree its a bit confusing :) It may not be a bug.. but could be a feature request then.

    You said your using actively the dictionary for boolean comparaison.. then i would be interested if you could show me exactly what your doing to do that boolean test. Probably something i didn't got right.

    Thanks for your help :)

    EDIT: For now i did a converter on the server side for fixing this issue so i can receive 1 instead of true and 0 instead of false. It work well and also save some bandwidth since true take more space than a single number. Not a big deal but if you receive like 100 elements in an array with boolean that can be nice to have.

  • Hello,

    I found the fellowing bug which is currently putting my project on hold (i use a ton of JSON queries)... if you load the dictionary with this fellowing JSON (a JSON with boolean values)

    {"c2dictionary":true,"data":{ "TestWithBoolean":true, "TestWithoutBoolean":"true" }}

    There is no way to detect that the key TestWithBoolean have 'true' as the value. Using the fellowing event: Key "TestWithBoolean" = "true" doesn't work since its not a string but a boolean without quotes.

    The value in the debugging show 'true' for both the key but in real they different.

    I even tried using a for each to write the values to the log of the browser and i got this..

    TestWithBoolean : 0

    TestWithoutBoolean : true

    I would be glad if you could provide a simple workaround for now.

    Link to .capx file (required!):

    Here a simple sample which show the problem..

    mediafire.com/download/rcru7arw9f7cl9g/DictionaryLoadBugWithBooleanAsJSON.capx

    Steps to reproduce:

    1. Load a dictionary with the JSON. {"c2dictionary":true,"data":{ "TestWithBoolean":true, "TestWithoutBoolean":"true" }}

    2. Try to check if TestWithBoolean have the value 'true'. It won't work!

    Observed result:

    There is no way to detect a boolean. The event will never go in.

    Expected result:

    I expected to be able to test if TestWithBoolean had the value 'true' but i couldn't. At least it should detect TRUE and return 1 in that case..

    Browsers affected:

    Chrome: yes!

    Firefox: yes!

    Internet Explorer: yes!

    Operating system & service pack:

    Windows 7 64bits latest service pack...

    Construct 2 version:

    r146

    Thanks for your help!

  • Alright it work now.. ! Thanks sorry for being a n00b.. haha at first i was pretty sure we could do this otherwise it would have been bothersome!

  • Hi,

    It is possible to immediatly set created object instance properties ?

    Like i want to create an object and then set some instances properties to that object immediatly after ?

    That would be nice to have something like LastCreatedUID or whatever to pick that object in a subevent or something.

    Thanks!

  • Nevermind, look like its my lack of knowledge in the array object. To have initially zero element you must set..

    width: 0

    height: 1

    depth: 1

    if you set all zero everywhere, it won't add anything to the array.. which make sense since there no height or depth. At least you need 1 height and 1 depth to represent a 1D array.

  • Hi,

    I was playing with the array and poping an item in an array increase the number of element of that array..it is normal ?

    I mean once i poped it, it should have removed it not adding element to it. The element is empty.. but it is still added.

    But i have a guess which is probably the size of the array that incrementing. Is there a way to avoid this ? even reducing the array size after the pop doesn't work.

    Thanks!

  • Offcourse i am not talking about UI logic or anything like that. However i would be interestes to know which kind of logic you have on mind.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No theses things are problems in html 5 games and even normal games on desktop in general. If someone have access to game client logic you must take into consideration it can be altered. The only way to counter this is to put all the logic on the server there no other ways. You will probably (depending how you coded it on the client.. either by refreshing the stats regulary or whatever) end up with your scenario at some through where the dude that altered it get into a false sense of winning cause all he did is teleported himself to x y pos. But the server alway know the truth, he know that the player are not at this position because of server game state logic. So wht happen if he execute a move based on wrong origin coords ? Well at this point its up to you.. you can kick him for having sent bad data once you validate it. But in the end you wouldnt really care since you know its secure ans cant change the game state.

  • Ok, i wish to take some minutes to present my upcoming project which are about to take advantage of WebSockets technologies. Its called Skirmish Commanders! I moved this from another engine to Construct 2 for technicals and productive reasons.

    Its gonna be a commercial online turn-by-turn tactical drones game which mixing aspects of several games such Pokemon (Varieties), EVE Online (Customization), Final Fantasy Tactics (Kind of game) and Front Mission (Combat deep details).

    This is rather huge i know, but i am pretty sure that Construct 2 will be a lots of help here comparing to what i was using before. This game gonna be fully HTML 5 with a Desktop version! A kickstarter is planned cause i really believe i can't finish it without poeple help and there are many things that still need to be developped. The server-side is ready just need to put logic in. I worked 1 year on a solution using WebSockets and came to a point where i am pretty confident it will work.

    The game will have interesting combat features like ability to target drone subsystems, etc drones will have balanced stats the idea is to try to make a drone unique and even if its bigger than another drone that won't meant its better or more powerful. At some point you will be able to customize the stats or adding abilities to the drones via pluggable modules. There will be high level of complexity when it come to stats of the drones such precision, energy, module slots, rate of fire, weapon type, etc.

    Then i plan to enable 2vs2 battles in the futur and different game modes.

    Have a look at the devblog : pyroswarm.com/devblog

    ** Please note all the content on the blog are copyrighted to me.

    Thanks for your interest! :)

  • Alright! Thanks!

  • ramones this fixed it! it make sense actually i wanted to take each button one by one to apply this logic so.

    Thanks a lots!

  • I use the default mouse button for this. I check if its over id not i set the active/over state off which is what the events are showing. Mouse is definiticly over one of the instance but the second button should not show the over state when i am not on it.

  • Does the event 'mouse cursor on object' actually pick the instance ? because i have some kind of nasty bug that happen when i am over an object and then switching to another instance of the object pretty near.. it make it look like its still on the first object..

    Here the strange behavior..

    <img src="http://s12.postimg.org/zajodc0jx/nastybug.png" border="0" />

    Here my events..

    <img src="http://s18.postimg.org/dlmrdhnvd/bug.png" border="0" />

    Any ideas ? Normally the event Cursor is over 'Button' should pick the correct instance.

    Thanks!