Josh @ Dreamland
|
 |
Posted on: May 02, 2009, 12:09:17 pm |
|
|
Prince of all Goldfish
 Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
Questions that have been haunting me since day one, and I'm sick of dealing with them, so I'll present them to my user base. - Var can't return int, string, double, and char*. It just can't; it leads to ambiguity out the back end to where your game won't compile.
Knowing this, do I have all the functions take double and string as parameters (a 100% waste of memory and at least 800% waste of speed), or do I alienate std::string as a return type? Neither of those are very attractive choices. There is a middle option where I have the user decide whether or not they want to keep var as a type, and re-compile ENIGMA optionally to take scalar arguments. (Scalar meaning one type, in this case of the smallest needed size) I will try again to get var to work with conflicting cast types, but std::string is the one that causes ambiguity. Even though I added an explicit cast function for it in var. (Meaning I told it exactly what to do to convert var to string, but it errored anyway.) - Game Maker does not have functions that don't return anything. Even functions in GM that return nothing will actually behave as zero, and can be used in assignment and arithmetic. This isn't the case in C++.
For the first three releases, I returned zero in all those functions, as int for max speed. Why not do away with them? Some people like to add a function that needs called but returns nothing to a function that must be called after the first function, in order to call them in one statement. Like registry_set_root(3)+registry_read_real_ext("blah","blah") That's an ugly, yet useful feature of the language. I was considering having function return ENIGMA_VOID, and the return statement at the end be return_void;. This would enable the user to choose whether or not to do this and recompile. - Game Maker does not return success or fail. Especially for functions like registry_write_string(). A lot of functions that are VERY prone to failure have unclear methods or no method at all of determining whether it worked.
Should ENIGMA return error codes as WinApi does? For registry functions, this would also eliminate combining things like registry_set_root(3)+registry_read_real_ext("blah","blah"), though since registry_set_root will never fail and the latter returns nonzero normally, that's not exactly the best example here. Maybe a function to check if the last calls succeeded? - WinApi has developed some since its first release in 1912. As such, we have a set of 16 bit functions that are preserved for compatibility with 95 and 98, but then more recent functions that are meant for 2000+ and may not work on really old Windows systems.
The problem here is, do we stick with the old ones and risk being obsolete come Windows 7, or do we lose 95 and 98 compatibility and go with the new? Again, this can be fixed by compiling separate releases for each operating system, but that's not exactly attractive as an option. There are plenty more conflicts, but these are just a few that are immediately bothering me. If you haven't guessed, registry functions have been implemented. College classes are nearly over; I have a huge take-home final exam to worry about this weekend, followed by 23 more days of high school. But then I'm done, and will actually have a decent amount of time to work. I hope.
|
|
« Last Edit: May 02, 2009, 12:24:10 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 #2 Posted on: May 02, 2009, 02:56:21 pm |
|
|
Prince of all Goldfish
 Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
I'd have to agree with that.
For Linux and Mac, I was thinking about writing it to the var folder, if permission allows, because I'd really rather not store things like that in the same folder as the game, for obvious reasons. Not so much for security, considering the registry really isn't as hidden as GM users would like to believe. In fact, I don't think security of it would really be a problem: If you're on Linux, chances are you already know what Windows' system registry is anyway, so putting it in a nearby file wouldn't make much of a difference in that respect. Here, the real beauty of the registry (or writing to var/ in Linux' case), would be that the game could still access the data, even if it the game's file was moved without the registry file.
Thinking about it, Windows' registry is also used for associating file types. To be honest, I'm not sure how that works on Linux, so that'd require some research... It'd probably never be compatible anyway. But ENIGMA wasn't really intended to need to associate file types anyway, and if the need arises, I can always make a built-in function for that.
|
|
|
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
|
|
|
|
RetroX
|
 |
Reply #4 Posted on: May 03, 2009, 07:33:14 am |
|
|
Master of all things Linux
 Location: US Joined: Apr 2008
Posts: 1055
|
Yeah, GNOME does have Gconf, but I really go against using it. Just create a fake registry as a file in the same folder with the values in it. I see that as being simpler, and you could modify the name of that file in the game settings or something.
For compatibility, how about having multiple versions that support different compatibility? I mean, you could have one that has 16-bit and 32-bit functions, and another that has 32-bit and 64-bit functions. You could change which one you compile in the settings.
As for functions, you could check if it doesn't return anything and make the function return void or simply be void. For var... would it be possible to check what type the variable is from the beginning and use that type from start? I mean, you can't change a string var to an int, so I really see no differences. Of course, the only real thing you would do is make every number a double so that decimals can be used.
|
|
|
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? 
|
|
|
Josh @ Dreamland
|
 |
Reply #5 Posted on: May 03, 2009, 09:46:10 am |
|
|
Prince of all Goldfish
 Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
Every number is currently a double. Which is the problem; doubles are slow. And yes to the MIME types. But I don't know where that data is stored. I've used GConf, for setting hot keys system wide, but I don't know where it keeps that info. Ism was looking into ext/ just yesterday, and turned out to not have permission to write to it except when she was root. So that's no good either.
And again, I'm sort of opposed to the idea of keeping the registry file in the main directory. Ism suggested a hidden folder on the user's home directory. Since GM uses registry_set_root for some BIZARRE reason, (it's almost like GM was meant to be cross platform), I could easily rig it to change locations of where I'm writing. But I don't think I'd have permission to put anything on the root of the drive, either. If I did, though, registry_set_root could simply change the directory I write the registry info in.
Also, Retro, I don't want to make a separate release for each group of Windows platforms. I'll stick with the idea of allowing it to be recompiled for older systems. LGM can probably make calls to ENIGMA to rebuild parts of itself for different platforms, since GCC will always be available.
|
|
|
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
|
|
|
|
Quadduc
|
 |
Reply #7 Posted on: May 03, 2009, 11:45:38 am |
|
|
LateralGM Developer
 Joined: Apr 2008
Posts: 15
|
The usual way for user programs to store settings on GNU/Linux is to store it in a hidden directory in the user's home directory, so each game could have a file like "~/.enigma/registry/$gameid". This should be good for most games. System-wide settings are in /etc. Non-root users can read some of the files there, but not write to any of them, of course. For file association, I have a directory named "~/.local/share/mime" that maps file extensions (and possibly file contents like magic numbers) to mime-types, and a file named "~/.local/share/applications/mimeapps.list" that maps mime-types to applications. This may be distribution-specific. Edit: See the XDG Base Directory Specification at http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
|
|
« Last Edit: May 03, 2009, 11:53:59 am by Quadduc »
|
Logged
|
|
|
|
Josh @ Dreamland
|
 |
Reply #8 Posted on: May 04, 2009, 05:14:56 am |
|
|
Prince of all Goldfish
 Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
Game_boy-- Not for ENIGMA, just in general to see what my options are. There aren't any ENIGMA functions that depend on it yet. I don't want to set a release date, but I'm hoping a month, maybe two. It's a lot of time, but I want all the bugs out, and I want the system to be at its best and most solid. With all the other releases, I've left room for improvement. With this one, I'm trying to leave only room for additions. And yeah, I know it's been a while. Sometimes I forget how long a while, and then I remember, gee, the last release of ENIGMA still takes more than a few seconds to compile. But I'm pulling out all the stops.
Quadduc-- Hero for the day.
|
|
« Last Edit: May 04, 2009, 05:17:13 am 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 #14 Posted on: May 05, 2009, 02:18:40 pm |
|
|
Prince of all Goldfish
 Location: Pittsburgh, PA, USA Joined: Feb 2008
Posts: 2950
|
Sprintf(), all of the C++ world hates you for no reason at all. Go away.
Also, I'm not dumping useful Windows functions just because Linux and Mac don't have something just like it. That's what SDL did; it's a wonder SDL even creates a window for you since it provides no interface to manipulate it. <_<
|
|
|
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
|
|
|
|