Josh @ Dreamland
|
 |
Reply #30 Posted on: January 25, 2011, 08:41:43 am |
|
|
Prince of all Goldfish
 Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
A motion_set that's five lines in GML isn't really worth porting. Those kinds of functions are more like blueprints or suggestions than code. It doesn't help me if you just take advantage of ENIGMA's scoping system to do things that are a pain in the ass in plain, general C++.
Though, with the new instance system, they're now much easier to produce.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|
|
|
|
Post made January 27, 2011, 03:45:59 pm was deleted at the author's request.
|
Josh @ Dreamland
|
 |
Reply #36 Posted on: January 28, 2011, 12:54:16 am |
|
|
Prince of all Goldfish
 Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
with (obj) direction=dir, speed=spd; isn't worth porting, considering the corresponding C++ is completely different.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
MrGriggs
|
 |
Reply #37 Posted on: January 28, 2011, 04:50:07 am |
|
|
 Joined: Dec 2010
Posts: 128
|
Well, basic integers are handled quickly by the processor. var has to check, at every calculation, what variable type is being used and how to handle it. It's not a huge notice, but if you take an entire project and convert it from var to primitive types, you'll see a relatively decent increase in speed.
Will defining our types before using them increase the speed at all, for example int varname string strname so on and so forth. To get the boost will we also have to include the variable type in the if statements and other such checks when referncing the varname ?
|
|
|
Logged
|
|
|
|
TheExDeus
|
 |
Reply #38 Posted on: January 28, 2011, 05:27:17 am |
|
|
 Joined: Apr 2008
Posts: 1860
|
Will defining our types before using them increase the speed at all, for example Of course. The biggest speed increase is in for cycles like for (int i=0; i<10000000; i++){} will work A LOT faster than for (i=0; i<10000000; i++){} To get the boost will we also have to include the variable type in the if statements and other such checks when referncing the varname ? No, in c++ you have to set the type only when declaring them. When used in if checks and so on the type doesn't need to be set again. Unless you want to cast them as another type, like: double d=1.23; int i=1; if ((int)d == i){} Dunno if ENIGMA allows this right now, but I also never really saw the reason to do that (unless in coding in c++ where functions can take only certain types of varaibles).
|
|
|
Logged
|
|
|
|
|
Josh @ Dreamland
|
 |
Reply #40 Posted on: January 28, 2011, 08:21:07 am |
|
|
Prince of all Goldfish
 Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
Indeed. I've managed to make variant work as fast as double, but double is still slower than int. Granted, they are hundreds (int thousands) of times faster than Game Maker, but best practice is to declare them. local int varname; will take care of all your woes.
You can stick a cast anywhere in an expression you like in ENIGMA. Just like ++, or !. Casts are just another unary operator.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|
Josh @ Dreamland
|
 |
Reply #42 Posted on: January 28, 2011, 09:50:29 am |
|
|
Prince of all Goldfish
 Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
Correct. Game Maker will complain, hence, ENIGMA is backwards-compatible.
|
|
|
Logged
|
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble "I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
|
|
|
|
|