a tilebased terrain manager

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Trosan
Greenskin
Posts: 101
Joined: Sun Jun 10, 2007 4:57 pm
x 1

Post by Trosan »

Just for completeness:

Implemented:
  • selection of tiles (meanwhile fixed a bug in the original TBT which caused tile selection to be wrong when there were tiles behind the one you selected [happens when you have high mountains])
  • height editing with a chosen brush
On the to-do list:
  • selection decal
the_pretender
Gnoblar
Posts: 13
Joined: Wed Nov 07, 2007 4:30 pm

Post by the_pretender »

how i download newest version ogre 1.4 ?
Trosan
Greenskin
Posts: 101
Joined: Sun Jun 10, 2007 4:57 pm
x 1

Post by Trosan »

I've made a lot of progress on the TBT system, just didn't update the thread since I assumed that there were not interest for it.

If it turns out that there is, though, I could make a version available. This one is compatible with Ogre 1.4, and offers all of the features I mentioned above (and some more I think). Just need to clean up the code a bit more then... :)
User avatar
Slappy
Bronze Sponsor
Bronze Sponsor
Posts: 139
Joined: Fri Sep 28, 2007 8:30 pm
Location: Slovakia

Post by Slappy »

Trosan wrote:...since I assumed that there were not interest for it.
This is really bad idea... :shock:
You never know who will use your project...
For several weeks I am looking for some terrain manager and I like your too!
So pls update if possible
Trosan
Greenskin
Posts: 101
Joined: Sun Jun 10, 2007 4:57 pm
x 1

Post by Trosan »

Okay. Let me make clear that I was also quite busy with my project, which also hindered me from continuing making it available here.

Don't expect something before the christmas holidays, honestly, but I'll try my best then!
the_pretender
Gnoblar
Posts: 13
Joined: Wed Nov 07, 2007 4:30 pm

Post by the_pretender »

I want to use TileEngine in my rts game. How can i download TileEngine? for ogre 1.4
Sammual
Gnoblar
Posts: 3
Joined: Fri Dec 07, 2007 7:26 pm

Post by Sammual »

steven wrote:One suggestion:
  • Support for hexagon maps
  • Hexagonal grid overview
I would kill for this to support Hex maps.

Sammual
Laser
Halfling
Posts: 44
Joined: Sun Jul 08, 2007 3:50 am

Post by Laser »

Trosan, I would be very interested to see your tile manager!

Laser
Trosan
Greenskin
Posts: 101
Joined: Sun Jun 10, 2007 4:57 pm
x 1

Post by Trosan »

Have been working on this alot over the last days. Moved around lots of code, optimized for speed, improved something here and there.

Well, I am nearing completion. Actually, the code is there, but I think without any kind of documentation, this will not be of great use to anyone. So I've started with writing document information for at least the public functions. Hopefully, I'll have that done by tomorrow. *crossing fingers*

To give you a basic overview of the classes it'll contain:
  • TileTextureManager
    This class creates and manages the texture atlas you will need later on. You can pass your textures directly here (as Ogre::Images) or let it load the textures from disc. It will put them into a texture atlas and load this texture atlas dynamically. Can be deleted after this work has been done.
  • TileManager
    This is where you do everything with your heightmap. In this class, the map (containing different chunks which are managed by the class TileChunk, which I will not mention here) is being created (so, pass your heightmap and "tiledata" - information about which texture to draw where - to this class) and basically managed (you should use TileInterface for most actions, though). You will also retrieve your data here (such as if you wish to save the map later on).
  • TileInterface
    A pointer to this class will probably be held in your frameListener. This class manages the dynamic loading/unloading of chunks (which are out of view distance) and the selection of tiles and change of height at selected tiles. For tile selection you can pass it a "brush" (a vector of floats) which it uses for tile selection, then you simply call the TileInterface::selectTile(mouseX,mouseY) function with the current position of your mouse and it will select the tile for you.
To mention some features of the TileBasedTerrain (some of which have been mentioned above):
  • Automatic creation of the texture atlas for the terrain texture.
  • ready-to-use interface for selecting tiles (with a brush) and performing height changes on them (so yes, its editable!)
  • dynamic loading/unloading of chunks depending on a view distance (you can set)
  • two levels of detail (high and low) for the chunks, the lower of which applies from a certain distance (there's a glitch still, which I won't fix before the release, but perhaps the community has an idea for that - IIRC SPT had that issue at the beginning, too)
