vascco's Forum Posts

  • I imagine the process to be like this :

    End of level, update stars value in the array for that level

    On map screen load, update all level images based on array data

    And I like this way the most. I think this is the way I will go. Thanks a lot to solve the dilemma.

    Another way to do it is to just use variables and use 'save' game to save the state of the game. You wouldn't need a global variable for each level, probably one track to track the current level and the stars obtained then when you return to the map you update the relevant level. Problem with this is that it is not permanently stored anywhere and it's hard to track if bugs occur, but you can give the level objects 'persist' behaviour so their variables remain the same.

    I wasn’t thinking about persist behavior because I made code which is imported all data back from savegame array into sprite instances, on layout start, and updated the instances after each matrix change, purely to keep debug up to date. I will try and persist behavour, but now I am most for the first way you said.

  • Now I know what data you are storing it should be an array, you can link the levels to the array rows by instance variable.

    And I like that way the most -> create levels with instance variables on map and import them into array for further processing and data storing. Thank you very much for your opnion.

    But one thing bothers me. After initial importing instance variables into array these variables become unusable if I do not process them back, together with Array, because all further processing takes place within the array, with sprite calls, and and instances would only serve if there is nothing in LocalStorage, as the initial starting points.

    Is that fine, or does that mean that after each array update I have to update and sprite instance variables, so as not to confuse later during the game debug with different data. What do you think?

  • "For example, I have game level map layout, whith level numbers as well as level completion progress."

    This can be stored as global variables or in an array. If you need any other advice you should give more details about the game and what data you are storing.

    Hi , thank you for your reply.

    The map is scrollable up-down, with about 200 levels connected with roads between them. In principle, the most variables are levels and map resources (coins and energy), while other things are just aesthetic images.

    There are various types of levels and every type have its own sprite. Every level have max 3 stars and every star is shown in accordance with player progress.

    If we go with global variables for every level, would that mean a minimum of 200 global variables is needed for all levels? Isn’t that a lot of global variables just for that purpose, or is that fine?

    So far I have tried 2 ways, one with level instance variables, because each level have more instance variables like LevelType, LevelNumber, LevelCompletion, etc., while second way is with arrays.

    In first way I created all levels on layout together with instance variables. Then I put all levels into Family and and on start of layout all levels are chacked with For each level, etc.

    While in second way I tried with Image points on Map background image and connected them with Array editor via AJAX and every layout start levels are creating based on array data and Image point positions. Then I save this array on Local storage.

    Both ways give me the same result, but first way is faster and clearer for code, and second way is slower, with full of array commands insted sprite.variable, but easier for game saving and later comparation between levels.

    I'm still trying to decide which way to go. Personally I prefer to work with arrays and dictionaries, but I also like and sprite instances.

    What do you think, what should I do?

  • Hello colleague,

    For a long time I was undecided about the best method of organizing game data. I tried 2 methods:

    1. Data storage and processing within sprite instance variables

    2. Data storage and processing within Arrays, with Sprite UIDs for calling sprites

    Seems to me first method is easier and faster to work, due to visual recognition and calling variables, while second method is easier for storage saving (AsJSON), as well as for data comparing, but visual recognition is harder (the form of the array and content should be written down somewhere).

    For example, I have game level map layout, whith level numbers as well as level completion progress.

    Shall I:

    1. create everything on level map layout and give instance variables to all levels (LevelNumber, LevelCompletion, etc.), with writing neccessary data to Array for saving game to local and cloud storage, as well as with data export from Arrays into sprite instance variables on start on layout; or

    2. create map background only, with multiple image points for creating levels positions on every layout start, based on Array editor and AJAX importing, while sprites would have only ArrayColumn instance, for array orientation.

    What are your experiences in that area? Which method is better for game organizing for you, or there are some other ways?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You need to create a Github account first. Then click on "New issue" on the above Github link and follow the instructions to describe the bug.

  • Hi eleanorjmorel, you can report a bug on the Construct 3 Github page: github.com/Scirra/Construct-3-bugs/issues

  • Just tried with Samsung mobile and works perfectly. Also, works fine on Windows.

    Seems the problem is somewhere between Construct 3 and iOS (tried on Safari and Chrome and sometimes it works and sometimes it doesn't work, for the same code), unless I missed something.

  • Hello colleagues,

    I did the following, with PlatformInfo object type:

    Event:

    System -> Every tick

    Action: Set canvas size -> Width: PlatformInfo.WindowInnerWidth; Height: PlatformInfo.WindowInnerHeight

    Fullscreen mode: Off

    After running on Windows 10, Chrome, every tick the canvas adapts well to the free space after every window resizing. Also,it adapts well after iPhone 11 Pro rotation (portrait to landscape and vice versa).

    The problem arises after screen rotation on iPhone 6s, when the canvas covers only about half of the screen. iPhone 6s has the latest software (iOS 13.6).

    Did i miss something or is this a bug?

  • Then it is a good solution. Let’s say someone manages to hack game data on the device, I believe that would be a very small number of players compared to the total number playing games, so I guess it is okay.

    Thanks again a lot for the help.

  • This seems like a good solution klabundee. Does that mean the Date/Time data would be then stored on the device memory instead on the server?

    I guess it's very hard to hack a phone to change game data? Purely to cover all possibilities.

  • Thank you klabundee and blackhornet, if I understood correctly, the solution is to compare everything according to UTC time, as a reference point?

    For example, if the player lives in different UTC time zone, and If the player spent the entire energy, energy charging time should be calculated in according to the UTC time, regardless of the player's time zone?

    Does this mean that all this data required for comparison should be stored on an external server, for every player?

  • Thank you dop2000 and klabundee very much for help.

    I tried dop2000 example and this solution worked perfectly.

    Now I have discovered a new problem. After installing VPN and after changing my IP address (after connecting to different country and time zone), and time from server adjusted to the new zone too.

    New question is how to prevent cheating over VPN? Maybe the solution are in comparing the data saved on the device and the data from the time server, or it can be done in some other way, what do you think?

  • Hello colleagues,

    Is there a way to prevent game Date and Time cheating? If time is taken from the phone, over Construct built-in addons, then game time can be cheated by simply changing phone settings, which should be avoided especially if the game depends on time (life returning, charging energy, arrival of new gifts, etc.).

    I guess then Date and Time should be taken from some independent server, over the stable Internet connection needed to play the game.

    How can I do that, for construct 3?

  • I expressed myself badly. You solved this problem, not I.

    Thank you again and all the best.

  • Thank you colleagues blackhornet, Fib and dop2000 very much for the detailed explanation and help.

    I solved this problem with Button->Set unfocused, after clicking, as you suggested.

    Best regards