csanyk.com

video games, programming, the internet, and stuff

Category: development

Mega Maker

Mega Maker is to Mega Man what Mario Maker is to Mario.  Except, it’s not an officially licensed Capcom product, and it’s free. Built by fans using GameMaker, it’s probably the best thing I’ve ever seen built out of GameMaker.

It’s awesome.

It’s very easy to use, and a lot of fun. Not that you really need it, but there’s a tutorial that explains everything in the editor with great style.  Actually, the tutorial is very well done and I recommend using it to understand some of the finer points.  But most of the point and click interface is intuitive to anyone who’s used a mouse-driven interface and knows a thing or two about Mega Man.

Mega Maker

I had my first level built and running in about ten minutes.

Unfortunately it only includes a small sample of the Mega Man resources from the first six games on the NES, but even so there’s a lot that you can do with the designer. There doesn’t seem to be any provision for designing your own enemies, bosses, or adding your own sprites or music.  On the other hand, there’s zero coding needed, and it’s easy enough to use that an average grade schooler could get up and running designing levels in no time.

There’s an online community for uploading your level designs and downloading and playing the designs of other players.

So much work has gone into this, and it holds so much promise. I hope that Capcom sees fit to muzzle their legal team.  If you’ve ever enjoyed a classic MM game, you really need to download this and give it a try.

Super Greedy Ghost Grab – A Cleveland Game Developers Summer Jam

This weekend, I took part in Cleveland Game Developers Summer Game Jam 2017. This year, I worked with a team consisting of Wally Pease, Bobby Lauer, and Colin Wolfe.

Our project, Super Greedy Ghost Grab, turned out really well. I really enjoyed working with our team, and I think everyone executed on our project extremely well.  The deadline build isn’t perfect (and no game jam project ever is, so that’s not a knock on what we did). I’m very happy with what we were able to do in 48 hours.

Super Greedy Ghost Grab

The theme for the jam was announced: Identity. I didn’t have any good ideas at first, but eventually our team decided to make a game about a ghost who can “possess” things, becoming them, and assuming their identity.

At first we were going to have the ghost possessing people, but we quickly realized that the scope of such a project would be unmanageable for the time and resource constraints we would face, so we decided instead for the ghost to possess objects.  To give the game a story, we decided to put the ghost in an art museum, and made the ghost an art thief, who must avoid detection by a security guard.

I came to the jam intending to work with Wally, but Bobby and Colin joined us and were very productive members of our team.  We had two full-time artists (Bobby and Colin) and two programmers (Wally and me).  Wally also recorded sounds and did some of the art as well. Between the two of us, he even did the bulk of the programming, laying out the main engine, player, and “possessable” art object, while I provided the “googly eye” effect for the possessed art objects, and implemented the guard, and also lent a hand with debugging, polishing, and general play testing.  In addition to providing some of the art for the project, which included the Ghost and Statue sprites, and floor tiles,  Bobby also did our level design. Colin contributed the guard sprite, the diamond, the vase, the paintings, and the pillars, and also touched up and organized the wall tiles. Their artwork was excellent, and they were able to produce exactly what the project needed.  Everyone’s art worked well together, too, which I’m not sure how that happened, but it’s impressive that three different people working on art could come up with a consistent and seamless style.

This was my first game jam where I got to work with another programmer and shared programming duties. I found that things went very well overall. We had a few hitches when merging code, but nothing terrible. We didn’t use a formal version control system, which was part of the problem. At first we relied on Google Drive to share files between team members, but when it comes to uploading revised versions of files to Google Drive, some very strange things started to happen. Apparently when a user “deletes” a shared file on Google Drive, it remains available to the other users who have access to the shared item.  Replacing the file with a newly uploaded copy doesn’t replace the original copy, and instead results in multiple versions of the same file.  This created a lot of confusion at first, until I realized what was going on.  At that point, we switched to using Dropbox, and handled code merging using BeyondCompare to handle comparing and moving the code files in the project .gmx.  Wally and I sat side by side, which made it a reasonable way to handle merges. This worked passably well, BeyondCompare made it very easy to merge our changes. But I believe that a true version control system would have been even better.

