[QUOTE=Poodle;21837133][IMG]http://i41.tinypic.com/28in6nq.png[/IMG][/QUOTE]
Needs more lighting.
Seriously, making an engine without making a game is like making an engine without making a car. If you want to make a car in the future, it's going to be quicker, but you still don't really have anything useful.
Custom fonts :v:
[img]http://img227.imageshack.us/img227/7439/customfont.png[/img]
^ my own ugly handwriting, as generated by that custom handwriting font website
I see why you made it now.
It's to forge all your graphing homework isn't it?
[QUOTE=i300;21829234]Uploading to youtube now...
Anyhoo, this is not about youtube or not youtube. What do you guys think?
[b]Edit[/b]
[media]http://www.youtube.com/watch?v=1Ek2juJJuzE[/media][/QUOTE]
Why exactly are you recording with your camera instead of a program?
[QUOTE=nullsquared;21838101]Custom fonts :v:
[img]http://img227.imageshack.us/img227/7439/customfont.png[/img]
^ my own ugly handwriting, as generated by that custom handwriting font website[/QUOTE]
order a arduino and make a drawing machine that draws everything on a paper with a pencil or pen :P
[QUOTE=quincy18;21838480]order a arduino and make a drawing machine that draws everything on a paper with a pencil or pen :P[/QUOTE]
as for graphs that go like y = a*x + b it wouldn't be that hard
[QUOTE=DrLuke;21838833]as for graphs that go like y = a*x + b it wouldn't be that hard[/QUOTE]
It wouldn't be that hard for any type of graph, my calculator computes regular line segments for any graph (albeit quite a few of them)
Null, how do you plot your graphs?
Like lets say the rule is y = x+2; how do you plot it? Do you go through each pixel and plot only if its a result of the rule, or what? Sorry to ask, i'm just wondering (i might make a simple grapher for my math class)
[QUOTE=TheBoff;21838082]Seriously, making an engine without making a game is like making an engine without making a car. If you want to make a car in the future, it's going to be quicker, but you still don't really have anything useful.[/QUOTE]
:iiaca:
[QUOTE=Darwin226;21836722]Believe me I do understand what you mean but, when I have an idea for a game, I know what I'll need for it and then make an engine that supports it and is more reusable than the game itself.[/QUOTE]
I understand what you're saying completely, however you're assuming that when a person programs a game, their code is a lot messier than if they were programming an engine. With some people, that may be true, but really, you should be designing your classes to be modular in the first place, allowing you create an engine by creating a game.
[QUOTE=i300;21839134]Null, how do you plot your graphs?
Like lets say the rule is y = x+2; how do you plot it? Do you go through each pixel and plot only if its a result of the rule, or what? Sorry to ask, i'm just wondering (i might make a simple grapher for my math class)[/QUOTE]
I think what he does is make series of points on the line of the equation then join them together with lines. At least that's how I would do it.
[QUOTE=Shanethe13;21839414]I understand what you're saying completely, however you're assuming that when a person programs a game, their code is a lot messier than if they were programming an engine. With some people, that may be true, but really, you should be designing your classes to be modular in the first place, allowing you create an engine by creating a game.[/QUOTE]
Exactly this, my last projects have resulted in me creating a cleaner and more modular engine.
[QUOTE=i300;21839134]Null, how do you plot your graphs?
Like lets say the rule is y = x+2; how do you plot it? Do you go through each pixel and plot only if its a result of the rule, or what? Sorry to ask, i'm just wondering (i might make a simple grapher for my math class)[/QUOTE]
It depends. Look back on WAYWO V9 for my discussion with Robber about it.
If all you need is simple explicit graphing (explicit meaning y=), then just go through all of the possible x values and compute y, then "connect the dots." If you need complex implicit graphing (like I do), then it gets a lot more complicated.
[QUOTE=nullsquared;21839651]If you need complex implicit graphing (like I do), then it gets a lot more complicated.[/QUOTE]
How are you handling implicit functions anyways? Are you using something like Newton's method?
[QUOTE=Shanethe13;21839973]How are you handling implicit functions anyways? Are you using something like Newton's method?[/QUOTE]
Not at all. I don't feel like having a second discussion about it, just look back a few pages on WAYWO V9 :v:
[QUOTE=nullsquared;21840003]Not at all. I don't feel like having a second discussion about it, just look back a few pages on WAYWO V9 :v:[/QUOTE]
Oh thanks, not sure how I missed that conversation from V9.
Edit: If I'm going to surpass your grapher, I think I'll skip over marching squares, and go right to marching hypercubes.
Yeah, thanks null. I got it all down now.
[cpp]
// Pixel drawing
SDL_LockSurface(screen);
SDL_FillSurface(pixels, screen, black);
for (int x=0; x<wid; x++) {
int y = 20*sqrt( x );
SDL_PlotPixel(pixels, screen, x, y, green);
}
SDL_UnlockSurface(screen);
// Pixel code
void SDL_PlotPixel(Uint32 *pixels, SDL_Surface *screen, int x, int y, SDL_Color clr) {
if (x < screen->w && x > 0) {
if (y < screen->h && y > 0) {
pixels[x + y * screen->w] = SDL_MapRGB(screen->format, clr.r, clr.g, clr.b);
}
}
}
void SDL_FillSurface(Uint32 *pixels, SDL_Surface *screen, SDL_Color clr) {
for (int x=0; x<screen->w; x++) {
for (int y=0; y<screen->h; y++) {
pixels[x + y * screen->w] = SDL_MapRGB(screen->format, clr.r, clr.g, clr.b);
}
}
}
[/cpp]
[QUOTE=Shanethe13;21840065]Oh thanks, not sure how I missed that conversation from V9.
Edit: If I'm going to surpass your grapher, I think I'll skip over marching squares, and go right to marching hypercubes.[/QUOTE]
I was just about to say it's on page 47 if you can't find it, but seems like you found it :v:
[editline]03:02PM[/editline]
Actually my grapher supports both implicit and explicit, explicit being done via parametric plots:
[code]
plot2 y=x^2
plot2par x=u,y=u^2
[/code]
Those are the same curve, except one is parametric-explicit whereas the other is just plain old implicit.
[QUOTE=nullsquared;21840190]I was just about to say it's on page 47 if you can't find it, but seems like you found it :v:[/QUOTE]
Is there some sort of government-sanctioned conspiracy to hide the marching squares algorithm? I see what you mean about wikipedia having it wrong, but they're not the only ones. Every single website ends up referencing wikipedia, and thus, has a completely wrong explanation :v: Looks like I'll be doing what you did, and making a 2D marching cubes.
[QUOTE=i300;21840163]Yeah, thanks null. I got it all down now.[/QUOTE]
Just remember that you'll probably want to work in world coordinates rather than pixel coordinates. Like:
[cpp]
// define a window [-10,10] x [-10,10]
float xMin = -10.0f;
float xMax = 10.0f;
float yMin = -10.0f;
float yMax = 10.0f;
for every pixel column
{
float x = (float)pixelX / screenWidth; // normalize to [0,1]
x = xMin + (xMax - xMin) * x; // expand to full window
float y = computeY(x);
float pixelY = (y - yMin) / (yMax - yMin); // normalize to [0,1]
pixelY = pixelY * screenHeight; // expand to full screen
plot line (previousPixelX, previousPixelY, pixelX, pixelY)
}
[/cpp]
[editline]03:23PM[/editline]
[QUOTE=Shanethe13;21840633]Is there some sort of government-sanctioned conspiracy to hide the marching squares algorithm? I see what you mean about wikipedia having it wrong, but they're not the only ones. Every single website ends up referencing wikipedia, and thus, has a completely wrong explanation :v: Looks like I'll be doing what you did, and making a 2D marching cubes.[/QUOTE]
Yeah I found that incredibly weird as well. And that's why my marching squares is literally marching cubes, except without the 3rd dimension :v: Just study marching cubes until you fully understand what they're doing, then get out a piece a paper and a pen and write down all the possible cases for marching squares, and start coding them. That's what I did :v:
I'm revising that maze solver thing. I'm going to have you be able to choose between 3 algorithms, and on the solved image see all explored areas as well as the chosen path, etc.
[QUOTE=nullsquared;21840675]Yeah I found that incredibly weird as well. And that's why my marching squares is literally marching cubes, except without the 3rd dimension :v: Just study marching cubes until you fully understand what they're doing, then get out a piece a paper and a pen and write down all the possible cases for marching squares, and start coding them. That's what I did :v:[/QUOTE]
That's exactly what I'm doing now :v: Still have some more reading to do, but I found that this page was relatively good at demonstrating how it would look in 2-dimensions:
[url]http://www.quantum-physics.polytechnique.fr/physix/wiki/index.php/Marching_Square_and_Marching_Cube_algorithms[/url]
Who else has the habit of writing a class/feature/etc. then goes back when it's done and rewrites it because the first iteration was a messy piece of shit?
[QUOTE=NorthernGate;21840986]Who else has the habit of writing a class/feature/etc. then goes back when it's done and rewrites it because the first iteration was a messy piece of shit?[/QUOTE]
Defiantly me. I have had cases where the FPS was around 32, and after rewriting 3 main classes, boosted it up to 65;
[editline]12:54PM[/editline]
[QUOTE=nullsquared;21840675]Just remember that you'll probably want to work in world coordinates rather than pixel coordinates. Like:
[cpp]
// define a window [-10,10] x [-10,10]
float xMin = -10.0f;
float xMax = 10.0f;
float yMin = -10.0f;
float yMax = 10.0f;
for every pixel column
{
float x = (float)pixelX / screenWidth; // normalize to [0,1]
x = xMin + (xMax - xMin) * x; // expand to full window
float y = computeY(x);
float pixelY = (y - yMin) / (yMax - yMin); // normalize to [0,1]
pixelY = pixelY * screenHeight; // expand to full screen
plot line (previousPixelX, previousPixelY, pixelX, pixelY)
}
[/cpp][/QUOTE]
What would pixelX be? If I am going through the columns, I would iterate though y, not x.
[QUOTE=i300;21841048]What would pixelX be? If I am going through the columns, I would iterate though y, not x.[/QUOTE]
Its actually the opposite of what'd you first think: x values correspond to columns, and y values are rows. On a Cartesian plot you have an x axis, and a y axis. At any particular x value, the possible points lie directly above or below that portion of the axis. Its the same thing for the y axis, you draw a line perpendicular to the direction of the axis itself.
[QUOTE=Shanethe13;21841759]Its actually the opposite of what'd you first think. xX values correspond to columns, and y values are rows. On a Cartesian plot you have an x axis, and a y axis. At any particular x value, the possible points lie directly above or below that portion of the axis. Its the same thing for the y axis, you draw a line perpendicular to the direction of the axis itself.[/QUOTE]
Oh, thinking about the graph i use in math every day, your right. X is a column. :downswords:
So I would do this:
[cpp] SDL_Rect window; // Window
window.x = 10; window.y = 10; window.w = wid-10; window.h = hgt-10; // Stuff
SDL_FillRect(pixels, screen, window, grey); // Fill area witch will be the coordinate plane
float wx, wy, ww, wh; // Stuff for
wx = 10.0f; wy = 10.0f; ww = wid-10.0f; wh = hgt - 10.0f; // Coordinate plane
for (int pixelX = window.x; pixelX<window.w; pixelX++) {
float x = (float)pixelX / window.w;
x = wx + (ww - wx) * x;
float y = x*x;
float pixelY = (y - wy) / (wh - wy);
pixelY = (float)pixelY * window.h;
// What do i plot?
}
[/cpp]
Water physics!
[img]http://www.cubeupload.com/files/e45600mclone3.jpg[/img]
Somehow, all the ground has disappeared. I need to fix this.
I would go through every water pixel and then if there's an empty space to the left, right, down, down-left or down-right of the water, move the water block to a random empty block.
How are you doing it?
[QUOTE=Darwin226;21842245]I would go through every water pixel and then if there's an empty space to the left, right, down, down-left or down-right of the water, move the water block to a random empty block.
How are you doing it?[/QUOTE]
If there's empty space below, move downward. If there isn't empty space below, but there is empty space to the left or to the right, move there.
Sorry, you need to Log In to post a reply to this thread.