oosyrag's Forum Posts

  • First off I want to say don't be intimidated by arrays - they are in essence spreadsheets where you can store and manipulate data. One important feature is that they can grow and shrink as you need them, unlike variables, of which you have a fixed amount defined ahead of time. Very useful.

    Basically, your goal is to get teams randomly from a list without repeating. I would use two arrays - the first array contains all your teams and data, the second array starts off empty but when we need to we can move the teams in the desired order to the second array (so that the first two slots play each other, next two, ect.). After the data is processed, they can be moved back to the original array in the correct order as well.

    Here is the commented example - https://www.dropbox.com/s/uu31uxt73zkfx ... .capx?dl=0

    I made heavy use of loopindex, let me know if you have any questions.

    This technique is very similar to shuffling a deck of cards. Imagine you have a "deck" of 52 teams (or 4 in your case), and after you shuffle you draw the top two teams, play them against each other, and then keep repeating until you run out of cards. Sorting them back into the original order is optional.

    If you don't mind using plugins, here is a plugin that might be useful - plugin-smart-random_t163624

  • To be specific, construct exported games that push the limits of device capabilities will not run well on phones that do not support webgl. Overheating of processor can be caused by inefficient events. 20% of a desktop CPU can be significantly more on a phone.

    Basically, devices do have limits, and you need to design within those limits for whatever target for are aiming for. Changing engines will not magically remedy this.

  • First you need to clearly define what you are trying to simulate. So when you click the button...

    Who plays? Pick a random team. Then do they play another random team? And then the two remaining teams play each other?

    What to record? Score and win count? Is score chosen randomly as well? Otherwise what are the constraints or logic for scoring? Win can be based on score. Do you want to keep track of ties?

  • For each x condition and action, add a corresponding y condition and action with the numbers you want.

    I always like to suggest using an invisible helper camera sprite to make things easy to understand though. Just add to "scroll to" behaviour on it, and move it around as needed.

  • Ah. Well then you can use 10*2. 1^(n-1) for both displaying and subtracting money, and just add n items straight away.

  • On click

    Repeat x times -

    subtract cost from cash

    Add 1 item

    Set cost to floor(cost*2. 1)

  • I'm not really sure how to help you here, your project sounds pretty normal. 64 megs is fairly hefty though, compared to what I normally work with. If you have a lot of images to process into sprite sheets, it could explains the long save times.

  • https://www.dropbox.com/s/8a2ulvjh7033p ... .capx?dl=0

    Two problems (unique to going slow, my first example actually didn't work completely right either, it was just hidden by going fast).

    1. You didn't turn off using default controls. Jump overrides the move up one pixel event (you jump first, and then move up), so you pick up all the momentum from your jump when climbing the ladder, which is way faster than what you want. With simulate controls, you can put the jump event AFTER the move up one pixel event - you move up one pixel first, and are no longer on the floor, so you can no longer trigger the jump.

    2. Having two ladder events using else - the second else runs even if your first one doesn't, setting gravity back to 1500 thus overriding the first set gravity to 0. Moving one pixel at a time is not fast enough to fight against that gravity (moving 50 was).

  • Rounding error, very common when dealing with angles.

    https://www.scirra.com/blog/141/common- ... nd-gotchas

    [quote:127woonl]Expecting math calculations to be exact

    All modern computers store fractional numbers like 0.5 in a floating point format. If you want to learn more about it feel free to follow up the link, but we won't be detailing it here. The main point is because computers don't have infinite processing power and memory, they must sometimes slightly round results. This in turn can cause the result of a calculation to be slightly off its true mathematical answer, such as getting 0.999999 when you expected 1.

    To illustrate why this happens, consider dividing 1 by 3 with limited precision. The answer is of course 0.333333333... recurring forever. However computers have a limited amount of memory and can't possibly store an infinitely recurring number like that in full. Therefore they reserve room for a fixed number of digits, then stop. For example it might calculate with six digits and come up with the answer 0.333333. This is mathematically wrong, but your computer cannot possibly store the "right" answer, so it has to make do. Then suppose you multiply this result by 3 again. You'd expect three thirds to equal 1, but in fact you get 0.999999 - close to the right answer, but not exact. If your game expected the answer to exactly equal 1, you might find it's not working like you expected. You can usually inspect your project with the debugger to see the real answer that was calculated.

    This type of error affects all floating-point calculations in almost all software in all modern processors. There's no escape! It's just a fact of how computers work. The real details are slightly different - my example used decimal (base 10) whereas the actual representation is in binary (base 2), and recurring decimals work differently in base 2. For example the number 0.1 is exact in base 10, but is a recurring decimal in base 2. This means rounding can happen in unexpected places, even if you think you're dealing with exact numbers. It's particularly likely to affect object positions, since moving an object at an angle involves calculating sin and cos, which will usually produce results close to but not exactly the true answer.

    The workaround, which you must use with any software and any framework, is to allow a small tolerance. Don't expect an event like "Sprite X = 100" to ever be true. Instead use something like abs(Sprite.X - 100) < 0.01. This allows the comparison to be true so long as the result is within 0.01 of 100, so if it works out to 99.999999 your event still runs as expected.

  • It should be as simple as changing c. Maybe you missed something.

    https://www.dropbox.com/s/bp2i7y0g7ie87 ... .capx?dl=0

  • Oh huh. How big is your tile map source file and how big are your tile maps?

    Maybe use a third party tile map software like Tiled to build your maps and import them as project files to load at run time.

    How big is your capx file total when saving?

  • Do your tilemaps change during gameplay? If you don't actually need to save them, you can add the "No save" behavior to them.

    If they do change, you can save them with a different method - Get the Tilemap.AsJSON and write it to localstorage. You can then load that as needed. Everything else can be saved as normal via the system save action (use "No save" on the tilemap).

    [quote:1g3q4y1l]AsJSON

    Save the object state to a string of data in JSON format, and return it. This can be downloaded or otherwise stored, and later the state of the object restored using the Set from JSON action.

  • Hi Everade!

    I must have overlooked this thread previously since it seemed like you already had plenty of help, but I guess it was never resolved to satisfaction. I'm trying to get caught up here, let me know if I missed/misunderstood something.

    Goal - You need objects to interact with solids conditionally in certain situations (different "floors").

    Additional requirements - Within the same layout, due to multiplayer

    Problem - Solids can only be set globally, also you cannot enable and disable them as needed in a multiplayer environmnent, as different players may be on different floors at any given time.

    Attempted Solution - Custom solids/collision behavior, with conditionals based on y axis z order (not ideal, as isometric view causes much complication, or layers, which gives you pretty good control but you have to have a good method to switch layers.

    New problem - Custom solids are hard to do correctly. Collisions and blocking movement not satisfactory, especially with high velocity/time discrepancy introduced in multiplayer, resulting in bouncing.

    So assuming you're OK up to the layer system for logic defining who should be able to collide with what at any given time, the next step would be to set up a good collision system. The first thing that comes to mind for me is using SAT to prevent anything from overlapping to begin with, rather than colliding/overlapping first and then pushing your objects away which causes undesirable bouncing.

    Ref: https://gamedevelopment.tutsplus.com/tu ... amedev-169

    Example: r0j0-039-s-experiments_t91829 (first one)

    This would need to be applied on both the host side and the peer side. If applied to both consistently, neither host nor peer should see any discrepancies outside of normal lag/desync issues.

    Basically, it comes full circle with your request to have the solid behavior allow for conditionals. If the official behavior doesn't support it, we'll need to build our own. While most of the other behaviors are pretty simple to recreate with events, solids have a lot more to take into consideration due to their interaction with a variety of different objects and behaviors. I'd be interested to see the logic behind how the official one is put together.

    Sorry I don't have a working example, this is a bit complicated and beyond my ability to put together quickly.

  • Ah that . in my post was a period. Follow what I wrote here - "Hi "&NameVariable&"! How are you?"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Reduce the number of tiles in the tile map.

    Although... 42mb doesn't seem like much to me, it shouldn't result in a 5 minute save, even on an older mobile device. I would try to isolate the issue in a new project to make sure.