Creating a new Forester plugin

<cite>@ryukajiya said:</cite> Just throwing in an idea here without knowing how easy it would be to implement:

Have finding density and type of forrest as an interface or abstract so you could create your own logic to set those.
This would result in:
Density and type of trees based on a texture (tex coordinates mapped to world coordinates, maybe alpha = density, color = tyoe, so an RGBA image could definde types and density of up to 3 tree types).
Using the interface/abstract you could very easily come up with you own ideas to spread the trees.
Something like
[java]
private class myForrestSpread implements ForrestSpread{

    private Vector3f forrestType1Spot = new Vector3f(10f, 0f, 20f);
    private Vector3f forrestType2Spot = new Vector3f(80f, 0f, -30f);
    private Node emptyTree = new Node("Empty");
    
    public float getDensity(Vector3f worldPos) {
        if (worldPos.distance(ForrestType1Spot) &lt; 20f) {
            return 1f - 1f / worldPos.distance(ForrestType1Spot);
        }
        if (worldPos.distance(ForrestType1Spot) &lt; 35f) {
            return 1f - 1f / worldPos.distance(ForrestType1Spot);
        }
        return 0f;
    }
    
    public Node getTreeType(Vector3f worldPos) {
        if (worldPos.distance(ForrestType1Spot) &lt; 20f) {
            return (Node) assetManager.loadModel("Models/Trees/Pine.j3o");
        }
        if (worldPos.distance(ForrestType1Spot) &lt; 35f) {
            return (Node) assetManager.loadModel("Models/Trees/Birch.j3o");
        }
        return emptyTree;
    }
}

[/java]
To give an example what i mean by custom defined code here :wink:


i think i will look into that, thanks. :slight_smile:

Hey. Im the one who worked on this lib. I am sorry I am not following the forum so I just noticed messages.

Biomonkey is a bit fragmented and not very well written, and could surely use a fresh start. Maybe just transfer some business logic (maybe some shader stuff etc.) that is tried and tested, instead of starting fresh. I’m not originally a Java programmer, so it should be made by a better Java programmer no doubts. It actually started out as a simple translation of an Ogre3D lib named PagedGeometry.

If anyone is “deving” a similar lib I could give some input, about stuff I learned when working on this lib. Just general advice about pitfalls etc. that I noticed, maybe it’s useful. PM me or something because I’ll check the inbox regularly in that case.

8 Likes

thanks for tuning in @androlo ! It’d be really great if we could get a remake of BioMonkey going.

count me in too :slight_smile: i already have disassembled biomonkey :smiley: lots of stuff to understand thou :confused:

The legend returns!!

1 Like

@androlo : I’m glad your back ! XD

Ah, really cool to see people pulling together on this again… it’s really something most of us will use.
I think @androlo and @t0neg0d already worked out most of the clever stuff needed for paging, so hopefully now that our two greatest tree coders are back we can finally get a stable plugin :slight_smile:

Sorry not back. Just found a weeks old mail saying “Joel Hemphill” wanted a reply on this thread. Cant seem to find his post but I suppose he will see its been answered.

Thanks for responding androlo, i honestly thought that you had died or something, your last reply before then was a year or two ago. by the way, i am only working on the compatiblity of a cool grass control i found, then i can upload a beta kind of version (still plenty to improve) but now i feel better, since you clearly are not angry at me for trying to make a remake of your project. (i didn’t think that you would ever be on, so i decided to try and make a remake)

PS: the thread i was talking about was the original “Forester” thread, your thread actually, but it was already answered.

@wabuilderman
Hi, I need a vegetation manager and it looked like you where building one. So do you have a git repo or somthing similar I could clone form?

1 Like

@wabuilderman
why do you use:
[java]
int i = 0;
while(i < somthing){
// loop logic
i++;
}
[/java]
for loops are cleaner in my opinion and more memory effiecient because the i variable only exists within the brackets of the loop.
[java]
for(int i =0; i < somthing; i++){
// loop logic
}
[/java]

Or am I missing somthing here.

1 Like

@wabuilderman
Sorry about my bitchin but you asked for comments.

Is it not more effiecient to move this piece of code:
[java]
if (solid) {
CollisionShape tempModelShape =
CollisionShapeFactory.createMeshShape((Node) tempModel);
RigidBodyControl tempModelControl = new RigidBodyControl(tempModelShape, 0);
tempModel.addControl(tempModelControl);
forPhy.getPhysicsSpace().add(tempModelControl);
}
[/java]
Outside the while loop and use the forrest node to create the physics shape, instead of casting every spatial to a node. IE:
[java]
while(){
// create the tree visuals and ataching them to the foresterNode
}
if (solid) {
CollisionShape tempModelShape =
CollisionShapeFactory.createMeshShape(foresterNodel);
RigidBodyControl tempModelControl = new RigidBodyControl(tempModelShape, 0);
tempModel.addControl(tempModelControl);
forPhy.getPhysicsSpace().add(tempModelControl);
}
[/java]
this happend in your latests post in the method: “CreateTrees” and “CreateRandomHeightTrees”

While i’m bitching: It might be a good idea to start with using terrainGrid instead of terrainQuad. since terraingrid is infinite (yay).

first persons question: no, i do not have a git repository, yet.
second persons comment: yes, that would be more efficient, i just happen to have a couple of bad habbits
third persons comment: i will have to mull over that a bit, but one note: please do not use bad language here.

Sorry to all of you, i was kind of distracted in blender for a while (but now that its summer, i can do some more work on the plugin)
Note: all i have left till first release is some compatibility stuff.

ITS REALSED!!! still need a couple of beta testers :slight_smile:

4 Likes

Nice, I’ll have a look when the plugin repo gets updated. See if it’ll work with my TiledTerrain system.
As for “terraingrid”, it uses quads but should be depreciated and replaced anyways :wink:

Good work!
Cheers.

thanks… by the way, when the repo is updated, i am expecting some people to report issues/ bugs… even a simple mistake in my coding, so please feel free to post any bug reports on here

1 Like

ok ill check it when ill find free minute :slight_smile:

Nice, in time for my new game. i’ll test this week.

if anyone has an error, please tell me of any suggestions you have for fixing it, thanks.

@wabuilderman Is this specific for trees? isn’t it a generic pagging system?