General fluff => Announcements => Topic started by: Josh @ Dreamland on February 03, 2013, 01:17:18 PM

Title: Iji
Post by: Josh @ Dreamland on February 03, 2013, 01:17:18 PM
I was approached today by someone on the IRC regarding an apparently quite famous game made in Game Maker 5 and re-released for Game Maker 7. By the sounds of it, a lot of you should have heard of it. The game is Iji, by Daniel Remar. You can view it and download it from his home page here:


Apparently, the race is on to get the project ported to other operating systems, and GM is (for whatever reason) out of the question. It seems to me like this would be a good place, strategically, for ENIGMA to make an entrance.

There is a discussion open on the Cave Story forums, for those who are interested in a little related literature:

It seems that the biggest obstacles standing between the game and working on ENIGMA are timelines and name conflicts, which I guess are both a bit overdue. Unfortunately, it'd be unwise to add them to the old compiler with the new one so close to being finished, so I guess the work is going to largely involve me.

I will try to commit some time to getting that pretty printer written and plugged in to the current system. I'd appreciate it if someone else could go through and see what other functions are missing from the game. That probably means you, polygone.

Just posting this here as an FYI. Thoughts on the endeavor are welcome.
Title: Re: Iji
Post by: TheExDeus on February 03, 2013, 05:33:11 PM
Looks interesting. If by "name conflicts" you mean resources having the same name, then that is something that should be fixed in the game itself. So just by renaming stuff in the source. And timelines are usually rarely used, but I guess someone should add them, so I guess its you Josh.

I will check the game when I have the time (from screenshots it looks good), but I can't find the source. The link on the page you posted has a compiled version (though the .exe is 17mb or something, so there could sadly be hundreds of resources.

Edit: Also, someone should maybe post in that forum just so they know this could also be an option. Now they want to use Mint and Java...
Title: Re: Iji
Post by: Josh @ Dreamland on February 03, 2013, 11:55:42 PM
I don't know that they could help if they wanted.

An issue is that I was wrong; this game was not re-released in GM7. Only some of his other titles were. So we still need to fix references to variables like draw_color, in place of draw_set_color, etc. Perhaps they'd be interested in doing some of that grunt work, but then, why not just build it in GM? Other than the price, of course.
Title: Re: Iji
Post by: forthevin on February 04, 2013, 06:18:53 AM
TheExDeus, the source can be found under the resources section on Daniel's website, in the first source/resource pack.

