• What are you working on? November 2011 Edition
    3,673 replies, posted
I just noticed that PieClock's avatar syncs almost perfectly with the rhythm of [url=https://www.youtube.com/watch?v=jHDbjpxmJqA&hd=1]this song[/url]. [IMG]http://www.facepunch.com/avatar/73485.png[/IMG]
[QUOTE=r0b0tsquid;33205113] Thanks, I'll have a look into that. Can C++ not be used with the same drag-and-drop stuff as C# then? Sorry if that's a naive question, I have literally no experience in this area :v: [/QUOTE] wxWidgets has some drag and drop editors, but I never really liked it, could be a lot clearer. As far as I'm aware you can't do drag and drop windows GUI's in Visual Studio without delving into Managed C++, which you don't ever want to touch even with a long barge pole. There might be some tool in whih you design your GUI then it outputs the win32 code but they always suck because you end up with stupid variable names and a huge discontinuity between the designer and the code editor. The way I use, wrapping your code into one class, then linking that dll into your C# UI project is easy. It also has the benefits of separating the majority of the platform dependant code from your main project. And it conforms to at least some of the MVC programing structure, if that's your thing.
[QUOTE=Dotmister;33206696]As far as I'm aware you can't do drag and drop windows GUI's in Visual Studio without delving into Managed C++, which you don't ever want to touch even with a long barge pole.[/QUOTE] You can do it with the WinApi. The downside is that you have to use the WinApi which can be annoying at times, especially since it's a C API and not a C++ one.
[QUOTE=iPope;33206641]It's his opinion, you can disagree but you can't say it is wrong.[/QUOTE] I can when they aren't factually valid. He says that "you need to master" a language before you can make games which is very clearly untrue. It annoys me when people seem to think that opinions don't have to be correct, as though saying that something is an opinion exempts it from criticism. tl;dr: yes I can.
In my comp-sci class, we're working on an oo higherarchy for shapes, so Shape superclass, then Triangle/Rectangle etc. subclasses. I have one problem, and it involves math. First, this is how a rectangle is represented: [img]http://dl.dropbox.com/u/5270951/Rectangle_orig.png[/img] The problem comes when you want to [i]reflect[/i] that rectangle over a line. Actually, the problem is finding the orientation of the reflected rectangle. As you can see, the orientation of that rectangle is 90 degrees. If I wanted to reflect it over the Y axis, I would get a rectangle with an anchor (a) of (2,10), flip the length and width, and a rotation (o) of 270, right? But how would I calculate that (for all cases)? That's just a really easy case, with an easy 90 degrees and a vertical line.
Do you [i]need[/i] to figure out the orientation? You can just reflect all four points and connect them with line segments. If you do need the orientation, though, take the angle between one of the sides and the reflection axis, and double it.
[QUOTE=Wyzard;33207126]Do you [i]need[/i] to figure out the orientation? You can just reflect all four points and connect them with line segments. If you do need the orientation, though, take the angle between one of the sides and the reflection axis, and double it.[/QUOTE] I could reflect all four points, but that still wouldn't help because my representation of rectangles is composed of an anchor, a length, a width, and an orientation. I now see that that might not have been the best idea. Also, I'm not quite sure I follow. In this case, the line of reflection happens to be the Y axis. Lets call the point under A, B. The angle between line segment AB, and the Y axis is 0, and 0*2 is 0, not 270.
I'm on the fence here so... [img]http://i.imgur.com/21AoY.png[/img] [img]http://www.facepunch.com/fp/ratings/tick.png[/img] JSON [img]http://www.facepunch.com/fp/ratings/cross.png[/img] XML
[QUOTE=bobthe2lol;33207245]Also, I'm not quite sure I follow. In this case, the line of reflection happens to be the Y axis. Lets call the point under A, B. The angle between line segment AB, and the Y axis is 0, and 0*2 is 0, not 270.[/QUOTE] The angle between that vertical segment and the Y axis is 0, and it'll still be 0 after the reflection. You said "the orientation of that rectangle is 90 degrees", but that's relative to the axis of reflection: when you reflect over the Y-axis instead of the X-axis, the "orientation" of that segment becomes 0 degrees, not 90, because they're parallel. And if you wanted to reflect over an axis that's 10 degrees off from vertical, your rectangle would have to rotate by 20 degrees. And so on. (Talking about doing a reflection by rotating is a little strange because that's not actually possible; you can fake it for a rectangle since they're symmetrical, but if you were to label all four points it'd be easy to see that they've really just been rotated, not reflected.)
Sweet jesus you can export your window layout in visual studio. Now I can easily import it back in when visual studio decides to reset back to default.
[QUOTE=DatZach;33207459]I'm on the fence here so...[/QUOTE] Just pick one so I can stop hearing people bitch about it. It's your project, it's your decision.
Source engine BSP viewer... playing around with some surface normal color code. The horrendous framerate is fraps's fault, the application normally runs at a smooth 60fps. [video=youtube;CoNw70PnokY]http://www.youtube.com/watch?v=CoNw70PnokY[/video]
I'm working on a quaternion class right now. Does anyone have any experience or web resources in using quaternions to represent glRotatef() functions? I'm sort of lost on how I'd use it.
...and then I accidentally modern art. [img]http://img189.imageshack.us/img189/4180/aciident.png[/img]
[QUOTE=chimitos;33211399]...and then I accidentally modern art. [img]http://img189.imageshack.us/img189/4180/aciident.png[/img][/QUOTE] FIVE THOUSAND DOLLARS.
Dig It on Mac OS X is basically done! Took about 3 hours to get everything working. I also did a bunch of performance upgrades. Runs 60FPS solid on my Mac Book Pro (Mid 2010 15" i5). 30FPS when Menus are on screen. I'm trying to find why that is and fix it. [THUMB]http://i.imgur.com/LCVB8.png[/THUMB] [THUMB]http://i.imgur.com/RpDlh.png[/THUMB] [THUMB]http://i.imgur.com/FlZuh.png[/THUMB] Fullscreen screenshot, because yeah. [THUMB]http://i.imgur.com/3bovC.jpg[/THUMB]
[QUOTE=i300;33212444]Proof that it's on a Mac: [THUMB]http://i.imgur.com/3bovC.jpg[/THUMB][/QUOTE] I was pretty skeptical until this point. thanks for clarifying.
[QUOTE=Pandamobile;33211195]I'm working on a quaternion class right now. Does anyone have any experience or web resources in using quaternions to represent glRotatef() functions? I'm sort of lost on how I'd use it.[/QUOTE] you're better off converting to a 4x4 matrix and calling glMultMatrixf(), but if you must use glRotatef(), you would convert to Euler angles and call glRotatef with 1.0f for the axis that each angle represents, and the angle itself for angle (converted to degrees because glRotatef takes degrees IIRC). You would do this 3 times. Alternatively, you could try setting the angle to 360 degrees and divide each euler angle by 360, use those as the axis variables and make only one glRotatef() call... but honestly you'd be better off representing all transformations as matrices instead of making glTranslate, glRotate, and glScale calls. I've been working on a game for android, when me and my friends first made it a year ago, we used those method calls. This year I redid most of the graphics code, representing everything as matrices, the frametime was pretty much half of what it used to be. Then again, it's on a phone and our game is CPU bound...
[img_thumb]http://i.imgur.com/bHa2o.png[/img_thumb] Newest public build of my zombie game abomination is available on my website: [url]http://blog.xiphias.org/downloads/[/url] Weekly devlog and video coming up soon. EDIT: I've been working on it for a month, woho! (Not as much progress as I'd like to, since It took me almost 2 weeks to change my modding system from a shitty homebrew parser to XML, but it was worth it.) [editline]10th November 2011[/editline] This weeks video: [media]http://www.youtube.com/watch?v=MuxzhDUuam0[/media] [editline]10th November 2011[/editline] P.S. I love you guys, you're 2/3 of my website traffic :buddy:
[QUOTE=Anonim;33185793]I sort of just [i]made[/i] and algorithm for generation. In essence, it was originally (very) loosely based on Prim's algorithm, but it doesn't really resemble it any longer. I'll give you pseudocode for exactly what I did: First, make a graph in the shape of a grid. Initialise edges with random weights between all adjacent vertices (cells) and set them to inactive. [code]Initialisation: 1. Create two FIFO-queues: QK and QM. 2. Pick a random starting cell and add it to QK. Iteration: 1. If QK isn't empty, dequeue a cell C from it. If it's empty, try to dequeue a cell C from QM instead. If both are empty, you're finished. 2. Set cell C to known and unmark it if it's marked. 3. Mark all neighbours that are both unknown and unmarked, and add them to QM. 4. Find the neighbour X of C that's both marked and unknown and that has the lowest edge weight from C. If no marked and unknown neighbours exist, skip to step 7. 5. Set the edge from C to X to active. 6. Add X to QK. 7. Draw all known (and optionally marked cells), and all activated edges to screen. In my case, known cells and edges are white, marked cells are pink. Repeat from step 1 on next frame.[/code] Note that this would be a lot simpler if you didn't animate it (and as such splitting up the algorithm between frames) and tried to add these pink markers as you went along. If you just want a final image, you could pretty much just research minimum spanning trees and fairly easily find a much more efficient algorithm for this. As for solving, I didn't do anything complicated. Start by pushing the starting vertex (top-left cell in this case) on a stack, try to find active edges around it and set respective cells as visited as you traverse them. When a cell doesn't have any more available unvisited neighbours, pop cells off the stack until you find one from which to continue. You're finished when the top of the stack is the last vertex (bottom-right in my case). Again, if you don't animate it's pretty easy to find and understand an efficient shortest-path algorithm for this. Both these algorithms are pretty simple. The solver is pretty slow, and both of them are pretty memory intensive for large mazes. In related news: [img_thumb]http://i.imgur.com/HIicE.png[/img_thumb][/QUOTE] That is weirdly beautiful and mesmerising when viewed full scale.
I might possibly be moving to premake, CMake seems to really be good at simple project files, but when you actually want to get stuff done you end up hitting a brick wall of having to write your own modules. The makefiles it generates are hideous and obfuscated, and right now I'm having problems with circular dependencies, when there doesn't seem a way to fix it.
Fuck CMake
Working on a spam bot of sorts, because my friend keeps spamming binds at me with his G19's macro keys >:L [img_thumb]http://i.imgur.com/Vzeuc.jpg[/img_thumb] (I'm very new to C#)
Ever heard of resizing? Even Paint has it.
[QUOTE=robmaister12;33212607]you're better off converting to a 4x4 matrix and calling glMultMatrixf(), but if you must use glRotatef(), you would convert to Euler angles and call glRotatef with 1.0f for the axis that each angle represents, and the angle itself for angle (converted to degrees because glRotatef takes degrees IIRC). You would do this 3 times. Alternatively, you could try setting the angle to 360 degrees and divide each euler angle by 360, use those as the axis variables and make only one glRotatef() call... but honestly you'd be better off representing all transformations as matrices instead of making glTranslate, glRotate, and glScale calls. I've been working on a game for android, when me and my friends first made it a year ago, we used those method calls. This year I redid most of the graphics code, representing everything as matrices, the frametime was pretty much half of what it used to be. Then again, it's on a phone and our game is CPU bound...[/QUOTE] Uh, no. There's a really straightforward and direct conversion from quaternions to the axis-angle format that glRotatef uses. When dealing with rotations, quaternions are almost always normalized and the i, j, and k imaginary components correspond roughly to the 3D axis of rotation, while the real part corresponds to the angle of rotation. [url]http://content.gpwiki.org/index.php/OpenGL:Tutorials:Using_Quaternions_to_represent_rotation#Quaternion_to_axis-angle[/url] You're basically just normalizing the vector part of the quaternion in 3D space and turning the real part from a [-1,1] value into an angle.
[QUOTE=garry;33213610]Fuck CMake[/QUOTE] Ahaha. Yep. But I don't think using premake would be the right call since I already have it 90% working.
[cpp]#include <stdio.h> #include <stdbool.h> #define VERBOSE #include "vm.h" unsigned int code[] = { /*0*/ INSTR_MOV, VM_REG(0), VM_CODE_MASK | 9, /*3*/ INSTR_ADDI, VM_REG(0), VM_CODE_MASK | 10, /*6*/ INSTR_INT, 11 | VM_CODE_MASK, 0, /*9*/ 10, 20, 1, /*c*/ 0, 0, 0 }; bool flag = true; void intr_hnd(vm_state s) { flag = false; printf("10 + 20 = %u\n", vm_get_int(s, VM_REG(0))); } int main() { vm_state state = vm_create_state(code, sizeof(code), 1024); vm_register_interrupt(state, 1, intr_hnd); while (flag) { vm_run_instruction(state); } return 0; }[/cpp] [code]&#10140; radevm ./main 0: MOV VM_REG(0x0), VM_CODE(0x9) [0, 10] 3: ADDI VM_REG(0x0), VM_CODE(0xa) [10, 20] 6: INT VM_CODE(0xb), 0x0 [1, 0] Interrupt: 1 10 + 20 = 30[/code] Now I just have to add the rest of the opcodes.
[QUOTE=Jookia;33213258]I might possibly be moving to premake, CMake seems to really be good at simple project files, but when you actually want to get stuff done you end up hitting a brick wall of having to write your own modules. The makefiles it generates are hideous and obfuscated, and right now I'm having problems with circular dependencies, when there doesn't seem a way to fix it.[/QUOTE] I've basically just given up on these systems altogether. You could probably create all the project files and makefiles by hand in less time than it takes to get CMake/premake/whatever to cooperate.
[QUOTE=ROBO_DONUT;33214875]I've basically just given up on these systems altogether. You could probably create all the project files and makefiles by hand in less time than it takes to get CMake/premake/whatever to cooperate.[/QUOTE] Yes, but then I have to keep them all updated and it's pretty shitty.
[QUOTE=i300;33212444]Dig It on Mac OS X is basically done! Took about 3 hours to get everything working. I also did a bunch of performance upgrades. Runs 60FPS solid on my Mac Book Pro (Mid 2010 15" i5). 30FPS when Menus are on screen. I'm trying to find why that is and fix it. [THUMB]http://i.imgur.com/LCVB8.png[/THUMB] [THUMB]http://i.imgur.com/RpDlh.png[/THUMB] [THUMB]http://i.imgur.com/FlZuh.png[/THUMB] Fullscreen screenshot, because yeah. [THUMB]http://i.imgur.com/3bovC.jpg[/THUMB][/QUOTE] So is a similar concept to motherload? I loved that game.
Sorry, you need to Log In to post a reply to this thread.