Jump to content
Sign in to follow this  
shezan74

World Tools preview

Recommended Posts

Well... a small sneak preview from the "old" Fence Generator, now called "World Tools" for marketing purposes (it's a completely new project, with brand new bugs, typos, problems and malfunctions!!!)

New version is the result of the experience in using old fence generator in my island project. I've found some slow patterns and i've tried to remove them from the software.

It has the same features of the previous Fence Generator, plus:

1) function keys for fast object switch when placing (speed up repetitive functions like "fence, fence, fence, gate, fence, gate, fence, wall...)

2) brand new UI with stacked windows, to take advantage of wide monitors and help users with small monitors.

3) new built-in scripting language, to create patterns, compounds, powerlines with "cables-towers" sequences, towns (!) and everything else.

4) support for new forest generator project that will share UI and other components for a better integration.

5) no programming skills needed. Only some time to learn how scripting language works

The scripting language has been used to place, in a single click a complete house block with:

- house, fences on front side, walls on other sides, gate, plants and bushes

Here a "preview" of the scripting language, with some documentation on it.

The script will place 2 H shapes made of wall and pipelines

worldtools_1.jpg

and the script

begin

//placing objects with 0 deviation from user required direction 
InsertObject(f76d760c-58c0-40ed-b167-5ef98de68a60;0;0;20;Red) //Castle bastion
InsertObject(f76d760c-58c0-40ed-b167-5ef98de68a60;0;0;20;Red) //Castle bastion
InsertObject(f76d760c-58c0-40ed-b167-5ef98de68a60;0;0;20;Red) //Castle bastion

// moving cursor to relative object south (Y < 0)
movecursor(0;-30)

// inserting object with 90° rotation east
InsertObject(fd866cea-4870-4471-98e5-5e0aa06da116;90,0;0;21;White) //Oil pipeline

// moving cursor to relative object south (from the object end coordinate)
movecursor(0;-30)

// resetting direction to initial direction clicked by user. This command is equal to “rotate(-90)†in this place
// due the fact the only ROTATION made by script was when placing OIL PIPELINE
resetdirection()

//placing objects with 0 deviation from user required (and restored) direction 
InsertObject(f76d760c-58c0-40ed-b167-5ef98de68a60;0;0;20;Red) //Castle bastion
InsertObject(f76d760c-58c0-40ed-b167-5ef98de68a60;0;0;20;Red) //Castle bastion
InsertObject(f76d760c-58c0-40ed-b167-5ef98de68a60;0;0;20;Red) //Castle bastion

//moving cursor north east of the current position with axis oriented to the last placed object
movecursor(50;50)

//rotating actual direction by 90° clockwise
rotate(90)

//placing objects with 0 deviation from user required direction. Those objects are ROTATED by 90°
InsertObject(f76d760c-58c0-40ed-b167-5ef98de68a60;0;0;20;Red) //Castle bastion
InsertObject(f76d760c-58c0-40ed-b167-5ef98de68a60;0;0;20;Red) //Castle bastion
InsertObject(f76d760c-58c0-40ed-b167-5ef98de68a60;0;0;20;Red) //Castle bastion
movecursor(0;-30)
InsertObject(fd866cea-4870-4471-98e5-5e0aa06da116;90,0;0;21;White) //Oil pipeline
movecursor(0;-30)
//rotating back -90 from actual direction
rotate(-90)
InsertObject(f76d760c-58c0-40ed-b167-5ef98de68a60;0;0;20;Red) //Castle bastion
InsertObject(f76d760c-58c0-40ed-b167-5ef98de68a60;0;0;20;Red) //Castle bastion
InsertObject(f76d760c-58c0-40ed-b167-5ef98de68a60;0;0;20;Red) //Castle bastion

end

// Introduction to WorldTools scripting language
// WTS has been created to easily allow users to create "templates" for placing fences and other objects on the map, avoiding repetitive 
// commands and saving a lot of time.
// object placement is made by using an "actual direction" concept.
// the direction set when user clicks on the "directions" form is used "actual direction".
// object placed in "relative mode" has a "direction" parameter that represents the DEVIATION FROM ACTUAL DIRECTION.
// an object with 0° deviation will be placed on the same direction clicked by user on the "directions" form.
// Read carefully this concept: After each object placement the "actual direction" reflects the LAST PLACED OBJECT direction.
// if user clicks 30° and object is placed with +40° orientation the object will placed on map with a direction of 70°.
// a following object with +10° orientation will be placed on map with a direction of 80°

