• What are you working on? December 2011 Edition
    3,353 replies, posted
I'm a little angry at how Windows handles library preloading. Simply put, it doesn't. On Unix you just do 'export LD_PRELOAD=/path/to/library.so' (apparently this is secure, I'm not a sysadmin so I don't understand how exactly) and you can overwrite other library's interfaces, or you can add it to your system settings (if you're root) and have all applications preload it. But in Windows the closest you have is a registry setting that may or may not be in future versions of Windows, and only loads if User32.dll loads. There is DLL injection, but that's pretty nasty stuff.
I'm trying to get simple movement working. [img]http://www.1337upload.net/files/0Untitled.gif[/img]
[QUOTE=Darwin226;33700276]So you basically do the opposite of what happens to vertices to your mouse point with the inverse projection matrix and then test collision with the shapes. The thing is, shapes have their own transformation matrices that also change where they are and how they look, so how can I test for collision if the shape is not yet set?[/QUOTE] I'm not sure what you mean by "not set". Generally picking is done independently of rendering, so whatever you pass to OpenGL/D3D is irrelevant. You can multiply the world-space ray by the inverse model matrix to get local model coordinates. You usually don't test directly against the model. Usually the model has some simple, rigid, and, usually, convex collision volume information along with it that's used for physics, etc. [QUOTE=Darwin226;33700276]It's a 2D game btw. I have a feeling that might change a lot.[/QUOTE] The basic process is the same, but being 2D simplifies a lot of the math. You don't need big 4x4 matrixes or any expensive matrix inversions. If you transform in 2D using "rotate(theta); translate(x, y);" then the reverse operation is just "translate(-x, -y); rotate(-theta);"
[img]http://i.imgur.com/7Jesu.png[/img] Yes, thats a scroll view. You add a new control by calling... [code] // You call this method - (void)addControl:(UIControl*)control styled:(BOOL)styled; // For Example... UIImage *bgImage = [[UIImage imageNamed:@"Button"] stretchableImageWithLeftCapWidth:2 topCapHeight:11]; UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake(0, 0, 142, 30); // the X and Y values don't matter, as they are set when you pass the control to the mthod [button setBackgroundImage:bgImage forState:UIControlStateNormal]; [button setTitle:@"Buttons!" forState:UIControlStateNormal]; [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; [self.Panel addControl:button styled:NO]; // Setting Styled as yes will style the button to use the default stretchable background image. [/code] Here's the current stretchable button image: [img]http://i.imgur.com/7TzZ5.png[/img]
[QUOTE=ROBO_DONUT;33703035]I'm not sure what you mean by "not set". Generally picking is done independently of rendering, so whatever you pass to OpenGL/D3D is irrelevant. You can multiply the world-space ray by the inverse model matrix to get local model coordinates. You usually don't test directly against the model. Usually the model has some simple, rigid, and, usually, convex collision volume information along with it that's used for physics, etc. The basic process is the same, but being 2D simplifies a lot of the math. You don't need big 4x4 matrixes or any expensive matrix inversions. If you transform in 2D using "rotate(theta); translate(x, y);" then the reverse operation is just "translate(-x, -y); rotate(-theta);"[/QUOTE] It does matter because the shape to test the mouse point against changes it it's rotated, scaled and moved. The final shape that's visible on the screen doesn't have any readable vertices in the program. The shape is always defined around 0,0. It's local 0,0. Then it's translated, rotated and scaled with matrices on the shader to get what it ACTUALLY needs to look like. Otherwise, the data is always the same. For example. If I define a rectangle with points (0,0), (1,0), (1,1) and (0,1) and test it against the mouse at (10, 10), it obviously doesn't intersect. But if I set it's scale to 100, it does intersect on the screen but the shape available to the program is still just (0,0), (1,0), (1,1), (0,1)
[QUOTE=Tobba;33702496]And suddenly, I'm feeling evil as hell and got a plan for a potential exploit in my schools public WiFi, oh lord[/QUOTE] I did that once, 1 Term Network suspension :v: In hind sight that was not a good idea.
You're thinking about it all wrong :\ Instead of thinking about each item in terms of its world space coordinates, it's more useful to treat each object as having its own 'space', with the associated matrix simply mapping between the different spaces. When you apply the model's matrix, you aren't moving it around in the world, you're taking its local coordinate space and mapping it to world coordinates. In the case of picking, you want to do the opposite, mapping world coordinates to local object coordinates. Which can be accomplished by doing the same action in reverse (or using the inverse matrix).
Holy crap! I haven't had a moment of realization like this since I figured out how perspective projection works! So instead of multiplying every vertex, you just multiply one point with the reverse matrix. Awesome! Thanks!
I love it when you have a brainwave. Wanted to snap a Vector3 to a 0.5 Unit grid along its X and Z Axis: [code] Vector3 SnappedVector = hit.point; float x = Mathf.Round(SnappedVector.x / 0.5f) * 0.5f; float z = Mathf.Round(SnappedVector.z / 0.5f) * 0.5f; SnappedVector = new Vector3(x, SnappedVector.y, z); [/code] There's probably some other way of doing this but I like what I came up with :D
[media]http://www.youtube.com/watch?v=5NUtkfByHJg[/media] Also, this is what happens when extra bytes from RGBA accumulate: [media]http://www.youtube.com/watch?v=xeoyozijBGw[/media]
What exactly are you doing?
[QUOTE=DrLuke;33703932]What exactly are you doing?[/QUOTE] Game recording.
[QUOTE=r0b0tsquid;33700775][img]http://www4a.wolframalpha.com/Calculate/MSP/MSP69519ia867c2d35ahc400003109c0eahi9ebad8?MSPStoreType=image/gif&s=23&w=486&h=240[/img] [img]http://i.imgur.com/N5FCV.png[/img] Holy graphing calculator, Batman! :v:[/QUOTE] holy shit [editline]13th December 2011[/editline] [IMG]http://i.imgur.com/BGxH8.png[/IMG] [sup]Graphing King x [b]1[/b][/sup] I made you a very specific graphing king (modeled after your application) for your impressive mastery of all things bat-graphed. (Tiny graphed bat-head included.)
Now make that the window icon
[url]http://tezzanator.net/Unity/WebPlayer.html[/url] Snapping Chassis editor! :D Quite pleased with it so far, getting used to the way unity works.
[QUOTE=Tezzanator92;33704573][url]http://tezzanator.net/Unity/WebPlayer.html[/url] Snapping Chassis editor! :D Quite pleased with it so far, getting used to the way unity works.[/QUOTE] I broke it. :v: [img]http://i.imgur.com/Uzqjp.png[/img] Snapping works nicely, though you might pop up a 2D grid on the plane in 3D to show.
They should plan the HIB around the Ludum Dare. My productivity is going to die.
I did some more work on my lil' framework I'll use for LD this week. Awesome transitions between states: [vid]http://dl.dropbox.com/u/1106779/Transitions.webm[/vid] It only looks laggy because of Camstudio, the frametime is ~1ms. This is rendered in pure software though, but I designed it so that it [i]should[/i] be pretty easy to implement other renderers.
I can now successfully place towers :v: [img]http://i.imgur.com/AZYMN.png[/img] I feel so good right now.
[QUOTE=mechanarchy;33700723]I'd just use a typedef. [cpp] typedef std::vector<YOURTYPEHERE const*> Collection; // later Collection collection; // later Collection::const_iterator it = collection.begin(); [/cpp] I have an illogical aversion to things like "auto" or "var" in C#... I've never used them but I think it probably stems from my hatred of all things PHP, and how PHP will let you just reassign types willy-nilly. I much prefer strongly-typed languages.[/QUOTE] Auto and var are both strongly typed because of type inference. You will only get weak types in C# if you use dynamic instead.
I kinda feel bad for the following work I've done. I've told people I've put HL2:SB on hiatus, and I have, for months now. I offered some LuaJIT conversion work to Garry for GMod since I wasn't working on the mod anymore, considering the aforementioned. But I don't have anything I want to work on right now besides poking at Source again. Anyway, whatever I guess. It's not that bad right? I'm just doing this because I want to be productive somehow. So to what I was doing. One of the last bugs I was trying to fix way back was something with the CalcPlayerView hook, it appeared to be written entirely fine, except for one thing, the origin of the player's viewport was not being set (overriden) properly by the hook. I added a couple new API extension functions to help me figure out what the problem was. [cpp]LUA_API void (luasrc_print) (lua_State *L, int narg); LUA_API void (luasrc_dumpstack) (lua_State *L); [/cpp] Okay, so great. Now I can figure out what values are on the stack, and at what position regardless of already seeing what code I've written, and having confidence that those values should be in specific positions on the stack. It's paranoid debugging. So this is what I have: [img]http://i.imgur.com/CqhnV.png[/img] Plain and simple stuff. A bit of the code above is old, and redundant by looking at it (you really only need luaL_checkudata, which eliminates the old TODO need). But like I said before, the player's eye angle is getting locked, and the FOV is fine to override as well, but the origin isn't being overriden. That nice little dump function and a dumping of the supposedly-overridden variables to the console showed me something that I didn't realize for months. Extremely embarrassing now to think of. [img]http://i.imgur.com/mpEsp.jpg[/img] The console doesn't even display the Vector dump. Which means one of my conditions isn't being met. Specifically this one: [cpp] if ( lua_isuserdata( L, -1 ) && luaL_checkudata( L, -1, "Vector" ) ) { VectorCopy(*(Vector *)luaL_checkvector( L, -1 ), eyeOrigin); Msg( "Vector: (%f, %f, %f)\n", eyeOrigin.x, eyeOrigin.y, eyeOrigin.z ); } [/cpp] I'm actually stumped. The screenshot quite clearly shows the values on the stack, and my code should provide a sound conditional statement that has its execution path followed. The last two values on the stack work fine, but the origin never gets overridden despite being userdata and a Vector. Well fuck. I'm gonna keep dicking around with it until it works, but the whole point of my post was to ask this: Have you guys ever come across a bug in your code where you're 110% sure you've written everything properly, you've double and triple checked, and can articulate the logic of your code to the point of complete understanding, but it still doesn't work for some unknown reason? Obviously in cases like this, you're still doing something wrong, even though you don't know it; so I know I'm doing something wrong, but it's extremely irritating, because my issue is probably in code that I'm not even focusing on right now. Just thought I'd share my grief.
[QUOTE=Lord Ned;33705281]I broke it. :v: [img]http://i.imgur.com/Uzqjp.png[/img] Snapping works nicely, though you might pop up a 2D grid on the plane in 3D to show.[/QUOTE] That was the limitation of my triangulation(?) algorithm :v: - I have just now rewrote it after having a spark of inspiration. I create a mean point on each of the top and bottom planes and use that as a centre point for the triangles. I'm wondering if I should do this to the sides. [img]http://dl.dropbox.com/u/286964/Unity/mean.png[/img] Great little brain teaser :O
Got 2D top-down movement working, something I've always wanted to do [vid]http://dl.dropbox.com/u/32605179/tiles.webm[/vid] [editline]13th December 2011[/editline] Woops, fraps got the song I was listening to :v:
[QUOTE=amcfaggot;33706698]-snip-[/QUOTE] Shouldn't fov be getting printed too?
[QUOTE=PortalGod;33707303]Got 2D top-down movement working, something I've always wanted to do [vid]http://dl.dropbox.com/u/32605179/tiles.webm[/vid] [editline]13th December 2011[/editline] Woops, fraps got the song I was listening to :v:[/QUOTE] I love Madeon.
[QUOTE=Chrisaster;33707341]Shouldn't fov be getting printed too?[/QUOTE] I dump the stack, which is represented by (-)1:, (-)2:, and (-)3: (stack positions), but the I only print the Vector and the QAngle for the purpose of seeing if those values are overridden. What confuses me is that both of those classes have nearly identical bindings and Lua C API extensions, and I'm rather certain you know how similar QAngle and Vector are internally as well. You can pretty much call them the same thing, if you look at just the x, y, and z values. So I tried something. I wanted to see if Lua thought both the Vector and QAngle values on the stack were userdata. The statements above prevent overriding of the values if we're not getting actual Vector or QAngle objects. Now I'm really confused. [img]http://i.imgur.com/eUxu3.jpg[/img] [cpp] luasrc_dumpstack(L); Msg( "-1: %i\n", lua_isuserdata( L, -1 ) ); // Vector on the stack Msg( "-2: %i\n", lua_isuserdata( L, -2 ) ); // QAngle on the stack [/cpp] It only sees the QAngle as userdata. Why? :/
I've been working on a data editor for my game. It uses C# reflection to build a raw data editor for each type, and there will be a more user-friendly "designer" tab for each data type. [img]http://f.cl.ly/items/3t2o2j0c3H0b300e0b3n/Image%202011-12-13%20at%2011.03.52%20PM.png[/img] It has a bit of support for any type of generic list, but it can't save those yet.
[QUOTE=amcfaggot;33707952]I dump the stack, which is represented by (-)1:, (-)2:, and (-)3: (stack positions), but the I only print the Vector and the QAngle for the purpose of seeing if those values are overridden. What confuses me is that both of those classes have nearly identical bindings and Lua C API extensions, and I'm rather certain you know how similar QAngle and Vector are internally as well. You can pretty much call them the same thing, if you look at just the x, y, and z values. So I tried something. I wanted to see if Lua thought both the Vector and QAngle values on the stack were userdata. The statements above prevent overriding of the values if we're not getting actual Vector or QAngle objects. Now I'm really confused. [img]http://i.imgur.com/eUxu3.jpg[/img] [cpp] luasrc_dumpstack(L); Msg( "-1: %i\n", lua_isuserdata( L, -1 ) ); // Vector on the stack Msg( "-2: %i\n", lua_isuserdata( L, -2 ) ); // QAngle on the stack [/cpp] It only sees the QAngle as userdata. Why? :/[/QUOTE] I was referring to your Msg( "%f\n", fov ) statement not being called. Anyway, maybe lua_isuserdata is messing with the stack? I would try swapping the return values around too, just to check if the result is the same. Or maybe your luasrc_dumpstack function is changing the stack?
[QUOTE=amcfaggot;33707952] [cpp] luasrc_dumpstack(L); Msg( "-1: %i\n", lua_isuserdata( L, -1 ) ); // Vector on the stack Msg( "-2: %i\n", lua_isuserdata( L, -2 ) ); // QAngle on the stack [/cpp] It only sees the QAngle as userdata. Why? :/[/QUOTE] I only skimmed your posts but this sounds like a classical case of Source being... Source. There's many times I'd spend days upon days struggling to see why my code _was_ being called, only to have it have no effect. I finally traced it down to a fuckton of baseclass calls - it was getting overwritten within the same frame by later executed code. Eyeorigin may not be considered userdata - it can be derived from the player's position can it not? (Player's position + 64 and then use the QAngle to get his look-direction)
[QUOTE=Chrisaster;33708052]I was referring to your Msg( "%f\n", fov ) statement not being called. Anyway, maybe lua_isuserdata is messing with the stack? I would try swapping the return values around too, just to check if the result is the same.[/QUOTE] I didn't notice that, thank you for pointing it out. I'll try moving the return values around right now. [editline]13th December 2011[/editline] [QUOTE=Lord Ned;33708066]I only skimmed your posts but this sounds like a classical case of Source being... Source. There's many times I'd spend days upon days struggling to see why my code _was_ being called, only to have it have no effect. I finally traced it down to a fuckton of baseclass calls - it was getting overwritten within the same frame by later executed code. Eyeorigin may not be considered userdata - it can be derived from the player's position can it not? (Player's position + 64 and then use the QAngle to get his look-direction)[/QUOTE] My issue is more of a Lua-end problem from what I can see. [editline]13th December 2011[/editline] Well look at that. The first value is once again not being validated as userdatum. So my view is slightly in the sky now (good), but my view isn't in the right direction (bad). It dawned on me that I'm using beta 6 LuaJIT for HL2:SB, perhaps this is a bug with LuaJIT? I'll switch out the binaries with native Lua right now. With LuaJIT: [t]http://i.imgur.com/V2fKS.jpg[/t] With Lua: [t]http://i.imgur.com/e0e9X.jpg[/t] Nope. It's not LuaJIT. There's something specific about the first value never being considered userdata with only this hook, and this code. I still don't get it.
Sorry, you need to Log In to post a reply to this thread.