We also were able to communicate with each other as needed, and be a second pair of eyes for each other whenever we had a “wtf?” moment. I’m really excited about working with Wally more in the future, and would be happy to have more chances to work with either Bobby or Colin again as well.

YoYoGames announces GameMaker Studio 2 Console build targets, Ultimate Edition

Coming with the release of GMS2.0.7, YoYoGames have released Console modules to allow developers to build for Microsoft XBox One and Sony PlayStation 4. There is as yet still no module to allow development targeting the Nintendo Switch.

The cost for these console development modules is $800 for 12 months. Each.

Additionally, customers who purchase a console module must be a registered developer program for the console in question.

Or, for “just” $1500/year, you can subscribe to GMS2.0 Ultimate Edition, which seems to be a response to popular demand to bring back the “Master Collection” package. Ultimate Edition is an “everything and the kitchen sink” bundle that includes any future modules that YYG may release for no additional cost. The price of Ultimate is much higher than the cost for Master Collection , however, and is subscription-based, rather than a perpetual license. GMS1.x Master Collection was originally introduced at a 1-time cost of $500, later $800.

Readers may recall that I predicted that YoYoGames planned to move GMS2 to a subscription model, and that their license activation was in fact already a de facto a subscription model, and today’s announcement bears out that assessment.

YoYoGames confirmed that the existing modules (Desktop, Mobile, HTML5, UWP) remain a permanent license that you pay for once. However, it’s been YoYoGames’ practice in the past to charge again for the product when it hits the next major release number. Accordingly, YoYo could, if it wanted, release GMS3.0 next year, and charge everyone for an upgrade to that, and drop support/updates for 2.x, effectively forcing everyone to pay for another upgrade at that point. It’s a good bet that at some point they will switch to a subscription-based model at all tiers.

YoYo seem to be pricing themselves out of the market with this announcement. While it’s not unreasonable to charge a premium for the console build targets, the price points announced today do not compare favorably with the competition. Unity3D is also subscription-based, now, but you can get full access to all Unity3D build targets for free, with an income cap of $100K. Game Developers earning revenue over $100K/year from their games must upgrade to Plus or Pro tiers, at $35 or $125/mo — the $125/mo Unity Pro tier matches the cost of GMS2 Ultimate.

The Unity3D IDE is Visual Studio, an industry leader, and the language is C#. By contrast, the GameMaker Studio IDE and GML language are quite limited compared to the capabilities of Visual Studio and C#.

It’s likely that most developers who are in the Microsoft XBox or Sony PlayStation developer programs are already experienced professionals accustomed to professional-quality, industry standard development tools, so it’s hard to see why they would want to take a step down and use GameMaker when they could use Unity3D, or Unreal, or some other tool at less cost. GameMaker Studio 2 Ultimate is priced comparable to Unity Pro, but the capabilities and tools around Unity are much stronger and more flexible.

YoYoGames: GameMaker Studio 1.4 sunset annonced for 2018

Today, YoYoGames announced that GameMakerStudio 1.4 support will sunset in 2018.

Over the next 14 months, until 31 July 2018, we will continue to mend major issues and support platform updates for Studio 1.4. After the 14-month period, Studio 1.4 will still function normally however, we cannot guarantee it will remain compatible with every platform’s future updates.

While this day has been expected to come since the release of the 2.0 beta back in November 2016, this is quite a bit sooner than expected. YoYoGames support for the 8.x version of GameMaker continued for years after GameMakerStudio 1.0 was released, only ceasing very recently.

It’s not entirely bad for the company to focus itself on development and support for the latest version of their product, but it’s unfortunate for users who for whatever reason are not able to move to the new version so quickly. This also makes it all the more important that GMS2 be as good as it can be. Hopefully, by focusing on the latest version exclusively, this will enable YYG to develop it even faster, adding new features, fixing bugs, and addressing UX issues with the brand new IDE.

YoYoGames: Major GameMaker roadmap announcement

YoYoGames posted a major, detailed update to their roadmap for GameMaker Studio 2 this morning. Seemingly not an April Fool’s joke.

The announcement contains lots of exciting, long-awaited new features and improvements, but not much detail as yet about when most of these might be forthcoming. And the usual disclaimers that these are plans, not promises.

There’s even more at the link above, but here’s what I think about these in particular: (more…)

