looking to trade custom 3d assets for code. ASAP

Discussion about everything. New games, 3d math, development tips...
Post Reply
Pax
Posts: 12
Joined: Sat Apr 16, 2005 1:29 pm

looking to trade custom 3d assets for code. ASAP

Post by Pax »

Hi, I'm stuck with a xml parser and a map creation loop for the data it contains. As I pretty much just want to continue moving on with my project, I want to know if a coder will be willing to trade some working code snippets for some custom 3d assets (or textures or animation or a combination).

Please let me know, as to speak about the specifics of this and make the proper arrangement.

Thanks.
r2d2
Posts: 211
Joined: Mon Nov 24, 2003 5:22 pm

Post by r2d2 »

If you tell me exactly what you want to know you can also keep your models and i'll help you for free... like it should be in an open source community :)
R2D2's Irrlicht Mods
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
Pax
Posts: 12
Joined: Sat Apr 16, 2005 1:29 pm

Could a moderator move this one into proper forum? thx

Post by Pax »

Hey r2d2, thx a lot for your generous offer (asset trading still remains, as small way to say thank you for taking the time 8) ).

I'm not a coder (pretty much still in the newbie lair) and have looked at some code which should be of help (which seems to use structs to store the map information). So far, i can generate and read xml files (using Niko's irrxml). But where i'm stuck big time, is on generating the level using the data and then applying collision to it. I've no code neither for loading my .x files nor for collision, which would be a metatriangle selector?

I have the following (map.dat):

Code: Select all

<?xml version=" 1.0" ?>
<config>
	 <model_load file= "4.x" post_x="0" post_y="0" col="1"/>
	 <model_load file= "1.x" post_x="0" post_y="10" col="1"/>
	 <model_load file= "1.x" post_x="0" post_y="20" col="1"/>
	 <model_load file= "3.x" post_x="0" post_y="40" col="1"/>
</config>
and to read it:

Code: Select all

...
IrrXMLReader* xml = createIrrXMLReader("map.dat");

	// strings for storing the data we want to get out of the file
	string modelFile, pos_x, pos_y, clsn;

	// parse the file until end reached
	while(xml && xml->read())
	{
		switch(xml->getNodeType())
		{
		case EXN_ELEMENT:
			{
			  if (!strcmp("model_load", xml->getNodeName())){
					modelFile = xml->getAttributeValue("file");
					pos_x = xml->getAttributeValue("post_x");
					pos_y = xml->getAttributeValue("post_y");
					clsn = xml->getAttributeValue("col");
                    // verify i'm reading what i want, but it's only strings. 
                    cout << modelFile << " "<< pos_x << " " << pos_y << " " << clsn << endl;
                    }
			}
			break;
		}
	}
