troublesum's Forum Posts

  • AnD4D

    The way arrays usually work in all programming languages is they are dynamically referable locations of memory. IE. Each level can be accessed by "string" name or variable. Imagine you create function and the first parameter happens to be the name of the dictionary you want to access (Not the key value but that actual dictionary. In C2 this currently not possible with out hard coding all possible dictionary's in advance. So you are limited to only having a single level of dynamic access which are the dictionary keys. (Notice you can dynamically access values in a dictionary but you cannot dynamically access the dictionary its self). This is the limiting factor of C2 where not being able build large complex structures like recursive functions or dynamic data algorithms (closed loop systems) like a game engine or operating system. Its just not possible.

    Using my plugin here is an example of looping through the first level of fields just as if it were a dictionary. This will loop through every key in player 1 and print his attributes. Nothing special becuase dictionarys already support this.

    [attachment=1:38izb030][/attachment:38izb030]

    But lets say I have 2 players and I want the score from each player (Each player would have his own dictionary for this. (this is simple example and I know there are ways of doing this in C2 but look at how simple it is with 2 levels of dynamic access). Instead of some grand method required I can do for each player key and get a list of the same item for each player in a single line of code. This is the power of multilevel dynamic data access and in truth is the foundation of all programming.

    [attachment=0:38izb030][/attachment:38izb030]

    There are so many benifits to this its hard to explain them all but let me give one more screen shot to help prove the point. By keeping all my data in a single location I can also debug problems much faster. Here is a screen shot of the storage container in debug view. Notice how easy it is to keep track of.

    [attachment=2:38izb030][/attachment:38izb030]

    Lastly as the plugin supports pushing and poping data as JSON objects I can send raw JSON strings back and forth via AJAX for communication with my server. And it can so much more. The problem is that since most of the people that use C2 are not traditional developers they have no idea what there missing by not having this crucial fundamental ability that is inherent to programming.

  • unfortunately no... I took one look at the array plugin and was "its like time to learn the SDK because this wont work for me" Sure enough the SDK is really easy if you have any JavaScript background (It sounds like you do) you could simply open up the array plugin and see what its doing vs what you'd expect. I have to assume its working the way its intended because im sure there are tons of people using it. It just didn't work the way I expected/wanted it to and I couldn't wrap my head around it i came up with this.

  • The definition of coincidence right here. I just decided (like 3 days ago) to create 3D Array Plugin that uses a named convention system (Dynamic Storage) for the exact same reason as working with the array plugin as it is wasn't working the way i would expected it to coming from a traditional programming languages.

    The plugin is still beta but should work the way you expect. I have an example capx that I use for testing each feature that is list below. You should be able to quickly see how it works.

    Heres the plugin

    [attachment=1:3tdmevyv][/attachment:3tdmevyv]

    And heres the example capx i use to test its features as i add them

    [attachment=0:3tdmevyv][/attachment:3tdmevyv]

    A screen shot of what it looks like in use.

    [attachment=2:3tdmevyv][/attachment:3tdmevyv]

    Hopefully this helps

  • If possible the background sprite should be a repeating pattern and then use the tiled back ground sprite to place it for optimal performance. Its about the amount of work the render has do. Not really about moving objects but determining what has to be redrawn.

    This should help explain it better.

    https://www.scirra.com/manual/134/performance-tips

  • With out a capx I can only speculate but I found that if I "Create" an array/dictionary at the same time i load data to it and on the same cycle attempt to then access it from a function or any where else out side of where it was create the data is not there but if I wait 1 tick then the array/dictionary becomes globally usable. Is the array predefined or are you creating it at the time the you load data into it?

  • Just some things to note about your screen shot.. It looks like your sprites are giant. Your background is one image and your terrain is one image (from the looks of it). I found on mobile larges sprites are death. See about tiling into smaller objects if you can. There is goldilocks zone of using small sprites vs too many sprites on screen you want to keep for optimal performance.

  • Whiteclaws After running some tests your definitely correct (though the cpu difference as you said was negligible) i ran 500 sprites moving across a blank screen which uses est 9-10% cpu using set pos and uses est 9.5-10.5% using simulate... Not sure why I though it was faster.. just seemed like my game runs smoother with simulate.. optical illusion i guess.

  • Based on what your doing there I may have giving wrong advice on using move to.. (if it works the you want then i would keep it) I would suggest for sprite6 (for smoother movement) that you give it the 8 direction behavior (since its not a platform object) and in the behavior properties for that sprite turn off default controls (this way the keyboard wont trigger the move)... then when touching sprite8 or sprite7 simulate moving left or right as desired... That should give smoother movement and better control. But cpu usage should be about the same i think as using moveto since they basically work the same way.

  • One thing I would change is how often you update the text3 field. I notice on mobile devices there is a considerable slow down if I update a text field every tick which is what your code shows its doing. I would instead suggest to update the text field every 1 second or so to help performance. also I believe set position on the green sprite is also more cpu consuming than just simulating pressing left/right. Same goes for the black sprite/camera... I would look into a plugin called "moveto" (created by rexrainbow) to move it across the screen... Based on the the code you've shown i would change those things first and try again

  • DUTOIT Thank you for this.

    I hadn't even considered creating my own... I think for now I'm just going to keep it as is and if the time it would take to create a nice looking key board becomes worth it, ill circle back.

    I did how ever find hack that seems to work most of the time (at least on my galaxy s4) its not a 100% but its enough for now. I just added wait of 0.1 sec before triggering the focus event for the text box after I show it. Oddly enough if I set the time to short or too long it doesn't work but there appears to be a Goldilocks time frame that if focus is called at just the right time it seems to work. Go figure

    Thank you again for taking the time to help

  • Nothing short of paying for your server to be hosted (co-located) at a professionally run data center where you own the server outright and its just located on the rack in their server room will give you 100% up time. And that's not cheap.

  • I'm working on a multi-player game and have in game chat that is working but the user experience isn't quite what i want. When The text box pops up I am able to focus on the box just fine but that doesn't seem to be enough to trigger the keyboard on the mobile device to show. I still have to wait for the user to touch the text box before the keyboard will pop up.

    I have tried various methods including inserting some JavaScript to simulate clicking but that doesn't seem to be working. Does anyone have any suggestions or know of how to handle this.

  • As I'm not a math wiz I usually like to work with predefined lists for stuff like this (I assume there is a better way than what I'm going to suggest but it will probably work). Why not create a dictionary and load the possible variables (2,4,8 etc..) on start of layout and then at runtime when checking just iterate over the list until to see if the number you have matches any in the list. If match return true. depending on how large a number you expect to get you could init the list with a while loop to generate a very large of possible numbers

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm pretty sure your only solution is to have a host logged all the time. Even if he is not playing the host has to be there for communication to and from all peers to work. Maybe just have a server/computer/VM what ever running that is connected to the game always as a host?

  • I believe random produces a floating point number? 1.23, 3.65 etc... try it with floor/round in front of it "floor(random(0,6))" (keeping mind random the 6 is not included in the selection range) or you could do "choose(0,1,2,3,4,5)"