If there's any interest, I'll reimplement the "grid" feature from the old terrain manager (shouldn't be hard) which allows for activating a grid on the terrain. But that won't be in the first release then.

Oh and on the todo list there's:
  • Correct calculation of normals (right now, wrong normals are applied).
I really don't want to keep the code locked up so long, but when I release it, I want it to be stable, tidy and without a high risk of interface breaks in the near future.
So, perhaps that'll be this weekend - if not, perhaps the week after (and so on).

Oh, and sorry for any mistakes in the text above. It's late here now.

- Trosan
evehal
Gnoblar
Posts: 15
Joined: Sat Nov 25, 2006 1:05 pm

Post by evehal »

hi, i got the source code by CVS,but i cant complie it in vc2005,here is the log:
error C4335: Mac file format detected
Trosan
Greenskin
Posts: 101
Joined: Sun Jun 10, 2007 4:57 pm
x 1

Post by Trosan »

Sorry, I'll need an other week to do this properly.

@evehal: I'd recommend you to wait for the new version. It's compatible with Ogre 1.4 and LGPL'd (in contrast to one of the later version of the terrain manager found in the daimonin sources [which I did not use of course]).
Trosan
Greenskin
Posts: 101
Joined: Sun Jun 10, 2007 4:57 pm
x 1

Post by Trosan »

I've found time (something I hadn't expected), to assemble a pre-release version.

API reference is online!

I will upload the sourcecode in the next days, after I've assembled a small demo application.
Trosan
Greenskin
Posts: 101
Joined: Sun Jun 10, 2007 4:57 pm
x 1

pre-release

Post by Trosan »

Okay, couldn't find any good (non-copyrighted) textures for a demo application, so I'll pre-release the sourcecode for you!

Pre-release means that there might still be some interface changes until the final version, but the main part is already there.

Download: Tile Based Terrain V2.0pre


Current to do list:
  • Calculation of normals
  • Fix the LOD-change glitch (please, come up with suggestions)
  • Listen to suggestions of the community (that's you :-P)
polyveg
Halfling
Posts: 78
Joined: Fri Mar 04, 2005 7:08 am
Location: Germany

Post by polyveg »

(...) and LGPL'd (in contrast to one of the later version of the terrain manager found in the daimonin sources [which I did not use of course]).
@Trosan:
Filopher and me decided (ages ago - it seems) that the tileengine-part of our projects is lgpl. If you need sourcecode of the tileengine for your work - i have no problem with 2 licenses for 1 chunk of code.
The code in the daimonin svn stays gpl3 (means if there is somebody in need of code for the lgpl version - just drop me a line, i will support it).

I was very busy -in rl- the last months, so there is not much progress on the tileenigine. But i hope to find more time for daimonin again.
Had a look at the iris2 terrain stuff some days ago and I like the visual output of it, but its still much too slow. So I have to do some more coding in the future. I am thinking of more filters while keeping the 2 layers limit.
Trosan
Greenskin
Posts: 101
Joined: Sun Jun 10, 2007 4:57 pm
x 1

Post by Trosan »

Cool, thanks for your answer! I'll see if I can use any of your code!
Perhaps you could take a look at the current sourcecode and see if it's of any use to you. There's not a lot of new stuff at the moment, though. I am currently working on correct normal generation...
Trosan
Greenskin
Posts: 101
Joined: Sun Jun 10, 2007 4:57 pm
x 1

Post by Trosan »

Have enabled some shadows, but I am not satisfied with the result yet. Sorry I can't show anything, mainly working on a project which hasn't got an announcement here yet and I don't want to spoil anything (hope you can understand that).

Anyhow, there's a new API doc available.

There will probably be some interface "additions" due to correct generation (and regeneration) of normals, but the rest will probably remain untouched (or just slight changes will be made).
User avatar
rrarunan
Gnoblar
Posts: 4
Joined: Thu Dec 06, 2007 10:40 am
Location: Chicago

TBT looks promising for my project

Post by rrarunan »

I got the TBT source from the latest link in the thread. I got it to compile in my application. The API doc was helpful in explaining the functions of the tile based terrain engine.
Trosan
Greenskin
Posts: 101
Joined: Sun Jun 10, 2007 4:57 pm
x 1

Post by Trosan »

Yay, it works not only on my PC! :) Thanks for your feedback. I was very busy over the last months so I wasn't able to continue work. But I've got more time again and I am going to release a new version sometime soon.

What I am currently up to is the shadows - they do actually work, but I need to find a way to efficiently rebuild the normals when the map is changed (I am going to suppose that people will be using the height changing features in an editor kind of thing where it's no problem if the lighting isn't always updated instantly and so on).
Also please note that in "editor mode" you will probably be unable to use stencil shadows (you will probably turn off shadows for performance reasons there, anyway).
Trosan
Greenskin
Posts: 101
Joined: Sun Jun 10, 2007 4:57 pm
x 1

TBT2 - Release Candidate 1

Post by Trosan »

First release candidate is out.

Download:
New features: Recalculation of normals (after height has been changed) now works nicely!

There will hopefully be no more interface changes until the final version which I plan to release next week. *crossing fingers*
TdZBdaO
Gnoblar
Posts: 21
Joined: Sat Mar 22, 2008 3:20 pm
x 1

Post by TdZBdaO »

Hi!