...
So the thing is that i need to load my models (either when they are being read or later on [preferably based on previously loaded model as in the collision sample, with the faeries, but then again, if it works it's ok]) given the map.dat file, giving it collision atributes (which is my flag - "col"). Something like the following, but using the actual data (and proper code).

Code: Select all

// position
IAnimatedMesh* mesh = smgr->getMesh("modelFile");
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
if (node)
    node->setPosition(core::vector3df(pos_x, 0, pos_y));
next model...

// collision
metatriangle selector using all of the previous data flagged as 1
Thanks.
r2d2
Posts: 211
Joined: Mon Nov 24, 2003 5:22 pm

Post by r2d2 »

Hi,
to get the ints out of the strings you can use the following function:

Code: Select all

int atoi(char*)

//so to get posx in your example:

iposx = atoi(pos_x.c_str());

If your world is not too big just put the loading routine of the models into the while loop.

Do you want player only collision or do you want every object to be colideable with any other?
R2D2's Irrlicht Mods
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
Pax
Posts: 12
Joined: Sat Apr 16, 2005 1:29 pm

Post by Pax »

Hi R2D2, I just want my level to be able to collide with the camera (I was using the flag in case i just wante some water, but pretty much everything is static). there's no animation in it (other than a particle system and maybe some textures moving around, for water - given the case i can figure it out)

My level is kind of huge (still testing my system on to how many "blocks" it can handle until it finally chokes and die x_X). My xml is being generated by some random functions, so I can just define how big or small it is (bigger = better in this case, but then slow).

Thanks for the "atoi", I'll try it when i get home. BTW, for my mesh, in any case how would it work?

Code: Select all

IAnimatedMesh* mesh = smgr->getMesh("path/modelFile"); 

IAnimatedMesh* mesh = smgr->getMesh("path+modelFile"); 
how to use the value of modelFile?

Thanks.
r2d2
Posts: 211
Joined: Mon Nov 24, 2003 5:22 pm

Post by r2d2 »

You will need one main metatriangle selector and then you will have to add a new trinalge selector to the main one for every model loaded.

Code: Select all

irr::scene::IMetaTriangleSelector *mainselector = 0;
mainselector = smgr->createMetaTriangleSelector();

IrrXMLReader* xml = createIrrXMLReader("map.dat");

// strings for storing the data we want to get out of the file
string modelFile, pos_x, pos_y, clsn;
int iposy, iposx, iclsn;
// string path("enterpathhere");
// if the models are not located in your main directory uncomment the line above
// and insert either a relative or an abslotue path

// parse the file until end reached
while(xml && xml->read())
{
   switch(xml->getNodeType())
   {
   case EXN_ELEMENT:
      {
        if (!strcmp("model_load", xml->getNodeName()))
        {
            modelFile = xml->getAttributeValue("file");
            pos_x = xml->getAttributeValue("post_x");
            pos_y = xml->getAttributeValue("post_y");
            clsn = xml->getAttributeValue("col");
                 // verify i'm reading what i want, but it's only strings.
                 cout << modelFile << " "<< pos_x << " " << pos_y << " " << clsn << endl;
            iposx = atoi(pos_x.c_str());
            iposy = atoi(pos_y.c_str());
            iclsn  = atoi(clsn.c_str());
            // path += modelFile
            // look above :)
            IAnimatedMesh* mesh = smgr->getMesh(modelFile.c_str());
            //  if you use the path string then you have to change modelFile into path
            IAnimatedMeshSceneNode *node = smgr->addMeshSceneNode(mesh->geMesh(0));
            node ->setPosition(core::vector3df(iposx, 0, iposy)
            if(iclsn)
            {
               ITriangleSelector* selector = smgr->createTriangleSelector(mesh->getMesh(0),  node);
               mainselector->addTriangleSelector(selector);
               selector->drop();
            }
         }
      }
      break;
   }
}
scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
		mainselector, camera, core::vector3df(30,50,30),
		core::vector3df(0,-3,0),
		core::vector3df(0,50,0));
Well this should do the trick. I hope i forgot nothing.
R2D2's Irrlicht Mods
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
Pax
Posts: 12
Joined: Sat Apr 16, 2005 1:29 pm

Post by Pax »

:lol:

Thank you very much r2d2!!! i'm in debt with you (big time).
here are the changes (just some small changes and it is working. Sweet!!!):

Code: Select all

IAnimatedMeshSceneNode *node =0; // see later in code why
irr::scene::IMetaTriangleSelector *mainselector = 0;
mainselector = smgr->createMetaTriangleSelector();

IrrXMLReader* xml = createIrrXMLReader("map.dat");
// strings for storing the data we want to get out of the file
std::string modelFile, pos_x, pos_y, clsn;
int iposy, iposx, iclsn;
// string path("enterpathhere");
std::string path("media/");
// if the models are not located in your main directory uncomment the line above
// and insert either a relative or an abslotue path
// parse the file until end reached
while(xml && xml->read())
{
   switch(xml->getNodeType())
   {
   case EXN_ELEMENT:
      {
        if (!strcmp("model_load", xml->getNodeName()))
        {
            modelFile = xml->getAttributeValue("file");
            pos_x = xml->getAttributeValue("post_x");
            pos_y = xml->getAttributeValue("post_y");
            clsn = xml->getAttributeValue("col");
            iposx = atoi(pos_x.c_str());
            iposy = atoi(pos_y.c_str());
            iclsn  = atoi(clsn.c_str());
            // path += modelFile
            path += modelFile;
            // look above :)
            IAnimatedMesh* mesh = smgr->getMesh(path.c_str());
//            IAnimatedMesh* mesh = smgr->getMesh(modelFile.c_str());
            //IAnimatedMesh* mesh = smgr->getMesh(modelFile.c_str());
            //  if you use the path string then you have to change modelFile into path
//            IAnimatedMeshSceneNode *node = //smgr->addAnimatedMeshSceneNode (mesh->getMesh(0)); // couldn't get //that one to work :(
            node = smgr->addAnimatedMeshSceneNode(mesh); // so i use this + node definition at start
            node ->setPosition(core::vector3df(iposx, 0, iposy));
            path="media/"; // else it'll add until and of xml file with //non-funcitonal path
       std::cout << iposx << " "<< path<< " "<<std::endl; // just checking
            if(iclsn)
            {
               ITriangleSelector* selector = smgr->createTriangleSelector(mesh->getMesh(0),  node);
               mainselector->addTriangleSelector(selector);
               selector->drop();
            }
         }
      }
      break;
   }
}
/*scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
      mainselector, camera, core::vector3df(30,50,30),
      core::vector3df(0,-3,0),
      core::vector3df(0,-50,0)); */
      	scene::ISceneNodeAnimator* anim =smgr->createCollisionResponseAnimator(
		mainselector, camera, core::vector3df(1,1,1),
		core::vector3df(0,-100,0),  
		core::vector3df(0,2.5,0));
      camera->addAnimator(anim);
	anim->drop();


Thanks again 8)
r2d2
Posts: 211
Joined: Mon Nov 24, 2003 5:22 pm

Post by r2d2 »

No problem! Just curious... is there a webpage we can visit, which is showing off your game?
R2D2's Irrlicht Mods
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
Pax
Posts: 12
Joined: Sat Apr 16, 2005 1:29 pm

Post by Pax »

Hey :D

There's no complete webpage yet, but i posted some pictures and a small (and "squared - pixelated") quicktime movie.

This isn't precisely a game, but just some weird changing "city". Now my system is crawling (way to slow with colision turned on, turned off still speedy once started). Do you happen to know on methods to accelerte colisions? (I'll try using newton camera - world colisions. No portals for me, they seem really good but quite hard to implement on my current level of knowledge). Thanks again r2d2 :)

