construct 2 is not so fast after all

Discussion and feedback on Construct 2

Post » Thu May 19, 2016 12:39 pm

PixelPower wrote: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.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,567

Post » Thu May 19, 2016 1:44 pm

lennaert wrote:
PixelPower wrote: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!!
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 681
Reputation: 16,613

Post » Thu May 19, 2016 1:48 pm

PixelPower wrote: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.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,567

Post » Thu May 19, 2016 1:50 pm

I think we shouldn't reply to this topic. It is now obviously pointless.
B
29
S
14
G
6
Posts: 160
Reputation: 5,752

Post » Thu May 19, 2016 1:51 pm

PixelPower wrote: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.
ImageImageImage
B
27
S
16
G
74
Posts: 985
Reputation: 41,689

Post » Thu May 19, 2016 6:01 pm

lennaert wrote:FYI, Regular global variables have rather huge security issues.


What exactly is meant by this?
Image



Coming soon on Steam!
B
16
S
9
G
3
Posts: 204
Reputation: 3,466

Post » Thu May 19, 2016 7:05 pm

mikehive wrote:
lennaert wrote: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" ;) - haven't read the article tho.
ImageImageImage
B
27
S
16
G
74
Posts: 985
Reputation: 41,689

Post » Thu May 19, 2016 7:42 pm

mikehive wrote:
lennaert wrote: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 ?
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,567

Post » Thu May 19, 2016 7:51 pm

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.
Image



Coming soon on Steam!
B
16
S
9
G
3
Posts: 204
Reputation: 3,466

Post » Thu May 19, 2016 9:40 pm

mikehive wrote: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.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,567

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 12 guests