Grids for Game Maker (Now on Marketplace)
Hi Everyone
We have been porting a subset of our Grids library to Game Maker.
For now, it only supports hex grids, and the functionality is limited, but I think it already can be useful.
At the moment, you can only create grids in script (until I figure out how to add custom action blocks if it is at all possible). To give you an idea, here is the code for creating a simple hex grid:
It's obviously less generic than our Unity plugin, but we incorporate many if the same ideas:
Right now, we are still in prototyping phase, (but we are moving quickly!). If anyone wants to give it a try, please send me an email (herman@gamelogic.co.za). We would love some feedback! (In particular, suggestions for missing features, things that can be simplified, or that are not idiomatic to Game Maker).
----
(As an aside - I will write about it some more at some stage - but porting highly abstract C# code to Game Maker has been illuminating. It's given us an opportunity to examine the impact of a very extreme design change to the Unity plugin (we want to eliminate some of the generics), something I have been dreading for a long time. It also forced us to look at some of our design ideas, and come up with new solutions, some of which we will actually transfer to the Unity plugin too. For example, our shape presentation in the Unity plugin is internally very complex. In the Game Maker port, we discovered a much simpler presentation, which is very compact and almost as generic, and more importantly, is much simpler internally. So hopefully the effort will benefit our existing customers too :) )
We have been porting a subset of our Grids library to Game Maker.
For now, it only supports hex grids, and the functionality is limited, but I think it already can be useful.
At the moment, you can only create grids in script (until I figure out how to add custom action blocks if it is at all possible). To give you an idea, here is the code for creating a simple hex grid:
// Controller Create gl_init(); grid = gl_pointyhex_grid_create(“hexagon”, 3, 0); map = gl_pointyhex_map_create(cell_dimensions); var screen_rect = gl_rect_create(0, 0, 800, 600); gl_map_align_grid_in_rect(map, grid, rect, global.gl_alignment_middlecenter); gl_rect_destroy(rect); var iter = gl_grid_get_iter(grid); while(gl_iter_hasnext(iter)) { var point = gl_iter_next(iter); var world_point = gl_pointyhex_map_grid2world(point); var tile = gl_instance_create(tile, world_point); gl_grid_set(grid, point, tile); } gl_iter_destroy(iter);
It's obviously less generic than our Unity plugin, but we incorporate many if the same ideas:
- grids are data structures similar to 2D arrays, and are indexed through points (x and y),
- grids can be iterated
- grids can be constructed in different shapes
- grids can be shifted and scaled, and aligned within rectangles
- maps provide conversion between grid points and Game Maker world points
- we provide grid colorings (http://gamelogic.co.za/2013/12/18/what-are-grid-colorings/)
- we provide basic algorithms for path finding, connected-shape finding, and grid point (and shape) transformations (such as rotate 60 degrees).
- 2D Vectors,
- 3x3 matrices
- Rectangles
- Halfplanes
- Convex polygons
- Arbitrary polygons
Right now, we are still in prototyping phase, (but we are moving quickly!). If anyone wants to give it a try, please send me an email (herman@gamelogic.co.za). We would love some feedback! (In particular, suggestions for missing features, things that can be simplified, or that are not idiomatic to Game Maker).
----
(As an aside - I will write about it some more at some stage - but porting highly abstract C# code to Game Maker has been illuminating. It's given us an opportunity to examine the impact of a very extreme design change to the Unity plugin (we want to eliminate some of the generics), something I have been dreading for a long time. It also forced us to look at some of our design ideas, and come up with new solutions, some of which we will actually transfer to the Unity plugin too. For example, our shape presentation in the Unity plugin is internally very complex. In the Game Maker port, we discovered a much simpler presentation, which is very compact and almost as generic, and more importantly, is much simpler internally. So hopefully the effort will benefit our existing customers too :) )
Comments
https://marketplace.yoyogames.com/assets/349/grids
(Or check out the getting-started manual: http://www.gamelogic.co.za/downloads/Getting%20Started%20with%20Grids.pdf.)
The features are not much different from the ones listed above; I am pretty sure we will add more grids pretty soon. (Somewhat ironically this is easier to do in GM than in Unity :--P ).
Our offer for a free life-long version (!) is still open; email me to take it up (herman@gamelogic.co.za).
http://www.gamasutra.com/blogs/HermanTulleken/20140912/225495/20_Fun_Grid_Facts_Hex_Grids.php
@HermanTulleken can you please send me a link or package that I need to get this running to my work email (Julian [at] Pandawlf {dawt} com) and throw an appropriate amount of capital letters into the subject line ;)
I'll do a quick port of one of my older grid prototypes into GM grids so I can give you some feedback on it. (*grumbles at self for not having done this yet*)
@Karuji Don't feel bad; I know what life is like :) But it would be awesome, we will send you the newest version!