Jump to content


Member Since 08 May 2004
Offline Last Active Apr 19 2016 12:53 PM

#4937736 18000 Posts! I'm Done!

Posted by xot on 19 January 2016 - 03:33 AM

You sicko.  :GM124:

  • 1

#4929892 GMC "Fresh Start"? - Your feedback wanted

Posted by xot on 05 January 2016 - 10:24 PM

  • 4

#4791343 Problem with draw_sprite_pos()

Posted by xot on 22 April 2015 - 12:42 PM

This is how non-affine transforms work. Unless the resulting shape is a parallelogram you will always get that kind of seam. It doesn't matter if you use this function, primitives, vertex buffers, you will get the same result. The function is working as expected. The illustration in the help file is misleading because it appears to show perspective correction. Mark (Nocturne) is aware of this problem and intends to update the image.

The only way to prevent the seam for a non-parallelogram shape is to:

  • Actually draw the shape using normal affine transforms and a perspective camera.
  • Subdivide the quad to distribute the error and make it less noticeable.
  • Render the quad using a scanline method. This will eliminate the seam but it will look odd because it will not be perspective correct (unless you take steps to do so).
  • Render using a vertex buffer, providing depth information in the PQ-tuple of the texture coordinates.

More info:


  • 4

#4750832 YoYo Games sold - what do you think?

Posted by xot on 16 February 2015 - 08:36 PM

I'm optimistic. I was optimistic about YoYo Games when it started and it's worked out wonderfully. The folks involved seem happy with this transition so I'm choosing to be hopeful.

Thank you, Sandy Duncan, for leading the transformation of GameMaker into something much bigger than anyone could have predicted. Thank you for hiring aces like Russell Kay and Mike Dailly to help lead the charge. Thank you for hiring from within the community to help GameMaker fulfill its potential.
  • 10

#4728139 GM:Studio roadmap?

Posted by xot on 12 January 2015 - 06:09 PM

Given that GMS 2.x is confirmed to have a brand new GML, I think I am in the right position to ask a key question.
How does YoYo plan to maximize the continuity of code resources for GMS 2.x?

I'm not sure that timetable is accurate, or even the notion of "a brand new GML". Based on my discussion with Russell some months ago, I wouldn't expect radical GML changes for 2.x.

And beyond that, into 3.x, based on what we talked about, expect a continuing evolution of GML with some powerful, oft-requested features coming. Backwards compatibility still appears to be a top priority.

It's way too early to talk about that stuff and it's not my place to discuss it. Nothing is certain but I have faith that the future of GML is something we do not have to fear.

While we're on the topic of 2.0, is it possible to make the IDE work on Windows, Mac and maybe Linux, and compile to at least the first two without needing to mess around with extra computers and stuff?

Half of the point of the new IDE is being able to run natively on these platforms. As for cross-compilation, who knows?
  • 1

#4661292 Changes To The Moderating Team

Posted by xot on 25 September 2014 - 05:32 PM

Wow! I never thought Takagi would ever retire. Thanks for your long service.

Good luck, TsukaYuriko, I'm sure you'll find moderation an interesting new challenge. You have a great team to support you.
  • 3

#4486618 Studio 1.2.1261 - Short-Circuiting And More

Posted by xot on 21 January 2014 - 01:03 AM

I think the problem xot presented ...

If you learn anything else please post it with my bug report.


  • 1

#4486511 Studio 1.2.1261 - Short-Circuiting And More

Posted by xot on 20 January 2014 - 10:03 PM

These are neat but it seems like the legacy accessors are not compatible with the new ones.

For instance this will produce an halting error.
    var list = ds_list_create();
    ds_list_add(list, "A");
    show_debug_message(list[! 0]);  // Error message
