Pages: « 1 2 3
  Print  
Author Topic: move_towards_point  (Read 18371 times)
Offline (Male) Josh @ Dreamland
Reply #30 Posted on: January 25, 2011, 08:41:43 am

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
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
Offline (Unknown gender) MrGriggs
Reply #31 Posted on: January 25, 2011, 09:06:37 am

Member
Joined: Dec 2010
Posts: 128

View Profile Email
I would've thought writing code in GML for functions would add to the compile time, though. Or does it only need to be coverted once?
Logged
Offline (Male) RetroX
Reply #32 Posted on: January 26, 2011, 04:55:49 pm

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
GML functions are slower in nature because they use var.  But compared to the speed of GM, it's already loads faster anyways.

Besides, if you code something in GML, post it here, and someone will likely be able to convert it to C++ for you.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Offline (Unknown gender) MrGriggs
Reply #33 Posted on: January 27, 2011, 05:58:44 am

Member
Joined: Dec 2010
Posts: 128

View Profile Email
Slow how? Takes more processing during run time? I thought the code was parsed straight to C++ at compile anyways? Or do you mean because of GML not being definitive in its types that it takes more memory?

So my initial thought was right anyways, that it's best to write the functions within C++ with the instance interator for Josh so that it doesn't have to be parsed during compile?
Logged
Offline (Male) RetroX
Reply #34 Posted on: January 27, 2011, 01:10:10 pm

Master of all things Linux
Contributor
Location: US
Joined: Apr 2008
Posts: 1055
MSN Messenger - classixretrox@gmail.com
View Profile Email
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.
Logged
My Box: Phenom II 3.4GHz X4 | ASUS ATI RadeonHD 5770, 1GB GDDR5 RAM | 1x4GB DDR3 SRAM | Arch Linux, x86_64 (Cube) / Windows 7 x64 (Blob)
Quote from: Fede-lasse
Why do all the pro-Microsoft people have troll avatars? :(
Post made January 27, 2011, 03:45:59 pm was deleted at the author's request.
Offline (Male) Josh @ Dreamland
Reply #36 Posted on: January 28, 2011, 12:54:16 am

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
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
Offline (Unknown gender) MrGriggs
Reply #37 Posted on: January 28, 2011, 04:50:07 am

Member
Joined: Dec 2010
Posts: 128

View Profile Email
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
Offline (Unknown gender) TheExDeus
Reply #38 Posted on: January 28, 2011, 05:27:17 am

Developer
Joined: Apr 2008
Posts: 1860

View Profile
Quote
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
Code: [Select]
for (int i=0; i<10000000; i++){}will work A LOT faster than
Code: [Select]
for (i=0; i<10000000; i++){}
Quote
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:
Code: [Select]
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
Offline (Unknown gender) MrGriggs
Reply #39 Posted on: January 28, 2011, 05:59:43 am

Member
Joined: Dec 2010
Posts: 128

View Profile Email
Yeah, I know how C++ works, I just didn't know if the way ENIGMA compiled it would cause me to have to do this, thanks for clearing that up :)
Logged
Offline (Male) Josh @ Dreamland
Reply #40 Posted on: January 28, 2011, 08:21:07 am

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
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
Offline (Unknown gender) MrGriggs
Reply #41 Posted on: January 28, 2011, 09:40:55 am

Member
Joined: Dec 2010
Posts: 128

View Profile Email
But the .gmk that declares the data types won't work with GM as well wil it? As GM does not allow type casting...
Logged
Offline (Male) Josh @ Dreamland
Reply #42 Posted on: January 28, 2011, 09:50:29 am

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2950

View Profile Email
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
Offline (Unknown gender) MrGriggs
Reply #43 Posted on: January 28, 2011, 09:52:37 am

Member
Joined: Dec 2010
Posts: 128

View Profile Email
LOL, ahhhhhhh. Great!
Logged
Pages: « 1 2 3
  Print