From UFOpaedia
Jump to navigation Jump to search

World.dat editor

My little project - editor for UFO1/2 WORLD.DAT. It can view and edit globe data.

2D screen
3D screen

Info line at the bottom shows current cursor cordinate (longitude and latitude and game units) plus undo levels (currently up to 50).

At the top of the right side is poly list - you can click on any poly and it will be selected on the globe screen too. And vice virsa. Arrow up/down buttons move selected poly through the list (to alter rendering order). In lower right part - selected poly info: texture ID, vertex coordinates. This "memo" field can be edited, and by pressing enter apply changes.

At the top of application is options/tools panel:

  • Trackbar shows current zoom level.
  • Poly edit checkbox - vertex edit ability (uncheck it if you wish to prevent occasional vertex drag).
  • Knife is a poly knife tool, which allows to split selected poly in two with "rubber" line (LMB click, hold, drag to 2nd point and LMB release). Work only over selected poly.
  • Outline checkbox - poly outlines rendering.
  • Trajectory checkbox - rendering of shortest globe trajectory (LMB and MMB changes start/end trajectory points).
  • Radars checkbox - rendering of radar circles (LMB changes radar position).
  • Background - works in 2d mode - renders "earth map" image as background. Value is image shift (in game units) to adjust its position. "-80" is typical value for earth maps from internet (like this one).
  • colored line - is a terrain palette. Click LMB to change selected poly terrain type.
  • Save Undo checkbox changes undo save on exit. If you want to have undo work even after application exit - check this.
  • Floppy button - saves current state to world.dat.
  • Load BG button - loads background image (maximum 8000x4000px)
  • Clear BG button - clears loaded background image from memory.
  • Import 2D Obj - imports wavefront *.obj file as globe mesh (in 2d format). Different object groups treated as different terrain types (object group name must end with gNN, where NN is terrain ID).
  • Export 2D Obj - exports current globe mesh (2d) into wavefromt *.obj file. Terrain types saved as named object groups "gNN".


Poly edit
  • Mouse wheel to zoom in/out current view.
  • RMB drag to scroll camera view.
  • LMB over poly to select poly. If there is a number of overlapped polys - it selects them from top to bottom cyclically.
  • LMB over "vertex" to select vertex and start vertex dragging. If it's central point - it will drag whole poly.
  • Cursor keys to move selected vertex or whole poly.
  • Tab to switch between vertices of selected poly.
  • Insert when poly selected - adds new vertex at cursor position. When no poly selected - creates new 1-vertex poly at cursor (with position # prior to last selected poly).
  • Delete if vertex selected - deletes this vertex. When no vertex selected or central point selected - deletes whole poly.
  • Ctrl while vertex drag/move - "glue" other vertexes with same x/y and moves them with selected one.
  • Shift toggles background image on/off (if BG is on - it make it off when pressed, and vice versa).
  • S shortcut to knife tool.
  • Up/Down buttons with arrows are moving selected poly up or down (rendering order). Rendering order does matter.
  • Double click on terrain palette - select "paint color".
  • Space to paint selected poly with terrain selected with DblClick.


When application starting - it loads saved config, and background image. It works with "world.tmp" file as current globe mesh, and saves to "world.dat" only when you click "save" button. If you delete "world.tmp" file before start, it will create new one from "world.dat". If you drop another "world.dat" file into editor folder - please delete world.tmp, otherwise it will load this temp :)

When application closing - it saves "world.tmp", config and undo file (only if "save undo" checkbox in on). Config file contains terrain color palette and checkboxes/selections/camera position. You can edit world.cfg manually to change terrain colors and add some extra (for example for TFTD) - parameter "terriain #RRGGBB".

Since WORLD.DAT poly can have only 3 or 4 vertices, when quad is "knifed", it might lead to creating of 3 + 5 angled polys. And 5 angled poly will get 5th vertex dropped. 1 or 2 vertices in poly also possible, but that may lead to bugs in the game. So pay attention on not leaving such "degenerative" polys.

During edit session globe poly coordinates are shifted 1360 game units right, in order to make globe more like a unwrapped globe map (instead of teared apart along grinwich meridian). While saving it restores grinwich meridian.

"randomsites.dat" is extraction from xcom1 with globe trajectory areas data (they are shown in the middle list in the right half of the screen). "Zone"."Trajectory_segment"."10_random_areas"


Download (812k) zipped win32 executable [2014-12-01].