// MoveCursor commands are referred to the ACTUAL DIRECTION. In this case "north" means "the same direction of the latest placed object".
// 80° in previous example. East (90°) is 170° on map, in previous example.

// There are some commands that allow the user to rotate axis and set absolute placements (locations and directions). 
// Those commands will be explained later in the command list

//  ** Command List **

// Begin: should be placed at the first row of the script. Everything before this line is ignored.
// End: should be placed at the final row of the script. Everything after this line is ignored.

// MoveCursor(decimal X, decimal Y): move the CURRENT CENTER of the cursor by X / Y meters from actual position (the end of the last placed object).
// the direction is RELATIVE to the last placed object. North means "the same orientation of the last placed object)
// X > 0 move the cursor to relative east
// X < 0 move the cursor to relative west
// Y > 0 move the cursor to relative north
// Y < 0 move the cursor to relative south

// MoveCursorAbs(decimal X, decimal Y): move the CURRENT CENTER to the X / Y absolute coordinate on the map.
// 0 / 0 coordinate is placed on the bottom left of the screen

// Rotate(decimal degrees): rotate the actual direction by required degrees from actual direction. This function will effectively ROTATE AXIS.
// Next object with 0° deviation will be placed on the new "actual direction (actual direction + rotation value parameter)
// values > 0 means RIGHT TURN
// values < 0 means LEFT TURN

// ResetDirection(): Restores the original directions (the clicked one on the form) for each following object. 
// Set actual direction to 0° if user clicked "NORTH" button on "Directions" form.

// SetNewDefaultDirectionAbs(decimal degrees): Set a new direction for default direction. Is equivalent to a "direction" form click in the middle of the script.
// This command doesn't affect anything until the user doesn't place a "ResetDirection()" command

// SetNewDefaultDirection(decimal degrees): Set a new direction for default direction. New default direction will be "actual direction" +-degrees

// MoveAlongActualDirection(decimal distance): Move the cursor along the last object direction, starting from object center

// InsertObject(GUID object Id, decimal deviation, decimal Relative Height, decimal object length, string Color Name)
// Deviation is the +-DEVIATION from the actual direction
// values > 0 means RIGHT TURN
// values < 0 means LEFT TURN
// 0 means NO TURN
// When object is placed the new "actual direction" = "actual direction" +- deviation

// InsertObjectAbs(GUID object Id, decimal Direction, decimal Relative Height, decimal object length, string Color Name)
// Direction is the ABSOLUTE direction of the object

If someone is interested to test it i will prepare a beta release.

About scripting language i'm interested in comments and suggestions for features, commands and command renaming :rolleyes:

Share this post


Link to post
Share on other sites
will this support image sizes up to 8192x8192???

This is my worst problem. It seems the image object furnished with Visual Studio will not support anything more than 5.000 pixel x 5.000 pixel or so. It will crash with a spectacular: "OUT OF MEMORY EXCEPTION.

Maximum allowed image is 5120, but world can be made of every size multiple of 512.

In your case you can use a map image of 4096x4096 and multiplier x2.

The result is very precise also with a x2 multiplier on the map and performances will rocks. I already have set double buffering on frames and images to increase scrolling but dealing with large images is a nightmare with standard C# controls.

by the way there is a way, maybe, with 64 bit native compilation of software, but i think we're not so much on the place with a x64 compliant OS. I have some hopes in new Framework 4.0 and VS2010... but not so much.

If someone knows a free c# .NET control that allow show bigger images could be appreciated... next step is learning DirectX... :(

one of my worst screenshots... but it's time to leave office :)

worldtools_2.jpg

Edited by shezan74

Share this post


Link to post
Share on other sites

I've just completed first "working" draft of new feature in WorldTools.

It's a forest generator tool that is based on the FANTASTIC MaskMapper idea but enhance it's concept to make a more flexible (and complex :rolleyes:) ambient generator.

Basically it support up to 30 different colours on mask map, without restrictions on the color itself. This could be easily improved to support more colors, but in this case there will be a BIG configuration work, due the fact each color can be configured in very different ways. 30 is enough for me, but there are no real limits so i will increase to 256 for final release.

The program will analyze each single pixel of the map, matching pixel position and colors with the color settings provided by the user and described below:

Basically each color can be configured with some parameters:

1) maximum number of objects than program will ATTEMPT to place on the map. The system will randomly select a number between 1 and the indicated number. This number is related to pixel size. If your mask is 512x512 and map is 10240x10240 each pixel represent 20x20 meters, so take this value into consideration (a value of 1, also with a 100% probability of placement means 1 object -a tree- every 20 sq/mt, could be not so much for a forest...)

2) placement probability: Program will ATTEMPT for the number of times described above to place an object on the area defined by the pixel under evaluation. The attempt will be driven by the placement probability: a placement probability of 0 means no way to have an object on this color (basically for sea areas). 100 means every ATTEMPT to place object will hit (and program will place the exact random number of object as defined on point 1)

3) list of objects that CAN be placed.

At every SUCCESSFUL ATTEMPT to place an object the program will randomly select an object as defined on color configuration. Each object under the selected color has a placement probability. If there is one object there is no choice :) In every case when point 2) is passed, an object will be placed. Sum of objects placement percentages will be automatically RESCALED to 100% if lower or higher.

So the workflow will be:

- defind the pixel color configuration

- define a number of attempts between 1 and maximum value for the desired color.

- for each attempt will TRY to break the placement probability percentage for the desired color.

- if object must be placed another random test will be made to choose between object defined, based on percentage of appearance.

Well... there are a lot of parameters to play with and i'm still trying to figure the best way to play with this tool.

Performances are good, the program will take 10-15 seconds to generate 600.000 objects and 2 seconds to export them into a single file on my environment, but should not be so different on other ArmA2 compliant machines.

Could be interesting to know if, with those fast regeneration times, will be useful to split file for each object type or keep all objects in a single file...

worldtools_3.jpg

In the above example:

Black color (sea) has a 50% placement percentage but no object defined -> nothing will be placed

red color (the selected one has the green ball) called R=235, G=0, B=0) has a 50% probability to be placed (there are some visual glitch on slider but description containse real value), 2 objects per pixel with a pixel size of 5x5 meters and 2 objects to be placed (larix and stone).

Objects percentages will be rescaled from 49% and 10% to have a 100% sum on generate process.

Grey rows doesn't have effects on placement (0% or 0 objects) and so on.

This interface and visualizations will be subject to small modifications and bugfixing to be more readable. Having images with 256 colours or more to be configured will be a HUGE (and maybe unuseful) work.

By the way placed objects are shared with "fence generator" section so can be easily usable on fences and object scripting.

That's all for now. The tool will be released as usual for free in the next days after some test and optimizations, and it's intended to replace "old" fence generator tool (if someone is using it).

Share this post


Link to post
Share on other sites

Wow...

i´m really impressed.

Right now i´m not in the stage of using this tool but for shure will use it in my future work. It´s a pity that theese kind of tools give so much to the community in the end but everybody only admires the results.

Noone cares about the screwdriver the Porsche was built with...

please keep up your work...

Share this post


Link to post
Share on other sites

Impressive !

... if you "tools-makers" are going on with your project, I believe we can get a decent tools box in the future.

Share this post


Link to post
Share on other sites

This looks really impressive and versatile!

I liked the maskmapper idea because its possible to make masks from a variety of different sources, being able to use multicolours as well makes it more versatile still!

Theres a facility built in to Global Mapper, for example which allows you to automatically download Landsat 7 overlays - a bit cheesy now compared to the detail you'll see on Google earth - (though back in the day we thought Landsat 7 was just the most amazing images ever! :)) - not what you might want to use for a Sat layer, but they're available in "pseudocolour" as well - this is basically processed images designed to emphasise ground cover details, using a reduced palette...

They're all ready-rectified and will download nicely directly over SRTM DEM's, for example - if thats what you happen to be using...

With a tool like this it might be possible to derive useful vegetation info in usable form from images like that for relatively painless vegetation mapping...

B

Share this post


Link to post
Share on other sites
They're all ready-rectified and will download nicely directly over SRTM DEM's, for example - if thats what you happen to be using...

With a tool like this it might be possible to derive useful vegetation info in usable form from images like that for relatively painless vegetation mapping...

B

Yes, tool has been made to fit my needs on a fictional island, but has been made to be compatible with automated sources like ground coverage informations.

I'm now working on some "cloning" tools to allow users to avoid manually replicating configurations for 30-40 "similar colours" on the map.

Share this post


Link to post
Share on other sites

I love the mask mapping. Eagerly waiting for my island. Currently working on height & satmaps.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×