Development weblog
Large 3D terrain generator

January 2

User interface changes

Hi Everyone,

[Aside: Happy new year!]

Methinks it’s time for a little clean-up of the L3DT user interface. Changes include:

  • The addition of icons for frequently-used menu options (see image below).
  • The Active map and Mouse tools menus have been renamed Layers and Tools, respectively. The contents of these two menus have also expanded somewhat, taking some options from other menus (e.g. Utilities→New map layer has moved to Layers→New map layer).
  • Other menu options and dialog boxes have been renamed slightly for greater clarity or consistency.
  • Some toolbar icons have been updated (New project, Show map) or removed (CPU throttle, RAM chart and Image drape).

:l3dt:2010:jan:menuicons.png
Menu icons

All in all I think these changes should make the user interface a little easier to learn for new users, without having any lasting adverse effects on current users. However, if you have any strong feelings about these changes, please feel free to post a comment in the forums.

These changes are included in the latest developmental build of L3DT Pro (v2.8 build 6), which is on the downloads page now. These changes will also be included in the next builds of the Standard and Pro for Torque editions when they are next compiled.

Please note that the on-line user guide has not yet been updated to reflect these new changes. The documentation will be updated when these changes are rolled into the next stable release. Until then, please feel free to ask for help in the forums if you can no-longer find a menu option.

Best regards, Aaron.

 

December 11

ZeoScript compiler

Hi Everyone,

In the latest build of L3DT Pro (v2.8 build 2, 10th of Dec ‘09), the ZeoScript plugin has been updated to use a just-in-time (JIT) compiler. The effect of this compiler is to increase the speed of loops in ZeoScript, and that it has achieved. Map calculations in ZeoScript should now run at least 5x faster than before.

Syntax changes

Users should also be aware that the syntax of the ZeoScript language has been revised for greater clarity and ease of use. I have updated the example scripts provided with the new installer, but if you use custom scripts, you may need to modify them to work with the new release. Below I have included a listing of all the major syntax changes:

Nested function calls

Function nesting, whereby one function’s return value is fed into the argument list of another, was previously achieved using the <zs:ScriptText> operator. Now, the ‘zs:’ component is redundant, so nested functions are denoted simply by the < and > braces.

The examples below show the old and new way of calling nested functions. Here, the values of c and d are added together, then multiplied by b, and finally a is assigned the resultant value:

Old set a <zs:mul b <zs:add c d> >
New set a <mul b <add c d> >

By removing the ‘zs:’ component, the purpose of the code becomes more obvious, and this should make the language both easier to use and learn.

Accessing maps, file formats and global variables

Previously, to retrieve a map from the L3DT map project, one used the <m:MapName> operator. This special operator has been replaced by the ‘GetMap’ function, which otherwise behaves in much the same fashion, as shown below:

Old map.GetWidth <m:HF>
New map.GetWidth <GetMap “HF”>

Similarly, the <f:MapName MapType FileExt> operator for retrieving file format handlers was replaced by the ‘GetFormat’ function, and the <v:VarName> operator for retrieving global variables was replaced by the ‘GetVar’ function.

Casting variable types

To cast a variable value from one type or another, it was necessary to use the <cast:type var> operator. This has been replaced by a ‘cast’ function, but as it happens, the resulting syntax is almost identical:

Old echo <cast:float i>
New echo <cast float i>

[note that the ‘:’ is no longer necessary]

Pointer referencing and dereferencing

In previous versions of ZeoScript, the interpreter would automatically reference variables and dereference pointers as required. In the new version, users now have responsibility to manage pointers, just as with C/C++.

As an example, the code below shows the use of the function ‘EditUI’ which takes two arguments, the first of which is a pointer to a variable (a hvar), and the second is a string. In the new compiler, you must manually reference the variable using the & operator to get the hvar, like so:

int i
EditUI &i "Enter integer" // edit i (using & to get handle)

In the old interpreter, you could pass any variable in as the first argument, and the interpreter would automatically reference the variable to get the hvar:

int i
EditUI i "Enter integer"

