• What are you working on? November 2011 Edition
    3,673 replies, posted
Guys, I need a hand. I'm aware this isn't the questions thread and that the fact this thread is faster isn't a viable excuse but fuck it. :v: In love2d, I want something to move [b]towards[/b] the x and y given. How would I go about this?
[QUOTE=C:\;33184072]Guys, I need a hand. I'm aware this isn't the questions thread and that the fact this thread is faster isn't a viable excuse but fuck it. :v: In love2d, I want something to move [B]towards[/B] the x and y given. How would I go about this?[/QUOTE] movement_vector= target_position- current_position normalized_movement_vector= movement_vector/ movement_vector.length current_position+= normalized_movement_vector* speed* frame_time
[QUOTE=Dotmister;33184065]You might want to move over to Web Dev for help as HTML, CSS and JS aren't exactly viewed as programming here.[/QUOTE] Javascript is programming.
I can't figure out how to put the maze in a boolean array by parsing each pixel. Any ideas?
[QUOTE=RyanDv3;33184124]movement_vector= target_position- current_position normalized_movement_vector= movement_vector/ movement_vector.length current_position+= normalized_movement_vector* speed* frame_time[/QUOTE] Sorry to be a dumbass but how would I use this?
[QUOTE=Map in a box;33184265]I can't figure out how to put the maze in a boolean array by parsing each pixel. Any ideas?[/QUOTE] Just loop through with two nested loops, checking each pixel. My (excruciatingly slow) method (C#): [code] for (int x = 0; x < pictureBox1.Image.Width; x++) { for (int y = 0; y < pictureBox1.Image.Height; y++) { if (b.GetPixel(x, y).R == 0) { Maze[x, y] = 1; } else { Maze[x, y] = 0; } } } [/code]
[media]http://www.youtube.com/watch?v=Jlj4HrWlWrM[/media] gordon freeman battles
-snop-
snip
[QUOTE=Parakon;33184327][media]http://www.youtube.com/watch?v=Jlj4HrWlWrM[/media] gordon freeman battles[/QUOTE] That reminded me so much about SS13, when he fell over like a brick. Are you attempting to do something similar to SS13?
Revised that algorithm as [I]fuck[/I]. [img]http://i.imgur.com/THlvD.gif[/img]
[QUOTE=Swebonny;33184393]That reminded me so much about SS13, when he fell over like a brick. Are you attempting to do something similar to SS13?[/QUOTE] single player SS13
[QUOTE=Jookia;33175191][url=http://www.astrolog.org/labyrnth/maze/larger.gif]larger.gif[/url][/QUOTE] [img]http://i.imgur.com/T05pt.jpg[/img] [img]http://i.imgur.com/1cTiG.jpg[/img] Damn nazi algorithms will ruin our world. [editline]lol[/editline] [QUOTE=Parakon;33184441]single player SS13[/QUOTE] Please make it multiplayer too, I can't really see SS13 being that much fun singleplayer
[QUOTE=C:\;33184298]Sorry to be a dumbass but how would I use this?[/QUOTE] Movement_vector, target_postion, current_position, and normalized_movement_vector are all vectors, which means they instances of a class with 2 or 3 member variables; x, y, and possibly z. The code I posted is intended to run every time your object's position updates. The frametime is the time since last frame, and your speed is how many units of distance your object travels during one unit of time. So for instance, if your frametime was 0.02 seconds, and you had a speed of 2, then you're object will move 0.04 units that frame. Your movement vector starts out as just the how far you have to go in each axis to arrive at the target position. So if your object is at (1, 1), and you are trying to go to (2, 3), you subtract the current position from the target's position, giving you (1, 2). Clearly, if you move over 1 and up 2 from (1, 1), you arrive at (2, 3). Because your speed is some constant k* 1 unit of distance, you need to put your movement vector in terms of 1 unit of distance, so you can multiply it by k and get how far you travel. That's why you need to "[url=http://en.wikipedia.org/wiki/Normalized_vector]normalize[/url]" the movement vector, making it one unit in length. Dividing a vector by it's length yields this normal vector. To give an example, if you need to travel (5, 0), then normalizing (diving by the length of 5) yields (1, 0), so if your speed is 2 units per second, then after one second, you've traveled (2, 0).
[QUOTE=Yzooo;33184613] Please make it multiplayer too, I can't really see SS13 being that much fun singleplayer[/QUOTE] It's not really like SS13, just the same kind of combat and life systems.
[QUOTE=RyanDv3;33184694]Movement_vector, target_postion, current_position, and normalized_movement_vector are all vectors, which means they instances of a class with 2 or 3 member variables; x, y, and possibly z. The code I posted is intended to run every time your object's position updates. The frametime is the time since last frame, and your speed is how many units of distance your object travels during one unit of time. So for instance, if your frametime was 0.02 seconds, and you had a speed of 2, then you're object will move 0.04 units that frame. Your movement vector starts out as just the how far you have to go in each axis to arrive at the target position. So if your object is at (1, 1), and you are trying to go to (2, 3), you subtract the current position from the target's position, giving you (1, 2). Clearly, if you move over 1 and up 2 from (1, 1), you arrive at (2, 3). Because your speed is some constant k* 1 unit of distance, you need to put your movement vector in terms of 1 unit of distance, so you can multiply it by k and get how far you travel. That's why you need to "[url=http://en.wikipedia.org/wiki/Normalized_vector]normalize[/url]" the movement vector, making it one unit in length. Dividing a vector by it's length yields this normal vector. To give an example, if you need to travel (5, 0), then normalizing (diving by the length of 5) yields (1, 0), so if your speed is 2 units per second, then after one second, you've traveled (2, 0).[/QUOTE] Thanks a lot mate.
[QUOTE=Anonim;33184410]Revised that algorithm as [I]fuck[/I].[/QUOTE] Can I ask how you're doing this generation/solving? I don't mean to ask for your source, only the algorithm or theory behind it so that I can make a few very specific Googles for some pointers to learn this kind of thing myself. It'd be very, very useful for my current project.
[QUOTE=Yzooo;33184613][img]http://i.imgur.com/T05pt.jpg[/img] [img]http://i.imgur.com/1cTiG.jpg[/img] Damn nazi algorithms will ruin our world. [/QUOTE] Really, there are 24 swastikas there :v: [code] Found nr. 1 at X=290, Y=4532 Found nr. 2 at X=366, Y=4450 Found nr. 3 at X=470, Y=996 Found nr. 4 at X=872, Y=3378 Found nr. 5 at X=926, Y=98 Found nr. 6 at X=958, Y=312 Found nr. 7 at X=1452, Y=4552 Found nr. 8 at X=1484, Y=844 Found nr. 9 at X=1790, Y=1186 Found nr. 10 at X=2432, Y=3762 Found nr. 11 at X=2438, Y=5484 Found nr. 12 at X=2600, Y=372 Found nr. 13 at X=2876, Y=64 Found nr. 14 at X=2904, Y=1218 Found nr. 15 at X=3126, Y=5040 Found nr. 16 at X=3886, Y=4910 Found nr. 17 at X=4048, Y=980 Found nr. 18 at X=4450, Y=2108 Found nr. 19 at X=4508, Y=54 Found nr. 20 at X=4636, Y=3162 Found nr. 21 at X=4678, Y=2650 Found nr. 22 at X=4870, Y=5678 Found nr. 23 at X=5464, Y=1968 Found nr. 24 at X=5736, Y=4326 [/code]
[QUOTE=Iceguize;33180389]oh... but... but. [IMG]http://i.imgur.com/4ghHc.png[/IMG] I can be a winner too... right, guys? [I]guys[/I]...? Hey guys where are you going! :([/QUOTE] I got a feeling both of you are doing this [url]http://taint.org/2007/06/19/121541a.html[/url]
Is there any way in C# to load otf fonts from file? I have one font that I think installed with photoshop and I want to ship it with the game because I don't like the idea of someone having to install the font before running the game. It works when I install it and then just use it normally but when I try to load it from file into a PrivateFontCollection it throws the "file not found" exception which is thrown then the font format is unsupported.
[b]LARIO IS BACK![/b] (for those who don't remember, it's Mario + drugs + bad camera man) I implemented some of the ideas that were posted in response to my previous post, so I want to thank you all for posting them! here are the new high effects (notice the zoom and the rotation): [media]http://www.youtube.com/watch?v=C3cGkdqRCtk[/media] + I finally made a level editor so here's a bonus: [media]http://www.youtube.com/watch?v=25af0LAwp-o[/media] I think I will release it after improving the editor and making some basic levels PS: Youtube raped my videos
[QUOTE=Darwin226;33185472]Is there any way in C# to load otf fonts from file? I have one font that I think installed with photoshop and I want to ship it with the game because I don't like the idea of someone having to install the font before running the game. It works when I install it and then just use it normally but when I try to load it from file into a PrivateFontCollection it throws the "file not found" exception which is thrown then the font format is unsupported.[/QUOTE] [quote=http://msdn.microsoft.com/en-us/library/system.drawing.text.privatefontcollection.addfontfile.aspx]Windows Forms applications support TrueType fonts and have [B]limited support for OpenType fonts[/B]. If you try to use a font that is not supported, such as an unsupported OpenType font or a Bitmap font[/quote] Just find a converter and convert it to TrueType. Also if you want to load it from an embedded resource you can use AddMemoryFont, just you will need to use an [url=http://stackoverflow.com/questions/4394393/privatefontcollection-giving-me-symbols]additional api call[/url].
[QUOTE=jonnopon3000;33185077]Can I ask how you're doing this generation/solving? I don't mean to ask for your source, only the algorithm or theory behind it so that I can make a few very specific Googles for some pointers to learn this kind of thing myself. It'd be very, very useful for my current project.[/QUOTE] I sort of just [i]made[/i] an 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=Anonim;33185793][img_thumb]http://i.imgur.com/HIicE.png[/img_thumb][/QUOTE] Scrolling that image zoomed in..Oh God!
[QUOTE=Osherzz;33185537][b]LARIO IS BACK![/b] (for those who don't remember, it's Mario + drugs + bad camera man) I implemented some of the ideas that were posted in response to my previous post, so I want to thank you all for posting them! here are the new high effects (notice the zoom and the rotation): [media]http://www.youtube.com/watch?v=C3cGkdqRCtk[/media] + I finally made a level editor so here's a bonus: [media]http://www.youtube.com/watch?v=25af0LAwp-o[/media] I think I will release it after improving the editor and making some basic levels PS: Youtube raped my videos[/QUOTE] Thats pretty cool. What graphics library did you use for that? And how does the camera work? Does it focus enemies or items if there are any? How does it decide where to move to ?
Haven't used C++ in a while, writing a little tokenizer to get myself back into it :) [img]http://anyhub.net/file/3usx-token01.png[/img] Next up: parsing! :eng101:
I was bored in class, so I made this. [QUOTE][img]http://i.imgur.com/NFnus.png[/img] [img]http://i.imgur.com/D5pX9.png[/img] [img]http://i.imgur.com/VdBnK.png[/img] [img]http://i.imgur.com/ZTgnZ.png[/img][/QUOTE] D/L: [url]http://filesmelt.com/dl/Squares.love[/url]
[QUOTE=Felheart;33186786]Thats pretty cool. What graphics library did you use for that? And how does the camera work? Does it focus enemies or items if there are any? How does it decide where to move to ?[/QUOTE] Thanks, I used XNA. The camera have some sort of a priority list, it always focuses on mushrooms if there are any that it can see. Next, if consumed enough mushrooms, the camera will follow any goomba or green turtle visible and also moving turtle shells (so you have to stop them if you want to move on). If the camera loses its current target then it will return back to the player (unless it will encounter any other interesting targets on the way). Also the camera slowly drifts aways if it doesn't move for a couple of seconds and enough mushrooms are consumed.
-snip- people can't take a joke
[QUOTE=Mr. Smartass;33187019]Someone already beat you to the title lario [video=youtube;_m6fwIkC2Y0]http://www.youtube.com/watch?v=_m6fwIkC2Y0&feature=player_embedded#![/video][/QUOTE] Actually, if you look at the upload date of this video and my first Lario video on my channel you'll see I was the first to use it...
Sorry, you need to Log In to post a reply to this thread.