Jump to content


Member Since 22 Jun 2008
Offline Last Active Jun 23 2016 07:31 AM

Topics I've Started

GMLpal: RegEx find & replace, code statistics

30 June 2014 - 10:24 PM

It kinda sucks that GameMaker can't replace text across all code in the opened project, so I made this little tool.
GMLpal can open GameMaker:Studio projects and match code pieces in scripts, shaders, timelines, objects, rooms and constants using Regular Expressions (or normal search patterns) and replace them if you wish. It also has some neat statistics about the opened project.

Download (.zip with .exe)
  • In the replace box, use $1, $2... to represent groups matched by RegEx. In the screenshot below you can see how I use this to replace all draw_sprite into draw_sprite_ext.
  • When saving changes, GMLpal can automatically make a backup for you. This is recommended in case you change your mind about something you've replaced.
  • Open Stats via Misc to see lines of code count and other interesting info about your game. Select an item in the tree to limit the statistics to that node.
  • RegEx reference: http://www.regular-e.../reference.html



Accessing Surface Pixel Data In Dll

14 May 2014 - 05:37 PM

This is slightly advanced and I don't really expect an answer, but is there a way to access the pixel data of a surface from a running C++ DLL (from the texture memory or something?) without having to export it to an image with surface_save and then reading the exported file? surface_save only supports .png, so it's not an ideal solution.

[Solved] Draw Gui Scaling Issues

02 February 2014 - 01:35 PM

I'm trying to draw two sprites at a 1:1 scale regardless of the window size, using the Draw GUI event, but the images are getting blurry.

Here's my Draw GUI event code, I'm not using any views. All the windows graphics options are at default except for Scaling: Full scale. Using Early Access 1.99.51

draw_sprite(sprite0,0,0,0) // Top left
draw_sprite(sprite0,0,window_get_width()-64,window_get_height()-20) // Bottom right

Screen 1 Good, start up size
Screen 2 Bad, smaller size
Screen 3 Bad, bigger size (full)
Download gmz


Any ideas on making the sprites appear as clear as in the first screenshot for all other window sizes?

3D Point Light Dynamic Shadows

21 January 2014 - 08:35 PM

Point light dynamic shadows


Download demo .exe and source


  • Add colored point lights (shines in all directions unlike single directional lights)
  • Objects will cast realistic shadows, the darkness of shadows can be changed
  • Shadows are updated in real time
  • The code supports any number of lights, without taking up more RAM

Speed. A majority of the code is done in the fragment shaders and thus the FPS drops drastically when jumping from 3 to 4 lights (or earlier depending on your computer). The number of triangles on-screen also affects this, as the scene has to be redrawn 7 times per light + 1.


Artifacts/"shadow acne". All the papers I've found about this suggests using a fixed "bias" when comparing floating point values to avoid artifacts, but there doesn't seem to be a perfect balance. A higher bias (currently at 0.02) removes the acne, but objects will start to "hover".
As much as I'd love to increase the smoothness of the shadows, it too greatly contributes to this problem (amount of samples & sample distance).
Left: The table appears to be floating (it's at Z=0), and artifacts can be seen on the ceiling.
Right: Weird patters on the wall when a light is close to it.

Arrays In Shaders

05 January 2014 - 10:33 PM

How does one send arrays between a vertex and fragment shader?
This works perfectly (example, not actual shader):


But when switching to arrays (which should work according to everything I've read about them in GLSL), I get this in the compile log:

Error linking program:
Could not pack varying _myColor
Stats : GMA : Instance=18, Global=2
Asset Compile finished: 23:10:23
Compile finished: 23:10:23


It shouldn't be a memory issue since, well, the first one works and uses the same quantity of data (right?) What's going on here? Is it a GM bug?


Edit: Nevermind, turned out to be a memory issue. The fragment shader doesn't load the variable into memory until you call it, which is why myColor9 works, because that's only one variable. But when calling myColor[9], it loads all the ten variables in indexes 0-9.