A tale of two GML scripts: code optimization through iterative development

Today I wanted to share two versions of a function that I wrote, in order to show how my iterative approach to software development works when I am doing code optimization to improve performance.

This example comes from my iMprOVE_WRAP asset. It’s a function that returns the shortest distance (taking into account the wrap capabilities of the calling object) between the calling instance and a target object.

The first implementation works, in that it correctly does what it’s supposed to do, but I never released it, because I wasn’t satisfied that it was good enough code to ship.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
///iw_distance_to_object(target_obj, x1, y1, x2, y2, do_wrap_h, do_wrap_v,)
 
///@description Returns the distance_to_object from an improve_wrap object calling this function to another instance. 
///Compares all relevant points for the iw_object and returns the nearest distance, taking the wrap range into account.
///@param target_obj id of the target object to determine the distance to.
///@param x1 left x boundary of wrap range
///@param y1 top y boundary of wrap range
///@param x2 right x boundary of wrap range
///@param y2 bottom y boundary of wrap range
///@param do_wrap_h set whether the horizontal wrap is on (true) or off (false)
///@param do_wrap_v set whether the vertical wrap is on (true) or off (false)
 
 
//get the distance from the nine virtual positions
//return the shortest distance
var obj = argument[0];
var iw_distance, iw_distance_up, iw_distance_down, iw_distance_left, iw_distance_right, 
    iw_distance_up_left, iw_distance_up_right, iw_distance_down_left, iw_distance_down_right;
var tempx, tempy, shortest;
var x1, y1, x2, y2, range_width, range_height, do_wrap_h, do_wrap_v;
 
//keep track of original location of target object
tempx = x;
tempy = y;
 
//set up wrap range
x1 = min(argument[1], argument[3]);
y1 = min(argument[2], argument[4]);
x2 = max(argument[1], argument[3]);
y2 = max(argument[2], argument[4]);
range_width = x2 - x1;
range_height = y2 - y1;
 
do_wrap_h = argument[5];
do_wrap_v = argument[6];
 
//check distances
//check center
iw_distance = distance_to_object(obj);
 
if do_wrap_h && do_wrap_v //wrap vertical and horizontal
{
  //check corners
  x = tempx - range_width;
  y = tempx - range_height;
  iw_distance_up_left = distance_to_object(obj);
 
  y = tempx + range_height;
  iw_distance_down_left = distance_to_object(obj);
 
  x = tempx + range_width;
  iw_distance_down_right = distance_to_object(obj);
 
  y = tempy - range_height;
  iw_distance_up_right = distance_to_object(obj);
 
  //check left and right
  y = tempy;
  x = tempx - range_width;
  iw_distance_left = distance_to_object(obj);
  x = tempx + range_width;
  iw_distance_right = distance_to_object(obj);
 
  //check up and down
  x = tempx;
  y = tempy - range_height;
  iw_distance_up = distance_to_object(obj);
  y = tempy + range_height;
  iw_distance_down = distance_to_object(obj);
 
  shortest = min(iw_distance, iw_distance_up, iw_distance_down, iw_distance_left, iw_distance_right, 
                iw_distance_up_left, iw_distance_up_right, iw_distance_down_left, iw_distance_down_right);
}
if do_wrap_h && !do_wrap_v //do_wrap_h
{
  //check left and right
  x = tempx - range_width;
  iw_distance_left = distance_to_object(obj);
  x = tempx + range_width;
  iw_distance_right = distance_to_object(obj);
 
  shortest = min(iw_distance, iw_distance_left, iw_distance_right);
}
 
if do_wrap_v && !do_wrap_h //do_wrap_v
{
  //check up and down
  y = tempy - range_height;
  iw_distance_up = distance_to_object(obj);
  y = tempy + range_height;
  iw_distance_down = distance_to_object(obj);
 
  shortest = min(iw_distance, iw_distance_up, iw_distance_down);
}
if !do_wrap_h && !do_wrap_v
{
  shortest = iw_distance;
}
 
//return calling instance to original location
x = tempx;
y = tempy;
 
return shortest;

Let’s take a moment to appreciate this function as it’s written. It’s well-structured, documented, and expressive. First we declare a bunch of variables, then we do stuff with the variables, then we get our answer and return it. And this gives a correct result…