I think one major reason why they might want to use ENIGMA over GM is that ENIGMA can be customized or extended far more than GM. In the email in the linked thread, Daniel writes that there are large differences between how graphics and sound in GM5.3 and GM8 are handled, and some of these differences may be difficult or impossible to handle well if porting to GM8 (for instance, I tried compiling Iji in ENIGMA, and one function that is missing is screen_gamma. I know that it could be either implemented or simulated accurately in ENIGMA, but I don't know if the same is the case for GM8).

As far as I can see it, the best way they could use ENIGMA would be to fork it, and for some parts of the port of Iji to Mac and Linux, adapt the engine to Iji, and for other parts, adapt Iji to the engine, depending on what is the best choice for each part. Some of this effort wouldn't benefit ENIGMA directly, apart from showcasing how useful ENIGMA's ability to be customized or extended is. Other parts of the effort would benefit ENIGMA directly, since these parts would involve implementing functions that are currently missing or would be useful to the main fork of ENIGMA.

That said, I think this general idea - porting great GM games to Mac and Linux through ENIGMA - has a lot of potential. There are a number of great games which are made in GM6, GM7 or GM8, and getting these games running in ENIGMA should be much easier than getting games made in GM5 or earlier running. If some of the authors of these games are interested in having their games ported to other platforms, we could either help do it for them or help them with it, and porting these games would demonstrate what ENIGMA is capable of. I personally believe that the idea should be postponed until later, since ENIGMA is still missing some important features (built-in game saving/loading, full inheritance, custom events, etc.) that most or some of these games are likely to use, but it is still useful to keep in mind while ENIGMA progresses.
Title: Re: Iji
Post by: Josh @ Dreamland on February 04, 2013, 11:11:57 AM
Our IRC friend compiled the complete list of missing functions for this game for us:

    void background_restore(int back);
    int draw_polygon_begin();
    int draw_polygon_end();
    int draw_polygon_vertex(double, double);
    void draw_text_sprite(int x,int y,string str, int, int, int, int, int);
    void keyboard_clear(int key);
    void keyboard_set_map(int, int);
    void keyboard_unset_map();
    void screen_gamma(float, float, float);
    void set_graphics_mode(int, int, int, int, int, int, int);
    int sound_add(string fname, int kind, int, int);
    void sound_discard(int sound);
    void sound_frequency(int sound, float value);
    void sound_restore(int sound);
    void sprite_restore(int);
    void tile_layer_delete(int);
    void tile_layer_hide(int);
    void tile_layer_shift(int, double, double);

As you can see, a few of them are trivial. What this list excludes, however, is pitfalls like you mentioned, forthevin, and as I mentioned in the post before: The draw functions are very different.

Now, we can simulate GM5's draw options (such as draw_color = c_red) using multifunction_variant instances. That's easy. The issue is finding all of those differences. If anyone has them documented, it's IsmAvatar. Otherwise, we'll need to either go digging for Mark Overmars' original release on the subject, or compile a list of them ourselves.

Legacy mode for GM5 games might not be out of reach, and it might be worth the investment to attract more of these cases.
Title: Re: Iji
Post by: forthevin on February 04, 2013, 03:22:10 PM
First off, I found some sources for documentation on the YoYoGames wiki, they provide manuals for GM 5 and GM 6: http://wiki.yoyogames.com/index.php/Old_Game_Maker_Versions

Second off, using the provided list by making empty implementations in definitions.h, as well as some minor modifications (including redefining names like "pause", "rand", etc. through "#define", as well as changing a single "instance_destroy = 0" to "instance_destroy()"), I managed to make the compiler accept the file.
This uncovered some scaling issues. First, the parsing part of the game took a long time, even though it didn't take much memory or CPU usage. It seemed to pause or wait several times during the "Add dot accessed local" part of the process. Given that it didn't require much memory or CPU usage, I assume this part was IO-bound. It should be noted that I have a standard, slow hard disk. Maybe a computer using an SSD would do this part faster.
After this part, gcc began compiling. This part had high CPU usage, and the memory began spiking as well, with upwards of 1 GB of memory used. There was a lot of compilation errors, so I didn't get the game to run after the process. However, I thought this memory usage was quite high. I then looked at the file sizes in the preprocessor part.
The biggest file was IDE_EDIT_objectfunctionality.h, of size 13.4 MB. It is also 410691 lines long. Other big files included IDE_EDIT_roomarrays.h (4 MB) and IDE_EDIT_objectdeclarations.h (2 MB).

I guess the main conclusion of this is that Iji is definitely a massive game in terms of code, and that it is an excellent test case to test the scalability of ENIGMA's parsing and compilation. I don't think pursuing Iji and GM5 compatibility is worth it right now, but after the parser is done and has been tested with other games/test cases, I think Iji and GM5 would be an obvious goal to pursue.
Title: Re: Iji
Post by: Josh @ Dreamland on February 04, 2013, 03:51:15 PM
Your post makes me want to start drinking coffee.

Holy shit.


Okay, so it may be time to invest in the idea of pre-compiling the majority of shellmain.h and writing objects to individual source files, each including that header. Functions such as instance_create would then need to use a virtual class instance or function pointer to do the allocation. This process would not only allow us to compile objects individually (which is apparently a fucking must for big objects) but would also ensure that it's possible to add objects to the game dynamically by loading them as DLLs.

This will be great for the ultimate resurrection of R3's "Build Mode," hereafter "Design Mode."

Another concern to address for both venues is the idea of scripts. Right now, I do funny things with scripts. I try to scope scripts into calling objects, and then create a global version of the script for use with, eg, script_execute(). This behavior is worth preserving; objects which call scripts will need to be rebuilt when that script is modified, anyway, to ensure that all required locals are present. That being the case, we may as well continue to scope scripts into objects so that they can be called in a way where the structure of the object pointed to by this is known (instead of using the built-in access routines, which I'd guess are about a quarter as fast at best).
Title: Re: Iji
Post by: forthevin on February 04, 2013, 06:13:56 PM
Sounds good.

Also, I followed TheExDeus' suggestion and posted on the thread informing them about ENIGMA and the possibility of using it to port Iji.
Title: Re: Iji
Post by: Josh @ Dreamland on February 04, 2013, 10:09:24 PM
Thanks. I assumed their reaction would be roughly to the tune it adopted, but I suppose it was worth the post.

Anyone know how to clone me?
Title: Re: Iji
Post by: forthevin on February 05, 2013, 01:30:34 PM
The OP of the thread did offer to help test an ENIGMA port of Iji, so that is something.

Nope, no idea about how to clone you.
Title: Re: Iji
Post by: DarkAceZ on February 07, 2013, 07:37:38 PM
Josh, marry Ism. Then we can have a java and C++ dev.
Title: Re: Iji
Post by: Josh @ Dreamland on February 07, 2013, 08:45:58 PM
Marriage is neither necessary nor sufficient for procreation.

Also, I fear the world could not handle such a creature, were it to exist.

Not to mention the wait.
Title: Re: Iji
Post by: IsmAvatar on February 07, 2013, 10:17:06 PM
If my womb works at the same time-frame as me, I'd imagine a 9 months gestation period would only be a couple months in real-world time. But then the question becomes, how do you impregnate a person who only exists in virtual form?