Suggestions about Item + NPC Placing

Post your questions, suggestions and experiences regarding game design, integration of external libraries here. For irrEdit, irrXML and irrKlang, see the
ambiera forums
Post Reply
geckoman
Posts: 143
Joined: Thu Nov 27, 2008 11:05 am
Location: Germany
Contact:

Suggestions about Item + NPC Placing

Post by geckoman »

Ok, so I'm at the point I think about how to save/load individual levels and the Items/NPCs/Enemies in this levels.

Here comes my solution and what I need is your opinion, do you think it's the right way? What could be done better?

1. Create all Models etc. in 3ds max.
2. Import these Models into IrrEdit and build the level.
3. Save the level.
4. Open the level in my own SMALL SMALL tool which is able to place items etc. in the level and store these Infos in an extra xml file. (position)
5. Edit properties of the placed items in the xml file (perhaps via another small tool)

That seems to be the way which takes the least time.

What do you think?
psychophoniac
Posts: 101
Joined: Wed Dec 03, 2008 5:33 pm
Location: ger

Post by psychophoniac »

ok so far, but why don't you combine 4 & 5? make it possible to edit an object's data right in your "small small" editor (so you can call it just "small" editor from thereon ^^)...
if you write a function like "get / set ValuesOfGameObject()", you could not only use it in the editor, but also InGame to change values while playing.
i love skateboarding!
fmx

Post by fmx »

I agree, it would be wiser to combine 4 and 5 into the same tool, seeing as you'll be coding the editors anyway, you might as well save some time for yourself in the long run and make the editor a little more powerful.

