Much objects decreese speed...

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
logosman
Posts: 9
Joined: Wed Oct 25, 2006 8:21 pm
Location: Belarus, Minsk
Contact:

Much objects decreese speed...

Post by logosman »

Hi!
I want to do the game like http://www.jjsoftgames.com/english/hopmon/.
So i have modelled the box with smooth edges (polygons=44) and textured it (2 textures).
Try to do for test the field of 20*20, so polygons in scene = 20*20*44 = 17600, no small!!!

I undenstand that it is very bad for game, i must do some optimizations (to model boxes for some orientations without some faces), and it is not a problem. But...

I've tried to do some 'empty' nodes as root for 5*5 box nodes. But FPS is too small, what i must do?

This is my code:

Code: Select all

#include "stdafx.h"

using namespace irr;

#pragma comment(lib, "irrlicht.lib")

IrrlichtDevice			*device;
video::IVideoDriver		*driver;
scene::ISceneManager	*sceneManager;
scene::ICameraSceneNode	*camera;


void main(void)
{
	device= createDevice(
		video::EDT_DIRECT3D9,
		core::dimension2d<s32>(1024, 768),
		32, 
		false,
		true);
	driver = device->getVideoDriver();
	sceneManager = device->getSceneManager();


	// Камера
	camera = sceneManager->addCameraSceneNodeFPS();
	camera->setFarValue(10000);
	camera->setPosition(core::vector3df(-100,100,-100));
	camera->setTarget(core::vector3df(0,0,0));


	scene::IAnimatedMesh	*mesh = sceneManager->getMesh("1.x");
	scene::ISceneNode		*land;

	for(int y=0; y<4; y++)
	{
		for(int x=0; x<4; x++)
		{
			scene::ISceneNode	*root = sceneManager->addEmptySceneNode(0);

			//sceneManager->getRootSceneNode()->
			//root->render()

			for(int j=0; j<5; j++)
			{
				for(int i=0; i<5; i++)
				{	
					land = sceneManager->addOctTreeSceneNode(mesh, root);

					core::vector3df	pos = core::vector3df(x*5*60+i*20, 0, y*5*60+j*20);

					land->setPosition(pos);
					land->setRotation(core::vector3df(270, 0, 0));
				}
			}

			//root->setDebugDataVisible(true);
		}	
	}

	

	// Свет
	scene::ILightSceneNode *light = sceneManager->addLightSceneNode(camera, core::vector3df(0,0,0), video::SColorf(1,1,1), 200);

	device->getCursorControl()->setVisible(false);

	while (device->run())
	{
		driver->beginScene(true, true, video::SColor(255, 128, 128 ,128));

		sceneManager->drawAll();

		driver->endScene();

		// FPS
		wchar_t s[10];
		_itow_s(driver->getFPS(), s, 10, 10);
		device->setWindowCaption(s);
	}
	printf("\n");
}
[/code][/url]
-=dura lex sed lex=-
logosman
Posts: 9
Joined: Wed Oct 25, 2006 8:21 pm
Location: Belarus, Minsk
Contact:

Post by logosman »

Solved...
-=dura lex sed lex=-
Post Reply