Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

DynTerWerks editor

Recommended Posts

As Leadwerks doesn't allow dynamically terrain system, i decided to write own editor for that. It consists of DLL with functionality and EXE with form for view.

Main idea is simple: global world (it can be very large) is separated to small terrain parts, lets call them "cells" (for now, they are 512*512 and there are only 4 cells).

They can group into one "region" (for now, 4 cells with 512*512 size can be grouped into one terrain 1024*1024, that engine can load).

How those cells are stored and their size is unnecessary information for all team, except maybe one programmer.



So, artist just select needed region (now he may press "Generate" button), and DynTerWerks Editor generate region from 4 cells and loads new terrain in Leadwerks Editor. DynTerWerks editor now minimized and waiting, when artist would finish his work with LE Editor.



When he finish editing this region, he just press Save button in Leadwerks Editor and close it, then DynTerWerks editor opens again, it split region into cells and save them, so artist can see them now in DTW Editor.





DLL is written on C++, so this functions can be called from the game without additional problems.



- grouping RAW height-maps 512 to 1024, and 1024 to 2048.

- splitting RAW height-maps 1024 to 512 and 2048 to 1024.



- grouping PNG 512 to 1024.

- splitting PNG 1024 to 512.





Editor is written on C#, this would cause the faster development.



- showing RAW files on the form.

- generating new terrain.

- loading terrain in Editor.



- add dynamic cells loading: map cells must be stored in format "i@j.raw" for correct parsing.

- add dynamic cells drawing (pictures are searched in folder).

- add statusStrip with usefull info.

- add menuStrip.

- add Settings form.

- add runtime cell generation.

- move map files to directories.

- icon changed.

- save editor settings (pathes to directories with maps) to xml file.

- if xml file with settings dont exist or some settings cant be read, new one is created and set all settings by defult.

- user can change editor settings with Settings form.

- add possibility of editing just one cell.





- add possibility to edit one region (4 cells).

- fix terrain rotation problems.

- add build-in viewer instead of editor (or with editor).

- add DDS (or PNG) normal-map support.

- add general map image zoom and movings.

- add trigger in game, when new terrain may generates.

- show this in game.

- dynamic selection of regions with mouse in TerraDyne Editor.

- add TinyXml and save project configs in XML files.

- wait, till Josh would add multithread loading :unsure: , so i would be able to load new region during gameplay, so player would see a large world without loads.



Link to post
Share on other sites

I'd be tempted to call it "Groundwerks" as you're starting from the ground up :unsure: but you wanted a smart name.


It's all very interesting. I like the idea of having cells paged in if it didn't cause too much stuttering. Microsoft FSX did loading and preparing terrain cells in another thread and every alternate frame to spread the load. This doesn't seem like an easy task but I'll be following what you do with it.


There are other possible issues to resolve too, physics, world size and floating point error. Camera relative rendering would go a long way to fix juddering I think but I don't know enough about the LE internals to even guess at how you could make that work. Just Cause 2 uses 64 bit floats for all positional data to deal with that problem. There's a feature on it somewhere I'll try and locate.


But kudos to your approach. I hope it can be made to work. Thumbs up here.

Link to post
Share on other sites

Thanks for answer.


About number of memory - i think, some test needed to find perfect balance between loading time and terrain size. High-map of 512 terrain weights 512Kb, High-map of 1024 terrain is 2Mb and 2048 is 8Mb... other variable is size of cells: i can create one 2048 region from 4 * 1024, or 9 * 682 (as cells can be any parts, not only 512/1024/2048), or something like that... tests are needed anyway :unsure:


About physics there may not be a problem: i plan just to freeze the world, load new geometry (better, if in another thread, so i would be needed to change pointer from one to another), then move dynamic objects to new coordinates(as they don't save on geometry, this looking like annoying problem, but i hope that one control function may deal this problem) and unfreeze it. This can be longer than one frame, but... i dont know the better solution.


About floating point error: every time the center of the would would be near player. As new map would create, center would move to the center of new landscape.


Preparing terrain cells in each frame is a good idea, but i dont think that it would works good for Leadwerks.

Link to post
Share on other sites
  • 2 months later...

Here i am again :D

I returned to this project some days ago, but for these days i do a lot of interesting (or sometimes not) stuff, like changing icon, adding some functionality, adding xml files with settings and so on (first post is updated).


Now user can add cells in runtime and different parts of project are in different folders (for example, all cells in one folder that called TDMaps, temporary maps are in folder that called TDTempMaps ) and even more: user can re-define names of that folders from setting window, so they would be stored in XML file. Even if that XML file would be lost or corrupted, editor would generate new file automatically, you would need just re-define your new folder names.


Also, i added possibility to edit only one cell, edit the whole region (4 grouped cells, with is really the most ineresting feature of this editor) and now i'm planing to add a viewer, that would provide fast viewing of cell, without loading whole editor.

post-648-086231000 1279668079_thumb.png

Link to post
Share on other sites
  • 3 months later...

I'm not quiet sure, but on the old forum there was a guy Pushedx I think. I remember he was talking something about making work LE in parallel threads. Or I might be wrong. It was a long time ago. Here is some post I found, but not sure if its has any importance for you. Maybe there is more related posts, I dont know. (http://forum.leadwerks.com/viewtopic.php?f=3&t=3635&hilit=thread)

Btw Pushedx was a cool community member. He knew so many things and helped people a lot. I wonder where did he go? Why did he left our community?

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...