Or wait for the new version of irrAI, which contains an interesting little "unexpected" feature which might come in useful for you ;)
(JP can tell you more about it, its his project not mine. I'm just a guinea-pig :P)
geckoman
Posts: 143
Joined: Thu Nov 27, 2008 11:05 am
Location: Germany
Contact:

Post by geckoman »

Hmm yeah thats what I thought, too. The thing is, Nr. 5 could be done in C# and that would be much faster->just click the UI together and programm little.
What should I use for programming such an editor? wxWidgets?

@fmx: If you know about this feature, would be nice if you could tell me what it does?
fmx

Post by fmx »

I don't want to say too much because I don't know how things might have changed since the last month or so.
But I'll tell you anyway ;)

In the irrAI-Editor, you can load in your .IRR file and if you create a list of unlinked waypoints and export it out, and what you are effectively left with is a long list of positions; in this way, the irrAI editor can be used as a simple "pickup-placer" to place stuff around in your level.
What makes it easy to use (than say for example placing the items in irrEdit even) is the fact that irrAI-Editor's got a neat ray-cast collision system where the waypoints get placed wherever your mouse-click makes contact with your .IRR level, so you never have to manually set the XYZ positions for each item. Just a few clicks, and you're away!

Or maybe you could look into adding the raycast feature into your own editor (if you haven't already).
geckoman
Posts: 143
Joined: Thu Nov 27, 2008 11:05 am
Location: Germany
Contact:

Post by geckoman »

Sounds nice, looking forward to it. In the meantime I'll try to work out your suggestions. Perhaps I don't need that feature then :)
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Yep, FMX came up with that nice little system of using waypoints as markers as well as waypoint graphs, quite cunning and definitely useful for folk using IrrAI.

If you're not using IrrAI for your AI then you're probably not gonna want to use IrrAI just for that though. But you could certainly look through the IrrAI source to see how I've done things to get ideas on how to get your implementation working :)
Image Image Image
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

Why not combine all steps?
IrrEdit allows the use of plugins. Everything like UI and stuff is done you only have to provide a SceneNode having your attributes and irrEdit allows changing them.
Then load in your own app instead of the SceneNode your gameobject.

Spelling corrections by Rogerborg.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
geckoman
Posts: 143
Joined: Thu Nov 27, 2008 11:05 am
Location: Germany
Contact:

Post by geckoman »

Before posting here I even looked at this, but I did not know that I can add my own attributes!

Is irr::io::IAttributes the right thing I have to look at?

Edit:

So I tried it but I failed, because I cannot create a IAttributes without a device, but I have no device. Does anybody know how to to that?

My code:

Code: Select all

CSampleSceneNode::CSampleSceneNode(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id)
	: scene::ISceneNode(parent, mgr, id)
{
	io::IAttributes *attribs = 0;
        //Here I should get the IAttributes from somewhere
	this->serializeAttributes(attribs);
	attribs->addInt("blub",1);
	this->deserializeAttributes(attribs);
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Well, there's not much possible in Irrlicht without a device. Just create one with the null driver, won't harm anywhere.
geckoman
Posts: 143
Joined: Thu Nov 27, 2008 11:05 am
Location: Germany
Contact:

Post by geckoman »

Ok tried this:

Code: Select all

CSampleSceneNode::CSampleSceneNode(scene::ISceneNode* parent, scene::ISceneManager* mgr, s32 id)
	: scene::ISceneNode(parent, mgr, id)
{
	irr::IrrlichtDevice *dev = irr::createDevice(video::EDT_NULL);
	io::IAttributes *attribs = dev->getFileSystem()->createEmptyAttributes();
	dev->drop();
	this->serializeAttributes(attribs); 
	attribs->addInt("blub",1); 
	this->deserializeAttributes(attribs); 
But I get an compile error (before I get NO compile error)

1>------ Neues Erstellen gestartet: Projekt: exampleSceneNodePlugin, Konfiguration: Debug Win32 ------
1>Die Zwischen- und Ausgabedateien für das Projekt "exampleSceneNodePlugin" mit der Konfiguration "Debug|Win32" werden gelöscht.
1>Kompilieren...
1>exampleSceneNodePlugin.cpp
1>Manifest in Ressourcen wird kompiliert...
1>Verknüpfen...
1> Bibliothek "Debug/exampleSceneNodePlugin.lib" und Objekt "Debug/exampleSceneNodePlugin.exp" werden erstellt.
1>exampleSceneNodePlugin.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol ""__declspec(dllimport) class irr::IrrlichtDevice * __cdecl irr::createDevice(enum irr::video::E_DRIVER_TYPE,class irr::core::dimension2d<int> const &,unsigned int,bool,bool,bool,class irr::IEventReceiver *,char const *)" (__imp_?createDevice@irr@@YAPAVIrrlichtDevice@1@W4E_DRIVER_TYPE@video@1@ABV?$dimension2d@H@core@1@I_N22PAVIEventReceiver@1@PBD@Z)" in Funktion ""public: __thiscall CSampleSceneNode::CSampleSceneNode(class irr::scene::ISceneNode *,class irr::scene::ISceneManager *,int)" (??0CSampleSceneNode@@QAE@PAVISceneNode@scene@irr@@PAVISceneManager@23@H@Z)".
1>../../../plugins/exampleSceneNodePlugin.dll : fatal error LNK1120: 1 nicht aufgelöste externe Verweise.
1>Das Buildprotokoll wurde unter "file://h:\downloads\irrEdit-1.4.2\source\examplePlugins\exampleSceneNodePlugin\Debug\BuildLog.htm" gespeichert.
1>exampleSceneNodePlugin - 2 Fehler, 0 Warnung(en)
========== Alles neu erstellen: 0 erfolgreich, Fehler bei 1, 0 übersprungen ==========
I don't know why, irrlicht.h is included, is something missing?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Oh, you shouldn't create a device inside of a scene node. Just pass a pointer in its constructor. I meant that if you have no device available you could create such a simple one and pass it there.
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

@Rogerborg: BLUBB

Ahh no its really simple. You only have to override the ISceneNode::serializeAttributes and ISceneNode::deserializeAttributes calls of ISceneNode. This function already get a Attribute you only have to add your attributes:

Code: Select all

void CAttributeNode::serializeAttributes(io::IAttributes *out, io::SAttributeReadWriteOptions *options) const
        {
            ISceneNode::serializeAttributes(out, options);
            out->addInt("Health", Health);
        }

Code: Select all

void CAttributeNode::deserializeAttributes(io::IAttributes *in, io::SAttributeReadWriteOptions *options)
        {
            ISceneNode::deserializeAttributes(in, options);
            Health = in->getAttributeAsInt("Health");
        }
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
geckoman
Posts: 143
Joined: Thu Nov 27, 2008 11:05 am
Location: Germany
Contact:

Post by geckoman »

Ok thank you. It works!
Post Reply