Image

Image

Image

www.es700x.com/r/media/thx.mov
r2d2
Posts: 211
Joined: Mon Nov 24, 2003 5:22 pm

Post by r2d2 »

Hey that look's nice!
Well the collision detection in Irrlicht really seems slow, but i don't think that using an other physics lib for collisions would speed things up very much. That's the problem when using pre-made engines and not self-written ones... Irrlicht aims to be easy and powerful... but if you make something easy you will nearly always also get a performance impact... look at windows... if you compare it to a self set up Linux system which is manually configured from the ground up windows will be slower, because you can't make it to fit perfectly for your system.

Try to use things like culling, LOD or Octrees.
R2D2's Irrlicht Mods
Messed up with my database so the page is not working at the moment -.-
CPU: Core 2 Quad Q6700RAM: 4096 mb Graphics: Radeon 4850 512mb Sound: on board InternetConnection: DSL
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

r2d2 wrote: Well the collision detection in Irrlicht really seems slow, but i don't think that using an other physics lib for collisions would speed things up very much.
Perhaps I'm misunderstainding what ur saying, but using a dedicated physics lib will speed things up a lot

Pax, you mentioned portals. I have implemented portal culling for Irrlicht (http://www.irrlichtnx.mmdevel.de/phpBB2 ... sc&start=0)
It's for IrrlichtNX but before the really huge split so it should work with Irrlicht. Of course, the portals must be placed in an editor.
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
cassini
Posts: 68
Joined: Thu May 12, 2005 2:40 pm

Post by cassini »

r2d2 wrote:Hey that look's nice!
Well the collision detection in Irrlicht really seems slow, but i don't think that using an other physics lib for collisions would speed things up very much. That's the problem when using pre-made engines and not self-written ones... Irrlicht aims to be easy and powerful... but if you make something easy you will nearly always also get a performance impact... look at windows... if you compare it to a self set up Linux system which is manually configured from the ground up windows will be slower, because you can't make it to fit perfectly for your system.

Try to use things like culling, LOD or Octrees.
I disagree, a physics engine is just like a graphics engine, you could just say hey I can render my graphics using OGL directly mush faster that Irrlich is doing for me, because I will only do what I need. That maybe truth but by the time you get anything done will be a retiree of old age.

Using a physics engine will cut your development time and it will speed you collision many time over. Must physics library are write by highly trained professionals with plenty of experience.

Yon can try the Physics engine you feel is the easier for you I guarantee you will not regret it.
Post Reply