Pages: 1
  Print  
Author Topic: GM5 Compatibility plugin --feedback requested  (Read 6991 times)
Offline (Unknown gender) sorlok_reaves
Posted on: January 07, 2014, 01:21:03 am
Contributor
Joined: Dec 2013
Posts: 260

View Profile
Hello all, looking for some advice on a plugin I've been working on for GM5 compatibility in Enigma. Branch is here:
https://github.com/sorlok/enigma-dev/tree/gm5_compat

Basically, I've been working on getting Iji running in Enigma. To that end, I've pushed a few bug fixes here and there. Combined with the branch linked to above (which I do NOT recommend merging; it's buggy and hackish) the game basically starts:
http://i.imgur.com/aXG69zA.png

I'd like some feedback on the idea of GM5 compatibility in general. Currently, I'm doing it all through a plugin, including the following:
  • I've duplicated functions like draw_rectangle(), since GM5 does not provide an "outline" parameter. JDI finds these duplicates just fine, but perhaps this affects argument validation?
  • My duplicate draw_*() functions take pen_size into account and use draw_line_width() to mimic GM5 wide outlines.
  • pen_color, brush_color and other "magic" global variables are added as top-level static variables in the plugin.
  • draw_text_sprite() and draw_polygon*() were also implemented. These might be useful for other games, or they might be too niche, and should be left in the compat library.
  • There are some outstanding issues on C++ keywords being used as variable names (e.g., "short") that will inevitably have to be addressed.

For now, my approach to GM5 compatibility has been to keep as much as possible isolated in a plugin, so that compatibility can be turned "on" or "off" easily. This makes sense to me, but I figured now would be the best time to start discussing this.

Thanks, and happy coding. :)
Logged
Offline (Unknown gender) TheExDeus
Reply #1 Posted on: January 07, 2014, 09:10:58 am

Developer
Joined: Apr 2008
Posts: 1860

View Profile
If there is a limited amount of GM5 games you wanna run then I think it would take less time and effort to just port them. Right now we are basically slightly breaking even GM8 compatibility as we strive for GM:S now. I also write games only in ENIGMA and I use ENIGMA specific features (like data type) and so I cannot port back to GM anyway.

About the issues - I used GM5 ages ago (probably more than 10 years now), so I cannot remember how it worked. Draw_text_sprite is something we could implement straight into ENIGMA. But if you really want to add this (especially as an extension) then I guess you are on the right track. draw_polygon*() functions can just be wrappers of draw_primitive() functions. You use draw_line_width() for draw_rectangle and draw_ellipse and that can be a bit slow (as every draw_line_width() involves a cos() and sin()), but I guess it won't be much of a problem unless you use it hundreds of thousands of times. In GL3 graphics system they also will be probably batched together in one draw call.
Logged
Offline (Male) Goombert
Reply #2 Posted on: January 07, 2014, 09:47:41 pm

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 2993

View Profile
Wow, I am surprised I was not aware GM5 had those differences. Also, sorlok, I loved your contributions so far they were good! Allow me to address some of your issues.

Quote
There are some outstanding issues on C++ keywords being used as variable names (e.g., "short") that will inevitably have to be addressed.
This is actually why we namespace everything in engima_user and keep it separate from the enigma namespace.

Quote
I've duplicated functions like draw_rectangle(), since GM5 does not provide an "outline" parameter. JDI finds these duplicates just fine, but perhaps this affects argument validation?
Well if you want, you could simply add those functions to the main repositories as overloaded functions.

In fact, I'd be fine with you merging all of that into the main repository, as long as it does not break future compatibility. As in you overload functions and keep things separate so both versions can be used side by side.

Other than that though, keep up the good work sorlok!
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) time-killer-games
Reply #3 Posted on: January 07, 2014, 09:55:13 pm
"Guest"


Email
That's great! Now all we need is a GM 4.3 GMD reader, then we will officially support virtually every half decent release of GM in history. But this is good enough. Thanks for everything! =)
Logged
Offline (Unknown gender) sorlok_reaves
Reply #4 Posted on: January 08, 2014, 10:55:52 am
Contributor
Joined: Dec 2013
Posts: 260

View Profile
Thanks for the excellent feedback everyone. I've been really impressed with the community here so far. :)

Let me address a few specific replies:

If there is a limited amount of GM5 games you wanna run then I think it would take less time and effort to just port them.

My first step when looking at Iji was to manually "port" all incompatibilities, and the scope was pretty massive. I feel like a lot of GM users won't even consider ENIGMA unless they can Load+Run an existing game.

Well if you want, you could simply add those functions to the main repositories as overloaded functions.

In fact, I'd be fine with you merging all of that into the main repository, as long as it does not break future compatibility. As in you overload functions and keep things separate so both versions can be used side by side.