And this will produce an erroneous value.
    var grid = ds_grid_create(2, 2);
    grid[# 0, 0 ] = "foo";
    show_debug_message(ds_grid_get(grid, 0, 0));  // Outputs (null)
Is this by design?

Also, in your code, you need to define the dimensions of the grid to compile. Is this as intended?


The second error does not exist for the Windows runner. Based on the grid dimensions pasted above, I believe I was attempting to access the grid out-of-range. That may or may not be a different bug. Subsequent out-of-range tests read memory set in previous runs.

However, further tests on other platforms revealed more problems with data structure accessors. I've posted a bug report and example demonstrating them.
  • 1

#4478538 Surface Problems

Posted by xot on 10 January 2014 - 06:59 PM

You need to use:
... when you are done drawing to the surface. Without that step, all subsequent drawing code continues going to the surface, so nothing appears on screen.

Also, if you are using GM:Studio, all drawing should be done in a draw event, including drawing to surfaces. In older versions on GM, it is usually better (or required) to draw to surfaces in a non-draw event.
  • 1

#4478506 Request A Shader

Posted by xot on 10 January 2014 - 06:27 PM


I made something for you, but it won't work well in every case. There is a shader solution and a non-shader solution. Each has their strengths and weaknesses.

The main issue with shaders is you need to be drawing pixels which surround the opaque areas. That means your sprites will need to have an empty border around them of at least one pixel. If a sprite is cropped, which GM:S does automatically, those borders will be lost and some parts of the sprite will not be outlined. The trimming can be disabled if you are using GM:S Pro. If you do not have Pro, setting the sprite to 3D will have a similar effect (but may use more memory).

The non-shader solution doesn't have these problems. It should work about as fast and will often look better, but there are some different issues. If you want to draw a sprite with a low alpha, the outline effect will ruin things by filling the entire sprite area with the outline color. You can work around this by drawing to a surface and then drawing the surface with low alpha.

If interpolation is turned on, both methods have difficulty in differing ways, but the shader version seems to have most trouble.

If you are not using interpolation and your sprite edges are fully opaque, either method will work well. If you intend to draw sprites with lowered alpha, the shader is probably the better choice.

HTML5 Demo: https://dl.dropboxus...ines/index.html

Project Download: https://dl.dropboxus...s/shOutline.gmz


If you want to try TheSnidr's shader this link should work. Host-A is having some problems with SSL and uploads right now.


Cleaned up the demo and added more comments, usage notes, and an outline size control.
  • 1

#4472381 Replace Similar Colors While Preserving Shading

Posted by xot on 03 January 2014 - 11:26 PM


The demo now includes a version of the shader for replacing multiple colors using arrays. Detailed usage notes are included with the code. This update also fixes a bug with rgb_to_hsv() that turned perfectly gray colors into black.
  • 1

#4468271 Request A Shader

Posted by xot on 30 December 2013 - 09:20 AM

Your DirectX is out of date. You need to update it to compile the shader.

Your users will also need DirectX to run any GM:Studio game for Windows. This isn't an exceptional dependency. Ensuring one has DirectX correctly installed is standard operating procedure for virtually any Windows game.
  • 1

#4465764 Request A Shader

Posted by xot on 26 December 2013 - 06:38 PM

The grayscale is controlled by grayscale coefficients. I used CCIR 601 luma values which are:

Y = 0.299 * R + 0.587 * G + 0.114 * B

Each color component (R, G, B) contributes a certain percentage to the final luminance / brightness (Y). Red 29.9%, Green 58.7%, Blue 11.4% in this case.

You can see those values in the shader here:

vec3 lum = vec3(0.299, 0.587, 0.114);

Those values were chosen because they (roughly) produce what a NTSC television would display if the video signal color information (chroma) were removed. If you wanted a perfectly uniform / average gray where Red, Green, and Blue each equally contributes 33.33%, change the values of the lum vector.

vec3 lum = vec3(0.3333, 0.3333, 0.3333);
You can use any coefficients you want for different effects but usually you want the coefficients to add up to 1.0.
  • 1

#4465620 Request A Shader

Posted by xot on 26 December 2013 - 12:07 PM

Can anyone help me?

Here is a shader that more or less does what your code does. This shifts every horizontal line of the image. I did not implement the scaling, so the effect is subtly different. The part in your code that is commented out is also not implemented. If the image is drawn rotated, it will not work as expected.

Fragment Shader:
//  shTapeRewind parameters:
//    random    any large random floating-point value, changing each frame
//    range     maximum horizontal shift as a percentage of the texture width
varying vec2 v_vTexcoord;
varying vec4 v_vColour;

uniform float random;
uniform float range;

void main()
    vec2 uv = v_vTexcoord;
    uv.s += range * (0.5 - fract(9824.51653 * sin(uv.t * random))); // for each V, shift U randomly left or right
    vec4 col = v_vColour * texture2D( gm_BaseTexture, uv );         // sample texture * blend color
    vec3 lum = vec3(0.299, 0.587, 0.114);                           // grayscale coefficients (see CCIR 601 luma)
    col.rgb = vec3(dot(col.rgb, lum));                              // convert to grayscale
    gl_FragColor = col;                                             // output pixel
Essential Code:
// initialize shader handles
hnd_random = shader_get_uniform(shTapeRewind, "random");
hnd_range = shader_get_uniform(shTapeRewind, "range");
// initialize shader parameters
range = 0.04;

//  shTapeRewind parameters:
//    random    any large random floating-point value, changing each frame
//    range     maximum horizontal shift as a percentage of the texture width
shader_set_uniform_f(hnd_random, random(1000000));
shader_set_uniform_f(hnd_range, range);
draw_surface(surf, 0, 0);
HTML5 demo:

GMZ Download:

  • 1

#4459380 Request A Shader

Posted by xot on 17 December 2013 - 05:40 PM

Thanks for testing, Mike. Fingers crossed, I'm hoping this is the only reason this isn't working. I'll add a note to my post that the mouse needs to be in the window or the screen may need to be tapped for the demo to work. Maybe I should change the interface to avoid this confusion.


Altered the scaling interface to use a default value if the mouse isn't moved from (0,0).
  • 1