construct 2 is not so fast after all

0 favourites
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Well the OP wanted a method so he doesn't have to repeat the same code over and over. Because a global variable isn't encapsulated , then he can just call it easily whenever he needs to without having to repeat code over and over.

    The only thing in my opinion that brings a mess to a large project is not writing down want you want 1st. Before I take on a larger game I write down in notepad the different scenarios and things I want in the game. That way I don't get stuck in the middle because I calculated what I was going to do.

    Actually, the OP did not want anything, it was more of a rant.

    FYI, Regular global variables have rather huge security issues.

    Writing down anything related to your project is fine ... but .. what happens if you have 5k events ? or even more ...

    Exactly, a notepad will do near nothing to assist in readability or maintainability on that front; Groups and Structured sheets is the clue there.

  • >

    > Well the OP wanted a method so he doesn't have to repeat the same code over and over. Because a global variable isn't encapsulated , then he can just call it easily whenever he needs to without having to repeat code over and over.

    > The only thing in my opinion that brings a mess to a large project is not writing down want you want 1st. Before I take on a larger game I write down in notepad the different scenarios and things I want in the game. That way I don't get stuck in the middle because I calculated what I was going to do.

    >

    Actually, the OP did not want anything, it was more of a rant.

    FYI, Regular global variables have rather huge security issues.

    Writing down anything related to your project is fine ... but .. what happens if you have 5k events ? or even more ...

    Exactly, a notepad will do near nothing to assist in readability or maintainability on that front; Groups and Structured sheets is the clue there.

    I was answering the 3rd point he had because alot of people have that same issue not just OP. I doupt he is worried about security issue's.

    Now I don't think you understood the purpose of writing down what you want in your game before making it. Its to greatly reduce the amount of code your going to use and it helps you know what to group together before you start. If you just jump in and make changes on the fly , that will increase your workload by a ton. Also it will lead to fustrations and then rants.......Then the developer opens up a thread on Construct2 saying how badly it sucks LOL!!

  • Now I don't think you understood the purpose of writing down what you want in your game before making it.

    It's called software requirement specifications.

    which would only work if you know exactly what you want.

    Which is general not the case with indy developers who produce games on the fly when getting tons of ideas from things they pick up along the way.

  • I think we shouldn't reply to this topic. It is now obviously pointless.

  • Well the OP wanted a method so he doesn't have to repeat the same code over and over. Because a global variable isn't encapsulated , then he can just call it easily whenever he needs to without having to repeat code over and over.

    The only thing in my opinion that brings a mess to a large project is not writing down want you want 1st. Before I take on a larger game I write down in notepad the different scenarios and things I want in the game. That way I don't get stuck in the middle because I calculated what I was going to do.

    Initially you can make a brief plan in notepad, but this isn't a solution for further development. There is a saying "There is no project which is finished". Also you cannot predict everything for a big project no matter how good developer you are, so again - notepad is ok but only as initial draft.

    As lennaert said - apart of a mess in the project - globals do bring some security issues. So instead of using globals you should encapsulate your code with groups and functions and use only local variables. For toggeling particular functionality you should not use global variables states but simply toggle groups or object's instances booleans - depends on your need.

    What we are talking about is - I would say - the highest art of development which is the code architecture (which also relates to semantic). It's quite difficult for beginners but it's the most beautiful part of all development process. Many experienced developers, after years of work as a developer, decide to be so called Technical Architects/Analysts. In short words they are responsible for keeping the project structure the way it should be the pro way to avoid various issues in later stages of the projects.

  • FYI, Regular global variables have rather huge security issues.

    What exactly is meant by this?

  • > FYI, Regular global variables have rather huge security issues.

    >

    What exactly is meant by this?

    Simply saying global variables (no matter on the language/technology) are available even from outside the project. They are simply global. In JavaScript it goes to kind of global namespace and can be accessed by someone (man or other script) who was not intended to use is.

    You can google a lot about security risk regarding global variables in various languages. But apart from security issues, global variables, functions, ... are the exact opposite to encapsulation which is the essence of good programming practices.

    Just quickly googled "JS good practices" and the first on the top which popped up is http://www.w3schools.com/js/js_best_practices.asp

    Almost at the very top it is written with big letters "Avoid Global Variables" <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink"> - haven't read the article tho.

  • > FYI, Regular global variables have rather huge security issues.

    >

    What exactly is meant by this?

    Simple example, say you have a global variable "score" and actually call it "score", and someone with something like greasemonkey* or tampermonkey* addresses the variable "score", is then freely able to manipulate it with whatever he or she wants ....

    * = simple browser plugin which allows you to directly inject javascript to any webpage as if it was part of the original page, in this example, your game.

    See the potential issue when users can determine their score so easily ?

  • OK, I understand the problem with a browser game. But what if a game is released as a nw.js exe, or as a mobile app? Is that still something to be concerned about?

    Sorry if I'm derailing the thread.

  • OK, I understand the problem with a browser game. But what if a game is released as a nw.js exe, or as a mobile app? Is that still something to be concerned about?

    Sorry if I'm derailing the thread.

    At its core, it's all just javascript.

    The browser plugin was a simple example, simple in the meaning of "click to download addon, and add script" Literally under 5 minutes.

    Mobile apps are generally wrappers or webviews ....

    nw.js is an exe wrapper kinda thing ....

    so basically yeah .. they are all just as susceptible to various standard manipulation.

    Potential solution to the problem mentioned, use instance variables on objects where the important variables do not have too obvious names and make sure you use the minimizer which obfuscates the code and variable names even more

    And same here, apologies for the derailment, if you have further questions regarding the issue, please make a thread and I might reply if needed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For those, who getting confused over "Wait 0" thing.

    Tutorial by Ashley

    Wait 0 thread

    winkr7 Basically, "Wait 0 seconds" postpones the following actions until the end of the event sheet.

    when you have multiple actions on the same condition and the system might skip or write a bad value or half of a value instead the real one.

    C2 event sheet is read from top to bottom... but sometimes it might skip 1 action or 2

    This is not okay, sounds more like a bug. Then it might skip the "Wait 0" action too, lol. There's nothing in the manual or tutorials about skipped actions because of a framerate or anything else.

  • OK, I understand the problem with a browser game. But what if a game is released as a nw.js exe, or as a mobile app? Is that still something to be concerned about?

    Sorry if I'm derailing the thread.

    It does not matter, global, local...if a player wants to cheat they will. There are things you can do to mitigate it, and try to make it harder...but you can not really prevent it 100%.

    Global variables in a programming sense, are typically to be avoided...but for construct and game purposes made with C2, I don't see any real concern with it personally. Should you take steps at preventing cheating? Sure...but it comes down to, at what cost?

    If this is a game with sales, then you better do something, but it won't be using global vs. local variables.

  • I just mentioned global variables as a way to help the OP with his 3rd problem. Honestly I use global variables for the same purpose, to minimize my overall code. The security issue doesn't really concern me as most players just play the game, not hack it. As long as the game isn't multi-player it doesn't matter.

    What does matter is lowering the amount of code you use to make your life easier. In that reguard global variables can definitely help.

  • I just mentioned global variables as a way to help the OP with his 3rd problem. Honestly I use global variables for the same purpose, to minimize my overall code. The security issue doesn't really concern me as most players just play the game, not hack it. As long as the game isn't multi-player it doesn't matter.

    What does matter is lowering the amount of code you use to make your life easier. In that reguard global variables can definitely help.

    3rd problem ? when i write my own pathfinding system i dont know how a global variable can help me !

    i can do this :

    use function (do pathfinding stuff) return position of object > set position

    but when you want to use this code again you have to write the set position part again

    and it would better if we write whole system and drag the sheet to what every object we want! (cleaner and faster)

    and what happens if i want to get first mypathfinding nodepoint ?

    here i can set the object instance variables in function but when we want to use this function again we have to change the object , so the function is usless here

    but in secound way (which other engines use) i can set variables and access to them by another sheet

  • This is not okay, sounds more like a bug. Then it might skip the "Wait 0" action too, lol. There's nothing in the manual or tutorials about skipped actions because of a framerate or anything else.

    No it cant since "wait 0" action is delayed, as the post you shared says, to the end of event sheet and then performs it.

    But when you have 10-20 actions under a condition or is a very cluttered area of conditions and actions in your event sheet and you dont have the "wait 0" between them,and based on your computer performance or browser performance there are some times slow downs of performance.

    Maybe because of browser plugins/framework maybe because of your computers outdated drivers, sometimes we have high usage resources and the browser may slow down even for 1 second or less ... at that moment since C2 system is directly responding to how well our computers can run HTML5 and this sort of issues might happen.

    This issue was also mentioned many times by Ashley and other developers over the years in the forum posts. The skipping is not directly mentioned in the manual but the performance and optimization is, and its suggesting the slow downs might skip 1 action or the actions might not perform as well as they should. And thats why Wait 0 was implemented. At least thats how i see it and understand it so far from testings and the course of C2 development announcements.

    But its not something that C2 can fix. Its more of a Hardware, Software(not only C2 but all dependencies that C2 has), and user usage mix problems.

    Which C2 is developed and patch so often to avoid bad performances like this.

    Another example that is based on performance and the limits of HTML5 are the jitters that always pops up around forum, that are caused by the html5 platform and how well the Math is made in the Core's Engine.

    But this pushes the topic back to the eternal conflict between developers on having to choose from HTML5 or flash. Since immediately flash is/was a bit faster but still has more problems then HTML5 itself.

    In a few more years maybe all this will be behind, with the technologies and the software that is continuously updated. Till then we(the normal inexperienced flock of users) cant do nothing but wait. And submit bug reports or performance issues.

    And then another short note on user usage of software ... most C2 developers tend to not have a clean code... keeping their event sheet all unoptimized and having blank conditions under blank conditions under functions over functions that basically do nothing just delaying the system and then as mentioned above issues pop up.

    And the unoptimization of a code it can bring performance down quite visible in some cases even close to unusability of an app.

    Because 1 condition in blank its another maybe 0.001 % tick delay based on the amount of conditions and actions we have in our event sheet, and on large scale games that 0.001% can get pretty high stacking.

    I'ved seen capx's that where like the above example ... having 10 functions under 10 blank conditions and at the end 1 action that was calling another cluttered useless function that was basically repeating same hierarchy just calling another action or condition ... which did not make sense at all.. and the app at that moment tested was performing really bad maybe 1% of what it should have been.

    So it all comes down to all this things that combined kills performance, on a newly platform called HTML5 that still has years to be developed in order to get perfect and fast enough. Even though, i personal consider it fast enough at this point for what most people use it for on the side of C2.

    I could go on... but im way off-topic and this kind of talking wold be better discussed in open topic then C2 General.

    Im not sure if you still understand now why "action skipping" might happen. And why "wait 0" wont be skipped. But you already shouldve noticed all this by now ... since your not a new C2 user lol ... have a great day all

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)