First off, great work! This tiled terrain manager is exactly what I've been looking for!

However, since I'm relatively new to Ogre and therefore TBT, I wondered if you (or someone else around here) could provide us with a little help getting started. Nothing special, just a bit of code showing how to implement the terrain manager and make use of its basic functionality. I've compiled the dll and stuff, but - to be honest - I don't really have an idea how to start out from this point.

I'd appreciate that very much :)


EDIT:

I played around a bit with it and now got the basics working (hopefully). However, I'm not sure how to set the terrain dimensions. I tried to setup the TileManager and TileInterface classes according to the API, but all I see is a grey plane of even size, no matter what tile size I pass to setMapSize().

What I did so far:

Code: Select all

 mTileManager=new TileManager("terrainName", basenode);
    mTileManager->setMapSize(CHUNK_SIZE_X*10,CHUNK_SIZE_Y*10);
    mTileManager->setHeightAt(5,5, 3.0f);
    mTileManager->createChunks();
    mTileInterface=new TileInterface(mTileManager, cam);
In addition to that, controlChunks() is called from within frameStarted() of my listener class. Did I forget something here?
User avatar
totex
Gnoblar
Posts: 6
Joined: Wed Mar 26, 2008 11:33 pm
Location: Chile
Contact:

Post by totex »

hi, any sample app available?
Trosan
Greenskin
Posts: 101
Joined: Sun Jun 10, 2007 4:57 pm
x 1

Post by Trosan »

First of all, sorry for the delay. I was a bit busy again.

@TdZBdaO and totex: Looks like you're both looking for an example application. Yes, I could try and create one, shouldn't be much of a problem if I find some nice textures for use with the TBT (if you happen to be able to share some, feel free :)). Would it be sufficient for you if I used the example framework for that?

@TdZBdaO: Let me have a closer look.. First of all, the functions you call are correct and also the order. controlChunks() won't work, I guess you are referring to controlChunks( 0.0, true ); instead.

As to "grey plane of even size", are you sure you can see any height differences and so on? You don't have any textures on the terrain and you'd need TileTextureManager for creating them the way I intended, which is a bit more complicated, but you could try and change the material script and assign a (big, if possible) texture to it.

Before calling createChunks(), you could try and call loadTileData( ... );
No default TileData is set at the beginning ( ** possible FEATURE REQUEST ** ) so you should better call it manually... [I don't even know why it works that way, but it will probably cause problems somewhen if you don't set the TileData - have marked it on my todo list]...
User avatar
totex
Gnoblar
Posts: 6
Joined: Wed Mar 26, 2008 11:33 pm
Location: Chile
Contact:

Post by totex »

Trosan wrote: @TdZBdaO and totex: Looks like you're both looking for an example application. Yes, I could try and create one, shouldn't be much of a problem if I find some nice textures for use with the TBT (if you happen to be able to share some, feel free :)). Would it be sufficient for you if I used the example framework for that?
Perfect for me. I only want to see how to setup a simple scene :P
TdZBdaO
Gnoblar
Posts: 21
Joined: Sat Mar 22, 2008 3:20 pm
x 1

Post by TdZBdaO »

@Trosan

Thanks very much for your suggestions. Meanwhile i've managed to get the problem. The point was that I did not call controlChunks() with the immediately-flag set true once before doing the regular updates in FrameListener::frameStarted().

Adding this line right after the previously posted code solved the problem:

Code: Select all

mTileInterface->controlChunks(0, true);
So you were absolutely right with what you said :)

However, there's a new problem now. I'm pretty sure this one occurs because I didn't used the TextureManager class the way it should be used.
When I start the application, the terrain now shows up correct, but the texture (should be some grass) doesn't show up correctly.

Like I already said, I didn't get behind those principles now, so It'd be great if you could come up with a little code snippet demonstrating the texture related stuff or something. Nothing big, just a few lines to make me understand where to go next. Maybe I could provide some sort of tutorial or HowTo once I learned it myself.

Thanks again!
Trosan
Greenskin
Posts: 101
Joined: Sun Jun 10, 2007 4:57 pm
x 1

Post by Trosan »

Okay, second release candidate!

Download: New features: Demo application!
I've also found and fixed a little bug, so please recompile the TBT library!

Some info on the controls:
- left mouse: select tile (there's no cursor atm, just imagine one at the center of the screen)
- space: select tile (the same as left clicking with the mouse) and raise the height of the currently selected tile
- R: toggle grid view
- Print screen: Screenshot
- Q/Esc: Exit.

Also note: If you want to run this "out-of-the-box", please copy the contents of the media folder into the media folder of your OGRE_HOME.


RC2 won't be the final version as I've found a little bug in the TileTextureInterface (but the solution to this will NOT be interface-breaking, so you don't need to wait).

- Trosan


PS: I was also able to make some screenshots now. It's nothing special. Just how the demo is supposed to look. :)

Image

Image
Post Reply