Finished fixing my timestep, stuff is multiplied by a normalised value that's determined per-frame.
[code]
double targetFPS = 60.0 * override_gamespeed;
double currentFPS = 1000.0 / lastFrameTime;
deltaMult = (float)(targetFPS / currentFPS);
[/code]
deltaMult is 1 when the frame takes exactly 16.66ms (60fps) because I didn't feel like going through and making everything use the frame time multiplied by some small value.
[editline]20th May 2012[/editline]
Happy birthday garry
[URL="http://www.twitch.tv/austech/"]Facepunch Programmers: Pony Edition.[/URL]
[editline]lol[/editline]
Stream is over, I think twitch.tv archived it.
[editline]lol[/editline]
[t]http://i46.tinypic.com/2lji0e8.png[/t]
Awww Overv, don't be like this.
[QUOTE=Matt-;36021861][URL="http://www.twitch.tv/austech/"]Facepunch Programmers: Pony Edition.[/URL]
[editline]lol[/editline]
Stream is over, I think twitch.tv archived it.[/QUOTE]
beyond hilarious. [URL="http://puu.sh/vDZG"]Also[/URL].
[QUOTE=BlkDucky;36021923]beyond hilarious[/QUOTE]
Best thing ever.
[QUOTE=NovembrDobby;36021811]Finished fixing my timestep, stuff is multiplied by a normalised value that's determined per-frame.
[code]
double targetFPS = 60.0 * override_gamespeed;
double currentFPS = 1000.0 / lastFrameTime;
deltaMult = (float)(targetFPS / currentFPS);
[/code]
deltaMult is 1 when the frame takes exactly 16.66ms (60fps) because I didn't feel like going through and making everything use the frame time multiplied by some small value.
[/QUOTE]
Did you do the passing the draw method the interpolation value?
If not mind showing a minimal example of how your version works? I would much rather not have to use the draw(interpolation ) method
[QUOTE=swift and shift;36022073]holy fuck[/QUOTE]
Note to self: the more suggestions I make to you in jest, the more I get my mind blown. I didn't think you'd take my joke of JSOS to the point where [I]this[/I] was possible...
Tried my hand at captcha generating because it seemed fun. Took my program several seconds to generate it though...
[IMG]http://s18.postimage.org/nawb5iso7/captchagen.png[/IMG]
Answer is 5Sa1t2Oy, also I don't know anything about the science.
[img]http://puu.sh/vJDt[/img]
Making another tile thing... again
(I only got about 60-80 fps in that screenshot, uncapped fps.. pretty bad)
[QUOTE=benji2015;36025734][img]http://puu.sh/vJDt[/img]
Making another tile thing... again
(I only got about 60-80 fps in that screenshot, uncapped fps.. pretty bad)[/QUOTE]
Render terrain to texture once and modify only when terrain is modified. Otherwise just draw the texture.
[QUOTE=Darwin226;36025765]Render terrain to texture once and modify only when terrain is modified. Otherwise just draw the texture.[/QUOTE]
I do. Without the lighting I get about 500 to 600 fps. With lighting, the maximum I get is around 85.
[editline] 20 May 2012 [/editline]
Not having two separate passes through the lighting overlay, one for clearing and one for blurring, would probably help a lot....
[QUOTE=benji2015;36025734][img]http://puu.sh/vJDt[/img]
Making another tile thing... again
(I only got about 60-80 fps in that screenshot, uncapped fps.. pretty bad)[/QUOTE]
I really do like this Terraria-esk art style, looks swanky.
[QUOTE=Richy19;36023181]Did you do the passing the draw method the interpolation value?
If not mind showing a minimal example of how your version works? I would much rather not have to use the draw(interpolation ) method[/QUOTE]
I think only Update should need the interpolation variable, since the Draw functions should just do what it says on the tin; draw. If you change variables or do other stuff than drawing in the draw-functions, you might end up in trouble later if you want to leave the drawing out and just perform the update-function in any of your classes at some point, for example.
[QUOTE=Mordi;36026212]I think only Update should need the interpolation variable, since the Draw functions should just do what it says on the tin; draw. If you change variables or do other stuff than drawing in the draw-functions, you might end up in trouble later if you want to leave the drawing out and just perform the update-function in any of your classes at some point, for example.[/QUOTE]
Oh, I realize that you should do it that way but the way it shows here [url]http://gafferongames.com/game-physics/fix-your-timestep/[/url] is by passing the interpolation value to Draw(), so I just wanted to know how he did it without that(if he did it without that is)
[QUOTE=Richy19;36023181]Did you do the passing the draw method the interpolation value?
If not mind showing a minimal example of how your version works? I would much rather not have to use the draw(interpolation ) method[/QUOTE]
Instead of passing it around I just make it accessible anywhere, because I have an absolute ton of different methods that use it. Unless you mean the between-frames alpha value that the article talks about, most of the time I just do this:
[code]
if(campaign_emphTimeTrials > 0)
campaign_emphTimeTrials -= Core::deltaMult; //previously this was an int that was decremented each frame
[/code]
[QUOTE=Mordi;36026212]I think only Update should need the interpolation variable, since the Draw functions should just do what it says on the tin; draw. If you change variables or do other stuff than drawing in the draw-functions, you might end up in trouble later if you want to leave the drawing out and just perform the update-function in any of your classes at some point, for example.[/QUOTE]
Pretty much this, although there are still some drawing funcs that use it. I don't plan on separating calls to update and draw in the future though so I didn't worry about that.
[QUOTE=NovembrDobby;36026938]
Pretty much this, although there are still some drawing funcs that use it. I don't plan on separating calls to update and draw in the future though so I didn't worry about that.[/QUOTE]
Hmm, do you have any examples of when the draw-function would use it? It should be possible for the update-event to reflect any needed variables that draw might need.
[IMG]http://i.imgur.com/dtbB5.png[/IMG]
It renders but touch input is giving me some issues. The mouse cursor tracks the correct position, however I can only touch one element, once I do, I get stuck on that element, I think it's because the mouse cursor jumps....
EDIT: Fixed, I was doing mouse click before mouse move. We now have cross-platform GWEN.
Windows Phone 7
[IMG]http://i.imgur.com/1tsKO.png[/IMG]
Xbox 360
[IMG_THUMB]http://i.imgur.com/awNYT.png[/IMG_THUMB]
Windows
[IMG]http://i.imgur.com/7tzVm.png[/IMG]
[QUOTE=Mordi;36027031]Hmm, do you have any examples of when the draw-function would use it? It should be possible for the update-event to reflect any needed variables that draw might need.[/QUOTE]
The ones I can find are mostly just little effects like this:
[img]http://i.imgur.com/Ovp5P.gif[/img]
(the white thing at the start)
I could just move all that stuff to update but I won't unless I need to :v:
[QUOTE=NovembrDobby;36027216]The ones I can find are mostly just little effects like this:
[img]http://i.imgur.com/Ovp5P.gif[/img]
(the white thing at the start)
I could just move all that stuff to update but I won't unless I need to :v:[/QUOTE]
so to get this straight does your run method (or w.e. its called) now look kinda like this:
[cpp]
const int TICKS_PER_SECOND = 25;
const int SKIP_TICKS = 1000 / TICKS_PER_SECOND;
const int MAX_FRAMESKIP = 5;
DWORD next_game_tick = GetTickCount();
int loops;
float interpolation;
bool game_is_running = true;
while( game_is_running ) {
loops = 0;
while( GetTickCount() > next_game_tick && loops < MAX_FRAMESKIP) {
update_game();
next_game_tick += SKIP_TICKS;
loops++;
}
interpolation = float( GetTickCount() + SKIP_TICKS - next_game_tick )
/ float( SKIP_TICKS );
display_game( interpolation );
}
[/cpp]
but you have just made interpolation available to everything instead of passing it to draw?
[editline]20th May 2012[/editline]
The reason im asking is because I get how it can work with custom physics (which I believe you use) but if your using something like Bullet/Box2D all you do is update the world passing in the delta, so in te draw method you cant just simply do:
view_position = position + (speed * interpolation)
Im quite tempted to just use the normal passing update the delta method but limiting the max fps to 200/300 and then clamp the delta to something like 0.2 (5fps) to 0.005(200fps)
[QUOTE=Richy19;36027293]so to get this straight does your run method (or w.e. its called) now look kinda like this:
but you have just made interpolation available to everything instead of passing it to draw?[/QUOTE]
Sort of, [url=http://pastebin.com/2whER0CN]but I call update and draw right next to each other and don't use any skip stuff.[/url]
Now I've got the beginnings of a proper menu-system going. I've got it doing Update and Draw automatically now. I am adding these elements by doing this:
[cpp]// Add a box
AddBox("A box", 250, 300, 36 * 5 + 20, 36 * 5 + 20, 0);
// Add some buttons
for(int i = 0; i < 5; i ++)
{
for(int n = 0; n < 5; n ++)
{
AddButton(toString(i + (n * 5)), 260 + i * 36, 310 + n * 36, 35, 35, 0);
}
}[/cpp]
Which makes it really easy to add and remove items.
[IMG]http://i.snag.gy/oo5hB.jpg[/IMG]
[img]http://puu.sh/vM1z[/img]
That's a bit better, but I'm still missing a bunch of triangles somehow and there's something wrong with my texture decompression leaving random paint splats everywhere.
Well, I fixed my problem I had yesterday with VBOs performing slowly (I had enough of shotgun coding and rewrote the buffer shit, which somehow fixed my problem.)
So, I added a light and shit. All is good except the lighting isn't smoothed:
[IMG]http://dl.dropbox.com/u/8063726/Pictures/normals_face.png[/IMG]
2 hours later, normals are per vertex:
[IMG]http://dl.dropbox.com/u/8063726/Pictures/normals_smooth.png[/IMG]
:v:
[QUOTE=COBRAa;36028407]Well, I fixed my problem I had yesterday with VBOs performing slowly (I had enough of shotgun coding and rewrote the buffer shit, which somehow fixed my problem.)
So, I added a light and shit. All is good except the lighting isn't smoothed:
[IMG]http://dl.dropbox.com/u/8063726/Pictures/normals_face.png[/IMG]
2 hours later, normals are per vertex:
[IMG]http://dl.dropbox.com/u/8063726/Pictures/normals_smooth.png[/IMG]
:v:[/QUOTE]
How long does it take to for your smoothing normals method to run?
[QUOTE=Richy19;36028462]How long does it take to for your smoothing normals method to run?[/QUOTE]
Haven't benchmarked it, but I assume slow at the moment.
[editline]20th May 2012[/editline]
Ok, about 0.08 seconds for 18960 verts.
[editline]20th May 2012[/editline]
Is that good or bad?
[QUOTE=COBRAa;36028505]Haven't benchmarked it, but I assume slow at the moment.
[editline]20th May 2012[/editline]
Ok, about 0.08 seconds for 18960 verts.
[editline]20th May 2012[/editline]
Is that good or bad?[/QUOTE]
mine use to take about 2-3 seconds for about 15 000 verts so not too bad.
Mind sharing how you do it?
I've put my Gwen.NET XNA port up at [url]https://bitbucket.org/ben1066/gwen-dotnet-xna/src[/url] . It's the purexna branch. Since the above screen-shots I have fixed the cursor and cleaned up the code. I also reduced the Xbox 360 resolution to 1280x720 since that should run on all TVs. It is incompatible with Gwen.Net because it uses Microsoft.Framework.Xna.Color, Rectangle and Point instead of the respective System.Drawing classes, however it shouldn't be TOO hard to fix.
...something tells me I've fucked up again...
[img]http://eagle.undo.it:8083/img/kintel_89.png[/img]
:downs:
Why did I ever think this would work?
[cpp]
uint32_t i = procedural->vercolormap[lastPlace];
float index = i / (float)procedural->numPoints;
gk::ColorRGB srccolor = gk::ColorRGB(0.f, 0.f, 0.f, 0.f);
srccolor.setColor(gkDraw->program);
[/cpp]
[QUOTE=Richy19;36028677]mine use to take about 2-3 seconds for about 15 000 verts so not too bad.
Mind sharing how you do it?[/QUOTE]
[cpp]// No normals were present in the model
if(!norms)
{
for(unsigned int i = 0; i < faces * 3; i += 3)
{
face_t* face = (face_t*)&pVertexes[i];
CVector& a = face->v1;
CVector& b = face->v2;
CVector& c = face->v3;;
CVector norm = -(b - a).Cross(c - a); // My normals were backwards...
//cout << i << ": " << norm << '\n';
pNormals[i + 0] += norm;
pNormals[i + 1] += norm;
pNormals[i + 2] += norm;
}
for(unsigned int i = 0; i < faces * 3; i++)
pNormals[i].Normalize();
// Now, lets smooth the normals
double start = pEngineInstance->GetTime();
bool* pDoneVert = new bool[faces * 3];
for(unsigned int i = 0; i < faces * 3; i++)
pDoneVert[i] = false;
for(unsigned int i = 0; i < faces * 3; i++)
{
if(pDoneVert[i])
continue;
pDoneVert[i] = true;
vector<CVector*> group;
group.push_back(&pNormals[i]);
CVector& apos = pVertexes[i];
CVector& anorm = pNormals[i];
for(unsigned int n = i; n < faces * 3; n++)
{
if(pDoneVert[n])
continue;
CVector& bpos = pVertexes[n];
CVector& bnrm = pNormals[n];
// TODO: Angle!
if(apos == bpos) //(apos-bpos).Length() < 0.00001 )
{
group.push_back(&pNormals[n]);
pDoneVert[n] = true;
}
}
if(group.size() == 1)
continue;
//cout << "Found a group of " << group.size() << " normals\n";
CVector avg = CVector(0, 0, 0);
for(int i = 0; i < group.size(); i++)
avg += *group[i];
avg.Div(group.size());
avg.Normalize();
for(int i = 0; i < group.size(); i++)
*group[i] = avg;
}
delete [] pDoneVert;
double end = pEngineInstance->GetTime();
cout << "Smoothing took " << (end-start) << " seconds to run on " << (faces * 3) << " verts\n";
}[/cpp]
[editline]20th May 2012[/editline]
It has the ability to not group on angle too by finding the dot product of 'anrm' and 'bnrm' and checking it at "if(apos == bpos)".
pNormals and pVertexs is the data right before it's sent to the card.
[img]http://puu.sh/vMB9[/img]
Success!
Sorry, you need to Log In to post a reply to this thread.