vegetation generator...

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
Kaeles
Posts: 37
Joined: Thu Jun 03, 2004 12:43 am
Location: oklahoma
Contact:

vegetation generator...

Post by Kaeles »

heh, i know theres not one, i was trying to make one... but i feel so confused, im not trying to do it as a class or anything yet, cause that makes my brain want to explode.... ive only been coding like 8 months :-P

anyyyways, heres the code i used, it seems to compile right, but it crashes when i run the binary...

int x=1,z=1;
f32 iX=0.0f,iZ=0.0f,iY=0.0f,y=0.0f;
IAnimatedMeshSceneNode* vegnode=0;
IAnimatedMesh* tree = 0;
tree = smgr->getmesh("tree.3ds");
while (x<10)
{
x++;
while (z<10)
{
z++ //parent is parent of terrainscenenode
//you cant call getPosition on terrainscenenode
core::vector3df<f32>(iX,iY,iZ) = parent->getPosition( );
iZ++;
terrain->getHeight(core::vector2d<f32>(iX,iZ),y);
vegnode = smgr->addAnimatedMeshSceneNode(tree,0,-1,
core::vector3df(iX,y,iZ);
}
iX++;
terrain->getHeight(core::vector2d<f32>(iX,iZ),y);
vegnode = smgr->addAnimatedMeshSceneNode(tree,0,-1,
core::vector3df(iX,y,iZ);
}

i know that'll only produce trees in a line at the moment, but im too tired to think about that, i just wanna know why its dieing... lol
just dont laugh at my newbie coding, i did this at 5 am....
well, thanks in advance


ps... someone tell niko, that girlfriends are bad ideas, that just means less time for him to work on irrlicht... bad niko... bad
NovaCoder
Posts: 28
Joined: Wed May 26, 2004 11:36 am
Contact:

Post by NovaCoder »

This bit doesn't look right:

Code: Select all

//you cant call getPosition on terrainscenenode 
core::vector3df<f32>(iX,iY,iZ) = parent->getPosition( ); 
iZ++; 
Shouldn't it be more like this:

Code: Select all

core::vector3df l_pos

l_pos = parent->getPosition( );
pos.Z++;
Classes are you friend BTW, get to know them better :wink:
- Nova
Asterisk Man
Posts: 62
Joined: Wed Jun 09, 2004 5:51 am

Post by Asterisk Man »

Also, getHeight funtion of terrain node currently returns false all the time (it's not implemented yet), so you might want a different method to place the trees.
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

why would you place tree's like this?

I can understand a generator for grass or bushes but it will be different on EVERY system so using this for tree's in anything except an RTS style game seems a very bad idea.

tree's should be placed as static objects on the map itself so that in multiplayer FPS games it's always the same and they provide cover.

it's also a problem for AI path finding unless you want them to travel through them.

nope sorry just can't see any way random generation and implamentation of trees could ever be used logicly.
Tyn
Posts: 932
Joined: Thu Nov 20, 2003 7:53 pm
Location: England
Contact:

Post by Tyn »

The server would create the random tree's and send them to the client. There are tons of reasons why it may be useful, have you ever seen an FPS with random maps? Me neither, doesn't mean that someone wouldn't want to try it.
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

ooooooooooooooooooooooooooooo

THAT KIND...cool 8)

actually I HAVE seen a First Person Shooter with random map and object placement Generator that you could even gain a "CODE" for and use it to regenerate a random map made with some sort of algerithmic Map generator.

The name of the game is soldier of fortune 2: double helix

to me it's a oldy and a classic and I'm not that young or old it's just that it was one of the first games I ever bought for pc and one of my favorites that I played to DEATH.

I'm currently waiting for what looks to be some of the best mods for recent first person shooters in history.

I learned how to map for the quake 3 engine with this game and RTCW.

Might be worth getting a copy 8)
Evil Mr Sock
Posts: 37
Joined: Fri Jul 02, 2004 5:36 pm
Location: Albany, NY
Contact:

Post by Evil Mr Sock »

pathfinding wouldn't be a problem - simplest case, for example, is you're ignoring height, and trees are the only "no go" spots - just have your entities say, "If I see a tree directly inbetween me and my current goal, either (a) hide behind tree, or (b) activate A* (or whatever algorithm you're using) to get to a point inbetween the tree and my goal".
------------------------------------------
A monkey poured coffee in my boots.
------------------------------------------
erSitzt
Posts: 52
Joined: Sun May 09, 2004 11:59 am

Post by erSitzt »

I am working on vegetation generator too... but i want it to generate vegetation in a specific area on an existing map. I want to use it in a terraineditor to have 'brushes' for different vegetation types.

So the vegetation is not generated randomly during runtime of the game. For that purpose random vegetation is very useful :) Not everyone wants to create an FPS that uses Q3-maps or something like that...
Kaeles
Posts: 37
Joined: Thu Jun 03, 2004 12:43 am
Location: oklahoma
Contact:

Post by Kaeles »

thanks for all the replys :)
i havent gotten a chance to try anything though... my laptop got stolen :(
sad day for me.... no more comp for awhile...

and getheight doesnt work.... hmmm not cool....

but anyways, thanks
Post Reply