I'll prepare a clean branch then, and I'll move the generally useful stuff (draw_text_sprite(), draw_polygon()) to Graphics_Systems/General. I still prefer to keep certain GM5-specific stuff in a plugin for now. I feel that functions like draw_rectangle() and magic variables like pen_size are just going to confuse GM6+ users, and (as TheExDeus mentioned) they may be slow. I'd like to leave these particular constructs in Universal_System/Extensions/GM5Compat.

That's great! Now all we need is a GM 4.3 GMD reader, then we will officially support virtually every half decent release of GM in history.

I wonder how much of the backend 4.X shares with 5.X. I know 6 broke a lot.





Logged
Offline (Unknown gender) The 11th plague of Egypt
Reply #5 Posted on: January 08, 2014, 06:09:32 pm
Member
Joined: Dec 2009
Posts: 274

View Profile
I feel like a lot of GM users won't even consider ENIGMA unless they can Load+Run an existing game.
...
I know 6 broke a lot.
I don't think GM 6.1 could "load and run" a GM 5 game straight away.
I remember there was some kind of external converter, but even that required manual intervention after the first pass.
Want me to try and find it out for you?

EDIT: the converter was from v4 to v5
I still have it ;)
« Last Edit: January 08, 2014, 06:22:06 pm by The 11th plague of Egypt » Logged
Offline (Unknown gender) sorlok_reaves
Reply #6 Posted on: January 09, 2014, 02:16:24 pm
Contributor
Joined: Dec 2013
Posts: 260

View Profile
EDIT: the converter was from v4 to v5
I still have it ;)

Wow, that's pretty amazing, all the way back to 2002! It'll be some time before I look at v4, but thanks!
Logged
Offline (Unknown gender) The 11th plague of Egypt
Reply #7 Posted on: January 10, 2014, 03:31:07 am
Member
Joined: Dec 2009
Posts: 274

View Profile
Here it is. I have 2 different versions.

https://www.mediafire.com/?8y9xzrerinrez59
https://www.mediafire.com/?cvb00kc63g03wms

BTW i would look into converting GMD to GM6 (or GMK) instead of supporting the format as-is.
« Last Edit: January 10, 2014, 03:35:46 am by The 11th plague of Egypt » Logged
Offline (Unknown gender) TheExDeus
Reply #8 Posted on: January 10, 2014, 09:15:55 am

Developer
Joined: Apr 2008
Posts: 1860

View Profile
Things like draw_polygon*() seem to be exactly like draw_primitive*(), so I don't think we should include them in main. That will only confuse people, as they will start using functions that are from 2002 and clearly shouldn't be used. So while I am ok for this being a plugin (and disabled by default) I think that only few functions (like draw_text_sprite) should be added in ENIGMA's main.

Quote
I feel like a lot of GM users won't even consider ENIGMA unless they can Load+Run an existing game.
Yeah, but we don't really target the GM5 crowd (from which you are the only known person that I know). Originally we wanted ENIGMA to be something where you Load and without modifications Run an existing game. But as it is not even possible in GM (when a GM version changes) then we kind of abandoned the idea. We want the modifications to be quite minimal (like GM8 games will probably work without any changes in ENIGMA), but supporting deprecated functionality is no longer our goal. That will only bloat the engine and will make users accidentally use the deprecated functions. I think ENIGMA should be used just like GM - from the game's projects beginning. So instead of trying to load a GM game and then fighting with incompatibilities or bugs, people should just try code from scratch in ENIGMA. I do that all the time and that is why I think ENIGMA is mature enough, as I can create everything I could in GM with ENIGMA. And even more.
Logged
Offline (Unknown gender) sorlok_reaves
Reply #9 Posted on: January 10, 2014, 11:58:29 am
Contributor
Joined: Dec 2013
Posts: 260

View Profile
Since everyone seems to agree on draw_text_sprite(), I'll prepare a branch for that.

In terms of polygons, there's one thing I should clarify:  GM5's "draw_polygon()" can handle concave and self-intersecting polygons. Like this one:
http://en.wikipedia.org/wiki/File:Complex_polygon.svg

This requires Platform support (my approach with OpenGL is GLU tessellation; I'll figure out something for DirectX9 later), as triangle fans just won't cut it for non-convex polygons.

Regardless, I'll put features wherever the devs want them; just wanted to clear up a point on GM5's polygons.

Edit: Bug-fixing went a lot faster than expected, so this feature is now ready. Moved the discussion on draw_polygon() here; other GM5 compat can stay on the current topic.
http://enigma-dev.org/forums/index.php?topic=1704.0

@The 11th plague of Egypt: Thanks!
« Last Edit: January 10, 2014, 04:34:59 pm by sorlok_reaves » Logged
Pages: 1
  Print