Jump to content
gamecreator

Character FPS Test

Recommended Posts

With all this talk of Turbo to be even faster than Leadwerks and I guess me being in a testing mood, I decided to see how fast Leadwerks was with one of my animated characters (I'm aware there are two videos on the Leadwerks channel but they don't show any actual data).

I have a rigged character with 4,012 faces and 56 bones, including individual fingers.  The test was done with a GTX 970 and i7 3.40GHz.

100 models - 24 fps
75 models - 32 fps
50 models - 50 fps
45 models - 56 fps
42 models or less - 60 fps+

Of course, enemies typically don't need finger bones so that would help increase the fps.

#include "Leadwerks.h"

using namespace Leadwerks;

#define NUMBEROFCHARACTERS 100

Model *model[NUMBEROFCHARACTERS];

double frame=0;

int main(int argc, const char *argv[])
{
	Leadwerks::Window* window = Leadwerks::Window::Create();
	Context* context = Context::Create(window);
	World* world = World::Create();
	Camera* camera = Camera::Create();
	camera->SetRotation(10, 0, 0);
	camera->Move(5, 8, -12);
	Light* light = DirectionalLight::Create();
	light->SetRotation(35, 35, 0);

	for(int i=0; i<NUMBEROFCHARACTERS; i++)
	{
		model[i] = Model::Load("Models/rogue/rogue.mdl");
		model[i]->SetPosition(i/10*1.2, i%10*1.6, 0, true);
	}

	while(true)
	{
		if(window->Closed() || window->KeyDown(Key::Escape)) return false;

		frame+=Time::GetSpeed()/2;

		for(int i=0; i<NUMBEROFCHARACTERS; i++) model[i]->SetAnimationFrame(frame, 0.8, "run", true);

		Leadwerks::Time::Update();
		world->Update();
		world->Render();

		context->SetBlendMode(Blend::Alpha);
		context->SetColor(1.0, 1.0, 1.0);
		context->DrawText(std::to_string(Time::UPS()), 10, 10);
		context->SetBlendMode(Blend::Solid);

		context->Sync();
	}
	return 0;
}



100.thumb.jpg.ce0392a0ed6eb09dcdd7631fa30fd3d4.jpg

rogue.jpg.c5384f4e8d51c40c80643d5cfce13b90.jpg

 

  • Like 2

Share this post


Link to post

I have a 2b nvidia card. My current game I am working on spawns exactly 1000 prefabs at the start of the game. They are randomly selected from a list of about 71 prefabs. But none of them are animated. This instantly drops the FPS from 60 to 24 and the game caps out at 24fps there is literally nothing I can do as a player to bring that FPS back up over 30 fps. If I set the graphics to high. It will drop to about 10 fps.

I find it interesting that your also caps at 24 fps. So now I am left wondering if there is something we can adjust to frame-lock at 30 fps.

Share this post


Link to post

Meant to respond to this earlier.  I'm sure if I did more than 100 models that the rate would be less than 24 fps.  It's just a round number I stopped at.

Share this post


Link to post

I wanted to add a note here that it's the animating that slows everything down (SetPosition is also about as expensive, if you add it to the loop).  If you comment out that line, the FPS is back up to 60+ with 100 characters.  Also, Leadwerks doesn't check if the character is off-screen.  If you have characters that are off-screen (or far in the distance) you should detect this and not animate them and it will increase your FPS.

Share this post


Link to post

If you change the for loop to include movement as well, like the below code, it changes the fps from 24 to 14 or so.

for(int i=0; i<NUMBEROFCHARACTERS; i++)
{
	//  Move characters
	Vec3 pos=model[i]->GetPosition();
	pos.x+=0.005*Time::GetSpeed();
	model[i]->SetPosition(pos,true);

	// Animate characters
	model[i]->SetAnimationFrame(frame, 0.8, "run", true);
}



 

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...