Jump to content


Erik Leppen

Member Since 25 Jan 2007
Offline Last Active Mar 02 2016 11:04 AM

Topics I've Started

Checking whether a position is enclosed by a cycle in a graph

26 November 2015 - 02:14 PM

I have the following problem and am looking for a way to solve this in GML.

I have an undirected graph, where
  • every node has coordinates (x, y)
  • every edge is a straight line segment
  • no two edges intersect
In normal situations the graph has no more than about 50 nodes and 75 edges (to give a sense of size). A node is an instance with variables x and y, and an edge is an instance with variables b and e (begin-node and end-node).

Some nodes of the graph are marked.
Edges are marked when both their end nodes are marked.

I also have instances that have positions (x, y). For each such instance I want to know whether it is inside a cycle of marked edges, and if so, get a list of all edges in the smallest-area marked cycle containing it.

How should I go about that? I figured I could use the subgraph consisting of only the marked edges, and ignore all the other edges (and nodes). I was thinking of finding an algorithm that decides how this subgraph splits up the plane in faces (of which one is the infinitely large outer face) and checking whether any instance is in a face that is different from the outer face. However I don't see how I could do that. I was alos thinking about using intersecting rays from the position of the instance, however, cycles don't need to be convex. (Because there are no intersecting edges, cycles can be expected to be simple polygons).

Another way would be to try to run "snakes" from the instance and see if I can find a snake that could "escape" without crossing marked edges. If not, the instance must be enclosed. But this feels more like a heuristic than a definite algorithm.

The algorithm doesn't have to be very fast, I only need to check it when the edges are marked or unmarked, which is about once every few seconds.

Any tips, ideas?

Fatal Error: Can not create vertex buffer of size 65536 bytes

30 September 2015 - 09:01 AM

Does anyone know what this error means and how I can prevent it?

We're getting a report from a player that he got this error:

Fatal Error: Can not create vertex buffer of size 65536 bytes
9083 vertex buffers allocated with total size of 675904 KB
but we cannot reproduce it. I suspect it has do to with memory limitations. It happens in a place that calls draw_line_width a few thousand times. Is this the culprit? Is there a way to prevent it? How would I go about that?

Apply a shader to everything drawn earlier in the step

16 September 2015 - 10:39 AM

Is it possible to have an instance's Draw event apply a shader to everything that other instances have drawn before that in the step (by instances with higher depths), while not affecting anyting that's drawn later (by instances with lower depths), and without changing the code in the other objects? If so, how?

Reading files in a user-given directory

26 August 2015 - 11:54 AM

GM:S's sandboxing prohibits me from creating a tool I need. For this I need to read from a user-chosen directory and all its subdirectories. Is there a way where I can let the user grant the executable read-only access to all contents of a directory (including subdirectories) he can specify in a way similar to get_open_filename?

Currently I'm trying file_exists() on a file that does exist, but it returns false, probably due to the sandboxing limit. Can this limit somehow be alleviated (on Windows desktop)?

Surfaces greater than 2048 x 2048

18 August 2015 - 11:07 AM

It looks like surfaces can't exceed 2048 pixels in either dimension (width or height). This includes the applicaton surface. I couldn't find an option in the global game settings that determines this. So, is it possible to have surfaces that are larger than 2048 pixels in any dimension?

I'm asking, because display resolutions beyond 2048 pixels are slowly coming up.