So what’s wrong with the above? It’s an inefficient approach, which checks each virtual position of the wrapping object. If the calling instance wraps vertically and horizontally, it has to temporarily move the calling instance 9 times and check the distance from each of 9 virtual positions, then return it back to its original position, only to return the shortest of those 9 virtual positions.

There’s also a lot of code duplication.

Still, it’s not horrible code. But it’s up to 9x slower than the distance_to_object() function it’s based on, if you’re wrapping in both directions, which will probably be common. I didn’t think that was good enough.

Rather than check each virtual location to see which is the shortest distance, we just need to know whether the horizontal and vertical distances are more than half of the width and height of the wrap region. If they are, then it’s shorter to go around the wrap. To know this, you simply take the x and y values of the two positions, subtract one from the other, and compare to the size of the wrap range. Once you know which virtual position is the closest one, you can temporarily place the calling instance there, and use distance_to_object() to get that distance. Put the calling instance back where it was, and then return the distance.

I realized as well that depending on whether the calling object wraps in both directions, you may not need to check for a wrap shortcut in the horizontal or vertical. So we can potentially avoid doing some or all of the checks depending on whether the do_wrap_h and do_wrap_v arguments are true or false. As well, this means we can avoid declaring certain variables if they’re not needed, which conserves both execution time as well as RAM.

I usually create local script variables in a var declaration, and assign the arguments to them so the code will be more readable, but I wanted to avoid doing that so that this function could be as lean and fast as possible. This might be an unnecessary optimization, but that’s hard to predict since I have no way of knowing ahead of time how this function might be used in a future project. In a project with many wrapping instances, it could very well be called many times per step, and every optimization could be critical. Since the script is intended to be included as a function in an extension, once I have it working properly it shouldn’t be opened for future maintenance, so making the script readable is not as important. So I opted to remove the local variable declarations as much as possible and just use the argument[] variables directly.

Also, to ensure that the wrap range is defined properly, in the non-optimized version of this function, I declare x1, y1, x2, y2 and assign their values using min() and max() so that (x1, y1) is always the top left corner, and (x2, y2) is always the bottom right corner of the wrap range. Technically for this function, we don’t care precisely where the wrap range is, only what the width and height of the wrap range are. That being the case, I can further optimize what I have here, and rather than use min and max, I can just take the absolute value of the difference of these two values.

It turns out that the process I went through to optimize this function is pretty interesting, if you care about optimizing. So I’ll go into greater detail at the end of this article about the approach I took to get there. But for now, let’s skip ahead and look at the finished, optimized function. Here it is, re-implemented, this time doing only the minimum amount of work needed:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
///iw_distance_to_object(obj, x1, y1, x2, y2, do_wrap_h, do_wrap_v)
 
///@description iw_distance_to_object returns the shortest distance in room pixels between two objects in the wrap range, 
///taking into account the horizontal and/or vertical wrap properites of the calling object.
///@param obj the id of the target object
///@param x1 left x boundary of wrap range
///@param y1 top y boundary of wrap range
///@param x2 right x boundary of wrap range
///@param y2 bottom y boundary of wrap range
///@param do_wrap_h set whether the horizontal wrap is on (true) or off (false)
///@param do_wrap_v set whether the vertical wrap is on (true) or off (false)
 
 
if !(argument[5] || argument[6]) //not wrapping actually
{
 return distance_to_object(argument[0]);
}
else
{
 //We're going to figure out which virtual position is the nearest to measure from
 //To do that, we have to compare the h-distance and v-distance of the calling instance and the target position
 //If this distance is <half the range size, then the original position of the calling instance is closest
 //Otherwise we have to use one of the virtual positions
 //Then we're going to temporarily put the calling instance in that location, get the distance, and put it back 
 
 //arguments
 var tempx = x, tempy = y;
 
 if argument[5] //do_wrap_h
 {
   var range_width = abs(argument[3] - argument[1]);
   if abs(x - argument[0].x) > (range_width * 0.5)
   {
     x -= sign(x - argument[0].x) * range_width; 
   }
 }
 
 if argument[6] //do_wrap_v
 {
   var range_height = abs(argument[4] - argument[2]);
   if abs(y - argument[0].y) > (range_height * 0.5)
   {
     y -= sign(y - argument[0].y) * range_height;
   }
 }
 
 var d = distance_to_object(argument[0]);
 
 //return calling instance to where it was
 x = tempx;
 y = tempy;
 
 return d;
}

