|
Post made December 27, 2009, 10:31:53 am was deleted at the author's request.
|
|
RetroX
|
|
Reply #3 Posted on: December 27, 2009, 01:27:06 pm |
|
|
Master of all things Linux
Location: US Joined: Apr 2008
Posts: 1055
|
This is grea... Programming tip 7: write in pseudo-code before actual code. It’ll make it easier to understand the code structure, giving you a better opportunity for optimization and finding new methods of accomplishing goals.
Well, err... use JPG for compression
WHAT IS... GIF
THIS... Game Design tip 1: to brainstorm efficiently, write the subject name on a piece of paper and then repeat the following: write a few related words right next to the current word, write synonyms using an (online) synonym wordbook, and continue to the next word.
THIS IS NOT ENGLISH CLA... Sound tip 1: to apply a surround effect to your sound, increase the bass on the left and increase treble on the right. As a side note, to simulate front/back sound effects, increase reverb when the sound gets behind you.
AAAAAGH *explodes* @luiscubal: More like, use types wisely. Use size_t whenever you're deciding the size of something, and char, short, long, and long long depending on what you're storing a number for (and unsigned/signed).
|
|
« Last Edit: December 27, 2009, 01:29:45 pm by RetroX »
|
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)Why do all the pro-Microsoft people have troll avatars?
|
|
|
Post made December 27, 2009, 02:33:28 pm was deleted at the author's request.
|
|
|
Post made December 27, 2009, 05:45:20 pm was deleted at the author's request.
|
|
Post made December 27, 2009, 05:54:49 pm was deleted at the author's request.
|
Josh @ Dreamland
|
|
Reply #10 Posted on: December 27, 2009, 06:59:24 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
Few bones to pick.
Tip 5. Switch statements are nice in a real language, not in GML. The problem with switch() in GM (and ultimately in ENIGMA) is that a real switch statement uses integers alone. And only constants. None of that "case hspeed:" shit. ENIGMA will only be able to generate an efficient switch() statement if the 'arguments,' if you will, sent to the case labels are constant integers (Preferably literals [like 0, 1, 2...], though consts like c_red are fine).
Tip Luis. ...That tip is practically useless here. In C, it'd be helpful, but this isn't C anymore, and the assumption is that a good C programmer knows that. In C++ (and therefore ENIGMA), std::string::size() operates in constant time. for(size_t i = 0; i < somestr.size(); i++) is just as efficient as if you had precalculated it. (Save some decrementing and dereferencing, which would probably be optimized anyway). For best practice, I suppose it would be a good idea to declare it as const, assuming the size of the loop doesn't change (which it is prone to, anyway), but I don't see it as necessary, and it's probably a bad idea to tell people to do that when it'll end up costing some poor bastard's loop to end early (or, God help him, late). Furthermore, if the size wasn't going to change, and you are only incrementing i by one each iteration, for (size_t i = 0; somestr[i ]; i++) would be your best bet.
|
|
« Last Edit: December 27, 2009, 07:01:50 pm by Josh @ Dreamland »
|
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 #13 Posted on: December 27, 2009, 09:31:45 pm |
|
|
Prince of all Goldfish
Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
Actually, you're both wrong. The result is what you would get if you cast the string to int*, subtracted 2, and dereferenced. String is just a char* prefixed with a length followed by a reference count, representing the number of objects sharing that pointer.
What I mean by that is that for each string, or each shared string, somewhere in memory is an int for length followed immediately by an int for number of objects sharing the string, followed immediately by the string itself, not a pointer to it.
|
|
« Last Edit: December 27, 2009, 09:38:45 pm by Josh @ Dreamland »
|
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
|
|
|
|
|