By disabling automatic referencing/dereferencing, I hope to make it more obvious whether fucntion arguments are being passed by value or by reference. However, this behaviour may be more difficult to learn for scripters not familiar with pointers. Consequently, many examples are provided.

elseif

In addition to the ‘if’, ‘else’ and ‘endif’ statements, I have now added an ‘elseif’ statement to permit neater if/else chains.

For example, the following code prints a different message depending on the value of an integer i.

if <isgt i 10>
  echo "i is greater than 10"
elseif <isgt i 5>
  echo "i is greater than 5 but less than or equal to 10"
else
  echo "i is less than or equal to 5"
endif

In the old interpreter, the ‘elseif’ used above could only be achieved by nesting an if statement within an else statement, like so:

if <isgt i 10>
  echo "i is greater than 10"
else
  if <isgt i 5> // nested if in else, instead of an elseif
    echo "i is greater than 5 but less than or equal to 10"
  else
    echo "i is less than or equal to 5"
  endif
endif

By permitting ‘elseif’, we save on some unnecessary nesting, and simply the structure of the if/else chain.

Future changes

Any further development of ZeoScript will be focussed on improving the execution speed of the runtime engine, and extending the range of functions and features available. I do not anticipate making any any further changes to the syntax of the language, as I feel ZeoScript now meets its requirements with a minimum of fuss. Hence, scripts written for this new ZeoScript plugin should continue to work indefinitely with future releases of L3DT (that’s the plan, anyhow.)

Documentation

I have not yet updated the examples or reference pages for ZeoScript, as those pages represent the state of ZeoScript in the current release-version of L3DT. These pages will be updated for the next release, which will likely be v2.8a, in the near-ish future.

In lieu of updated documentation, I have updated all the scripts included with the installer, which provide examples for most of the scripting features. However, if you require additional information or help, please feel free to ask in the plugins and scripts forum.

Best regards, Aaron.

 

December 3

Compiler revisited

Hi All,

There are a number of features that I’ve been meaning to implement for several years, and every so often I pull one off the shelf and have another look at it. This week, it’s the turn of just-in-time (JIT) compiling for scripts. I’ll let you know how it goes...

Cheerio, Aaron.


Update: It seems to be going well so far, and I’ve successfully run some simple scripts as compiled bytecode. However, I still need to port more script interpreter features over to the compiler (e.g. loops, if/else/endif, nested functions, etc.) Stay tuned... — Aaron 2009/12/04


Update 2: It’s still going rather well. I’ve added support for compiling nested functions, as well as pointer referencing/dereferencing. Some syntax improvements have been made also, which I’ll discuss in a later post. Still working on the if/else/endif and do/while statements... — Aaron 2009/12/04 (later)


Update 3: The compiler now supports do/while loops, and they’re really fast. That’s good, since faster loops was the whole point of the JIT compiler. There’s still if/else/endif to do, and a whole lotta testing, but I’m now quite optimistic that the JIT compiler will make it into the next developmental build. Faster scripts for everyone! Hurrah! — Aaron 2009/12/05

 

November 26

Importing Mars Terrain

Hi Everyone,

Following a user’s recent request, I have added a plugin to import terrain from the Mars Orbiter Laser Altimeter (MOLA) mission. The plugin is called L3DTio_MOLA, and is available here. To use the plugin:

  1. Download the MOLA ‘.LBL’ and ‘.IMG’ files from NASA / Wash. U..
  2. Select the ‘File→Import→Import MOLA terrain’ menu option (note: option will not appear if plugin is not installed).
  3. Select the MOLA LBL file. The plugin will automatically load the associated IMG file.

Further notes on downloading and using MOLA data are provided on the L3DTio_MOLA plugin page.

The results should look something like this:

:l3dt:2009:nov:molademo2.jpg
MOLA terrain, 2D view.

:l3dt:2009:nov:molademo.jpg
MOLA terrain, 3D view.

Cheerio, Aaron.

 

older entries >>

 
start.txt · Last modified: 2010/01/02 04:49 by aaron
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki