Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Josh @ Dreamland

Announcements / Re: NEW! Windows Zip Installer
« on: April 03, 2013, 08:20:18 AM »
I will test this from school computers on Friday. I'll just go from lab to lab downloading and installing this.

Proposals / Optimizations
« on: April 02, 2013, 10:33:21 PM »
There is a lot of room in a typical piece of GML for optimizations; the kind GCC is not capable of making in arbitrary code. I want ENIGMA's optimizer to be extensible so that we aren't hard-coding a lot of passes into the mechanism. That said, some passes will need hard-coded, and do not seem like a hack to hard-code.

To best avoid hacks, we need to lay out how we want the optimizer to promote extensible lists of things to optimize. To best lay out that framework, we need to know the kinds of optimizations that need made. I will name as many optimizations and classes of optimizations as I can. I've added emphasis to phrases I'm trying to pay attention to, such as what needs to have hard code, what optimizations we can automatically enumerate, and what optimizations we can kickstart through pattern matching.

ENIGMA, as you all know, is typed; I wouldn't call it strongly typed, due to var, but it you can specify strong types explicitly. When you do not specify a type, presently, var is used as the default. This is *terrible*, as var is like half the speed of a regular primitive in terms of raw calculations per second. Even when optimized. Variant, on the other hand, is equally fast as a double.

ENIGMA should, at very least, determine whether the variable is used as an array, and if it is not, use variant. Then GCC will do some inlining magic and, in general, no speed will be lost.

ENIGMA should, preferably, go one step further than that, and determine whether strings are ever assigned to it, and if not, use a double instead. Or, if no reals are assigned, only strings, it should use a string.

ENIGMA should, ideally, then go one step further and determine the slowest data type assigned (in terms of double, fastint_t, and long) and narrow the variable type down to it.

This process will simply be hard coded, but will possibly employ other aspects.
Let's go one step further. The above seem easy to implement, yes? But consider this case:

Code: (EDL) [Select]
var a;
a = choose(1, 2, 3, 4, 5);

We're going to look at two optimizations that can be made to that snippet. An intelligent human would reduce that code to the single line int a = random_integer(1, 5);, but an EDL optimizer could only reasonably be expected to produce one of these outputs:

Code: (C++) [Select]
int a;
a = choose(1, 2, 3, 4, 5);

Code: (C++) [Select]
int a;
a = random_integer(1, 5);

In the first sample output, a is reduced to int, even though choose returns variant. I believe this can be done in an enumerable fashion by having either a macro or an entry in an optimization file to denote which parameter(s) share a potential return type. For choose(), any parameter can define the return type. I can't think of a function that has a specific parameter which can be either real or string, and defines a return type, but I'm sure there is one.

In the second sample output, choose(sequence) is replaced with random_integer(min(sequence), max(sequence)). This is a non-trivial replacement which would need hard coded, though it is possible we could enumerate functions which might need replaced with other functions based on their parameters. This way, implementers would need only supply the name of the funtion and a method/virtual class which does the checking and replacement.

Moving the assignment into the initializer is a potential optimization, though in most languages, it would not make a difference, and the attempt could therefore only serve to cause harm if initialization was not valid for whatever reason.

More simple optimizations exist in other codes. Consider this code:

Code: (EDL) [Select]
b = 10;

It's clear to a human that the first call to draw_set_color does nothing. However, if the assignment b = 10 were replaced with draw_circle(mouse_x,mouse_y,10,0), removing line 1 would cause misbehavior. It would therefore be necessary to have the implementer either specify a list of functions to reference in determining whether two successive function calls of the same type undo each other, or else specify a class/method for examining an AST between two given nodes to make that call for the optimizer.

We then run into a separate, but related, case:
Code: (EDL) [Select]
draw_set_color_rgba(0, 0, 0, 0.5);

The most efficient code output for that is as follows:
Code: (EDL) [Select]
draw_set_color_rgba(0, 0, 255, 0.5);
draw_set_color_rgba(c_red, 1);

But how does the optimizer know to do that? My only thought is that a good pattern to look for would be consecutive calls to related functions in a given set. A class would be provided to give that set of functions, along with hard code to do the merging—how else do we get 0,0,255 out of c_blue? The best we seem to be able to automate here is auto-matching consecutive calls to functions in set A which are not separated by calls to any functions in set B, and then invoking the merge method on the functions from the first set.

I will post more optimizations when I have some more time and am not so tired. I'll also do some proofreading, because I'm sure this reads like ass.

From what I have written here, it looks like the best approach is to have a base class defining a kind of optimization to perform, and then have child classes to carry out a specific operation, which can then have child classes for very similar optimizations. So call-consolidating (as in draw_set_color optimizations above) would be one child of the optimization class, which would employ its own virtual class for specifying sets of functions to consolidate, as described above.

Please do submit feedback; this process is going to need a lot more thought.

I've moved this to announcements to draw some official attention to it. As you are no doubt all aware, Robert has begun an IDE using the wxWidgets library for use specifically in ENIGMA. The two IDEs have similar goals, and seem to be at a similar point in their development stages.

If you are interested in contributing to an IDE for this project, either option seems like a good candidate. My only personal aversion to Qt is in its dependency sizes. While LateralGM depends on the Java runtime, which is itself hundreds of megabytes, Qt's own collection of libraries runs a hefty 100MB. By contrast, wxENIGMA is roughly 10MB on a bare-bones Windows system, and roughly 200KB on a bare-bones Ubuntu system (Ubunu ships with the wxGTK headers, as a lot of its software uses them). I do not know how much of Qt ships with Ubuntu.

I shouldn't need to remind anyone, either, that while ENIGMA itself is only a few megabytes, the MinGW distribution on which it already depends is still in the 150 MB range, so while the Qt binaries are not very small, it's not like they are increasing the total size by orders of magnitude. I'll also point out that MSVS is 2.5GB on disc, and nearly eight gigabytes on disk after install.

That said, both projects still look quite promising.

Also related: Spirit has stated on the IRC that his IDE compiles in GCC, as does the rest of ENIGMA, so there should be relatively little hassle involved in setting up a build for it, assuming you can already build the rest of ENIGMA.

Both projects also share the goal of modularizing resource types. This thread seems as good a place as any for discussion of what all needs modularized and how to go about doing so. For example, it is desirable for the IDE to know of few or no resources without plugins attached to ensure flexibility and modularity, but at the same time, resources are largely interdependent. For example, objects depend on sprites for default sprite and mask settings; rooms depend on backgrounds, sprites, and objects for placing tiles and setting up the scene; paths depend on rooms for displaying a room in the background of the editor; and finally, overworlds depend thoroughly on rooms. How to best resolve these dependencies? Here is a good place for discussion on the matter. Even I'm torn between the option of plugins for plugins (eg, path background rendering plugin) and lists of acceptable resource UUIDs (eg, objects allow any of ["res_sprite", "res_polygon_mesh", "res_3d_model"] for their collision mask.

General ENIGMA / Re: Hardware Diagnosis
« on: March 28, 2013, 11:41:59 PM »

Issues Help Desk / Re: how bypass keyboard ghosting?
« on: March 22, 2013, 03:10:17 PM »
Unfortunately, no; it's a hardware thing. The best you can do is pick other combinations that best suit your keyboard, and try to allow users to do the same. I'm not sure where ENIGMA's keyboard mapping stands, but I haven't heard about it, so I assume it's go.

Keyboard mapping is what you want to allow users to set custom key combinations which work on their keyboards.

You don't need to wait for me or the new parser to do this. Just start moving shit into namespace enigma_user, or whatever, and then use that namespace from the global scope.

It's actually not difficult to make JDI only read a certain namespace, but I'd rather it wait until the new compiler is out just because we'll have to do it twice, and I don't feel like dealing with merge conflicts when I pour master back into enigma-jdi.

Announcements / Re: wxENIGMA Crossplatform IDE in Code::Blocks
« on: March 17, 2013, 08:18:32 PM »
Hello again, Elevory! That IDE is in its early stages. LateralGM will build ENIGMA for you if you download it and place it with the ENIGMA files you get from GitHub.

Off-Topic / Thank you, Seagate!
« on: March 15, 2013, 01:15:03 AM »
Everyone remember to give a huge "Thank you!" to Seagate, incorporated.

The hard drive I bought from them in December—the one with all my development tools and other goodies on it—died on me last Thursday night, so I placed an order for a new drive on Friday morning at 9:00, and paid extra to have it shipped to me via 2-day air.

I should be receiving it tomorrow, a week after ordering it, just in time for my spring break to end. I'll then be spending the next day or two migrating files, and should be all done and ready for action by the time school resumes.

Announcements / Re: wxENIGMA Crossplatform IDE in Code::Blocks
« on: March 12, 2013, 08:47:08 AM »
And what is wrong with continual syntax checking that makes intellisense so much better?

Announcements / Re: wxENIGMA Crossplatform IDE in Code::Blocks
« on: March 11, 2013, 12:44:03 PM »
He's talking about where the compiler fills the console with bullshit errors after the first syntax error makes it impossible to decipher the rest of the code.

I lol'd.

Now they'll have to add five more ads to Skype to pay for the suit.

Off-Topic / Re: Unity Dash Being Rewritten In QT/QML
« on: March 09, 2013, 10:55:56 PM »
Great; exactly what the open source world needed was Shuttleworth's take on what is already a clusterfuck of a desktop environment.

Announcements / Re: wxENIGMA Crossplatform IDE in Code::Blocks
« on: March 05, 2013, 05:28:38 PM »
I never disagreed to that, Robert. Version control is half the reason we chose to develop EGM as we did. It was 100% of the reason we chose to add directory versions to its specification.

The reason we offer an archived version is because some users like their source to be a single module, and Zip is a very developed format for that sort of thing. Even if LGM/wxE did corrupt the zip somehow, very good recovery tools exist for Zip. Zip's also relatively fast (though not as fast as the uncompressed directory version).

But, again, the EGM specification says it should support both.

Announcements / Re: wxENIGMA Crossplatform IDE in Code::Blocks
« on: March 05, 2013, 03:09:08 PM »
I'm not certain how to do that myself, actually; it's been a subject of interest of mine for some time. I think that Java provides a frontend for it, but I imagine we'd need to look into how to do that on each of POSIX and Win32 for the purpose of this IDE.

Announcements / Re: wxENIGMA Crossplatform IDE in Code::Blocks
« on: March 05, 2013, 08:50:27 AM »
Could I get you to elaborate on that a bit more, forthevin? The EGM file format is just a filestructure; it's nostalgic to compression and archive format. What I mean is, you can use EGM files as simple directories, by its specification (not sure where LGM's support on that stands). That said, version control for your project is presently (supposed to be) as easy as your platform makes it. What, specifically, would you like the IDE to do on top of that?