Yesterday or so I have created a little System for my Game which generates Rooms for a Labyrinth or Maze according to a Code that is read when going through an Exit. While the Basics work, I also would like to refine it with two Features...
1) ... for which I should get String of that "CaveCode"-Code turned into a Number, meaning to extract only the Numbers and ditch the Letters and an Underscore. I am not very familiar with String-Manipulation, be it in Lua or anywhere else (just not used to using it), so after some little Research I thought the following Line with a "%d+" supposedly finding all the Digits should work, but it doesn't and I don't know what I am doing wrong -- so, I'd be thankful to get some Help on this.
Values.CaveCode.Int = tonumber(string.find("02a_00a04a03a01b","%d+"))
Another Thing I noticed was what looks like a Glitch, but I am not sure about it. One of the Refinements I mentioned is that I want the Graphics for the Maze to be distorted depending on a Seed that shall not be random but belong to each Room's different Perspectives (so I should just extract the Digits from the CaveCode).
2) The Problem is that when I apply a Shader to a Scene-Object, its UV will -- even if the original Graphic was filling the entire Screen -- be cut down to the Measures of actual Content abve zero Alpha. I am sure that is a good Feature for getting rid of unneeded Bytes and Megabytes being shoved into the Cache, but this is one of the Scenarios where it can be a slight Hindrance to my artistic Vision: When I use a Distortion-Shader on an Object, the Parts that should be followed by some empty Space with 0 Alpha, the UV Border is instead right where the Wall-Graphic ends, and thusly the Distortion is restricted to that Area and cannot go beyond, meaning that one Side of the Wall remains straight and undistorted, while the Rest is distorted.
So I considered to just add some unnoticable Pixels with an Alpha-Value of maybe 2 or 3% in the opposite Corners of my Maze-Graphics, which automatically makes the Shader equally stretch across the whole Screen for each of the Graphics (because they all fill that exact Space). That Technique works for basically all Elements except the left Wall- and Exit-Graphics, which suddenly seem to have an Area which is not affected by the Shader (which becomes obvious because the Shader also colors the Graphics (because the Cave-Walls shall subtly change Color as you progress through the Maze), but not in this Area. It seems to be that Area which, at the Top and the Bottom, touches the UV-Border with Alpha above zero.
This might not necessarily be as big a Problem once I replace my provisoric Placeholder-Graphics of just gray and white Cube-Walls with more organic and concavely shaped Cave-Walls, as their Shape would allow for the Shader to work even if the UV does not fill the entire Screen (which I guess sounds nonsensical, but it makes Sense), BUT then I would still have the Problem of the Shader's Distortion being scaled differently on different Elements, although I want the Distortion to be distributed evenly across the whole Screen.
I suppose the more elegant Way to solve that Problem then would be to make it so the Shader's UV does not use the UV of the Object it is applied to, but that of the Screen, as if it was a Screen-Shader. But I haven't yet wrapped my Head around how to do that, even though I tried to look it up.
So, either I have to make the Graphics all forced to be fullscreen and then get rid of that white Area, or otherwise learn how to use the Screen-UV for Effects to be applied to an Object. Any Ideas?