We don’t need to measure all nine distances to know which is the shortest; we can tell by comparing the direct distance to the size of the wrap zone — if it’s less than half as big as the wrap zone, the direct distance is the shortest. If not, then we need to wrap. We can check the x and y axes separately, and if both are called for then we can just combine them.

The second function should be much faster to execute, and uses less RAM. How much faster? Well, let’s do a test project using my Simple Performance Test and compare.

Download the iMprOVE_WRAP distance_to_object test project

It turns out that the improved code runs about 50% faster than the old code! That’s a measurable and worthwhile improvement. Although, that said, the old function ran well enough that I could have released it, and likely it would not have been a problem for many uses, particularly in Windows YYC builds.

Appendix: Optimization through Iteration

(more…)

iMprOVE_WRAP 2.2 released

iMprOVE_WRAP 2.2 has been released.

I’ve added two new GML functions to the asset: iw_point_distance() and iw_point_direction(). These functions work much like the built-in GML functions point_distance() and point_direction(), except they take into account the iMprOVE_WRAP wrap region.

Release Notes

Version Notes
2.2 New functions:

  • iw_point_distance(): returns the shortest distance between two points, taking into account the wrap zone.
  • iw_point_direction(): returns the direction of the shortest distance between two points, taking into account the wrap zone.

Get iMprOVE_WRAP

GameMaker Marketplace

itch.io

Full Documentation

iMprOVE_WRAP 2.1 released

iMprOVE_WRAP 2.1 has been released. Get it at GameMaker Marketplace or itch.io.

Full Documentation.

Release Notes:

1.0 Initial release
1.0.1 Updated iw_draw_self_wrap() to use image_blend rather than c_white for the color argument.
2.0.0 Added new functions:

  • iw_draw_sprite_wrap(): an iMprOVE_WRAP version of draw_sprite()
  • iw_draw_sprite_ext_wrap(): an iMprOVE_WRAP version of draw_sprite_ext()

Improvements:

  • Boundary drawing now occurs at wrap corners as well.
  • Phantom collison checking also occurs at wrap corners.
  • iw_collision_wrap() and iw_collision_wrap_map() functions now incorporate do_wrap_h and do_wrap_v arguments, and only perform collision checks where they are needed. They still return a value for all locations, but where no check is needed, they return noone.
2.0.1 Improvements:

  • iMprOVE_WRAP demo resources have been placed in folders to keep them tidy when importing the asset into a project.
  • oIMprOVE_WRAP_demo sprite has been updated to allow for more precise positioning. Sprite is semi-transparent, with a yellow pixel at the origin
  • oIMprOVE_WRAP_demo object now draws guide lines indicating the height and width of the wrap range. This is useful in confirming that clone drawings and wrapping is occuring where it should.
  • iMprOVE_WRAP demo dashboard text has been updated to be a bit more clear
2.1 New functions:

  • iw_distance_to_object(): returns the shortest distance to the target object from the wrapping object, taking into account all directions available.
  • iw_distance_to_point(): returns the shortest distance to the target point from the wrapping object, taking into account all directions available.

New demo room for the iw_distance_to_object() and iw_distance_to_point() functions

 

GameMaker Studio 2.0 officially released, no longer in Beta

Yesterday, YoYoGames announced that GameMaker Studio 2.0 is out of beta.

Perhaps not coincidentally, I’ve noticed a bit of an uptick in purchases of my assets on the GameMaker Marketplace in recent days.

I have not yet updated any of my Marketplace assets for GMS2, but I believe that most of them should still work, although they may require the use of compatibility scripts generated by GMS2 on import in order to run in GMS2.

If you happen to have downloaded any of my assets, and find an issue with it, I am easy to reach for technical support.

The best way to reach me would be to send a message through the asset page on the GameMaker Marketplace. My email address is also in the documentation for the asset. And you can also reach me via the Contact page on this website.

csanyk.com © 2016
%d bloggers like this: