Skip to content
This repository was archived by the owner on Jul 1, 2026. It is now read-only.

yupswing/TileCraft

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

112 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project is no longer maintained.

---

TileCraft MIT License Haxe 3 OpenFL 2 Cross platform

TILECRAFT

2.5D fast multi-platform modeling tool to make tiles for games, icons or whatever you want!

Alpha8 Interface


Index

Status

The project is in an ALPHA development stage.

Anyway the BETA status is very close.

See the TODOs to check the work in progress.

Milestones

  • alpha: Shape and model (load and save to Base64)
  • alpha2: Model renderer
  • alpha3: Lights renderer + postfx (Antialias+outline)
  • alpha4: Basic interface
  • alpha5: Save to PNG (image+model) and big housekeeping
  • alpha6: Shape list + improved gui
  • alpha7: Model editing
  • alpha8: Open/Save + check updates + improved feedbacks
  • alpha9: unreliable systools removed
  • beta stage: Improve interface and renderer <-- in progress
  • rc stage: Polish the app
  • release: Done!

Download

Windows

Try it

To compile the project by yourself you need to set up some stuff (see also this guide from Wulf)

Haxelib

Install the needed libraries (and keep them updated)

haxelib install openfl
haxelib run openfl setup
haxelib install actuate
haxelib install akifox-transform
haxelib install akifox-asynchttp
haxelib install hxColorToolkit
haxelib install compiletime
haxelib install format
haxelib install systools
haxelib git plik https://github.com/yupswing/plik.git

(Only Windows or Mac) Rebuild systools for your platform (the project need to be revived!)

haxelib run lime rebuild systools [windows|mac]

Clone this repository

git clone https://github.com/yupswing/TileCraft.git

And finally try to compile and run (need to use legacy OpenFL)

Note: NEKO is very slow, I strongly recommend to run native instead

cd tilecraft
haxelib run lime test [windows|mac|linux] -Dv2 -Dlegacy

Notes: Sadly systools has lots of problems so I can't use the native Open and Save Dialogs right now

On Mac it works only the native save dialog (you have to put a path by hand if you want to open a model).

On Linux no native dialog works (you have to put a path by hand if you want to open a model).

Verified working setup (Windows)

This stack only compiles with Haxe 3.x — Haxe 4 rejects OpenFL 3.6.1's old syntax (@:enum abstract, @:fakeEnum). Confirmed working versions: Haxe 3.4.7, OpenFL 3.6.1, Lime 2.9.1.

# Install Haxe 3.4.7 + matching Neko, make sure both are on PATH/HAXEPATH/NEKOPATH
# (the haxelib.exe shipped with Haxe 3.4.7 is 32-bit, so NEKOPATH must point at a 32-bit Neko build)

haxelib install openfl 3.6.1
haxelib install lime 2.9.1
haxelib run lime setup
haxelib install actuate
haxelib install compiletime
haxelib install akifox-transform
haxelib install akifox-asynchttp
haxelib install hxColorToolkit
haxelib install format
haxelib install systools

haxelib git plik https://github.com/yupswing/plik.git

# Run
lime test neko -Dv2 -Dlegacy

# Or just build (output in Export/windows/neko/bin/)
lime build neko -Dv2 -Dlegacy

# Native Windows .exe (lime build windows) instead needs Visual Studio
# Build Tools with the "Desktop development with C++" workload installed.

project.xml declares <ndll name="systools" haxelib="systools" /> so lime copies systools.ndll into the Export bin folder — the systools haxelib ships without its own include.xml, so without this lime never knows to bundle it and the app crashes on boot with Failed to load library : systools.ndll.

If your shell's PATH/HAXEPATH/NEKOPATH env vars get out of sync with this toolchain (e.g. errors like "unable to start correctly" or a missing neko_kind_lookup entry point in ssl.ndll, both signs of a 32/64-bit Neko mismatch), and/or lime test hangs/loops instead of opening the window (lime 2.9.1's CLI does a network version-check on every run that can intermittently fail and retry), use dev.ps1 instead — it pins the right environment, builds, and launches the exe directly via PowerShell instead of through lime's run step:

.\dev.ps1                       # build neko -Dv2 -Dlegacy, then run the exe
.\dev.ps1 build neko -Dv2 -Dlegacy   # just build

Native Windows .exe (no Haxe/Neko needed to run it)

The Neko build above still needs the Neko VM DLLs alongside the exe. For a fully native binary, install Visual Studio Build Tools (workload "Desktop development with C++") and use hxcpp 3.4.64 specifically — not 3.3.x or earlier, and not the haxelib-default 4.x:

haxelib install hxcpp 3.4.64
haxelib set hxcpp 3.4.64

Older hxcpp generates __alloc(hx::Ctx*, ...)-style constructors that the Haxe 3.4.7 compiler doesn't emit-compatible code for anymore (error C2039: 'Ctx': is not a member of 'hx') — Haxe 3.4.x requires hxcpp >= 3.4.49. hxcpp's native libs (std.dll etc.) also need to be (re)built once for the 32-bit toolchain lime 2.9.1's Windows target always uses (it hardcodes -DHXCPP_M32, there's no 64-bit option in this lime version):

cd /d "%HAXELIB_REPO%\hxcpp\3,4,64\project"
haxelib run hxcpp Build.xml -DHXCPP_MSVC_CUSTOM

run from an x86 (or x64_x86 cross) Developer Command Prompt, with C:\HaxeToolkit\msvc_compat_include (or wherever you put a one-line #pragma once + #include <typeinfo> shim named typeinfo.h) prepended to INCLUDE — modern MSVC dropped the legacy typeinfo.h header that old hxcpp's hxcpp.h still #includes.

dev-native.bat wraps all of this (vcvarsall, the typeinfo.h shim, and the lime build windows call). It assumes the toolchain lives under C:\HaxeToolkit as set up above. Run it from the project root:

dev-native.bat

Output: Export\windows\cpp\bin\TileCraft.exe — a standalone native PE32 GUI exe, only depends on a couple of small native DLLs bundled right next to it (no Haxe/Neko install needed on the target machine).

Along the way two real bugs were found and fixed: Renderer.arrayIntFill's from/to clamp treated 0 (a perfectly valid "start of array"/row-0 value) as "unspecified" and snapped it to array.length, so the renderer's per-frame buffer clear was silently a no-op — this is what caused the "ghost" pixels from previous renders lingering on screen; and two TileCraft.resize() background rects passed the wrong-edge X coordinate as their width/height argument.

The real Nvidia driver crashes — use Mesa's software renderer instead

This build crashes on launch against the real GPU driver: access violation inside nvoglv32.dll (the Nvidia 32-bit OpenGL driver) right after the main window paints its first frame. Reproduced even with a maximally stripped-down screen (no widgets at all beyond a background fill), and even with an old prebuilt native binary predating any of this session's changes — so it's not a TileCraft bug, it's this specific lime 2.9.1 legacy GL renderer tripping a bug in the current Nvidia driver, unrelated to project content.

Confirmed workaround: swap in Mesa's llvmpipe software OpenGL implementation in place of the Nvidia driver, for this exe only (nothing system-wide is touched). dev-native.bat does this automatically if the DLLs are present in vendor\mesa-x86\ (gitignored — not committed, ~50MB):

# download & extract once (x86/32-bit build, matches this lime's -DHXCPP_M32 target)
https://github.com/pal1000/mesa-dist-win/releases  ->  mesa3d-*-release-msvc.7z
#   -> extract x86/opengl32.dll and x86/libgallium_wgl.dll into vendor\mesa-x86\

With those two files in place, dev-native.bat copies them next to the built exe and generates Export\windows\cpp\bin\TileCraft Launcher.bat, which sets GALLIUM_DRIVER=llvmpipe and LIBGL_ALWAYS_SOFTWARE=1 before starting TileCraft.exe. This avoids the crash entirely and renders the full UI correctly (verified: model view, toolbars, color picker, shape list, output panel all draw as expected). Software rendering is slower than the native driver but is otherwise indistinguishable functionally — good enough until/unless the actual Nvidia driver bug gets tracked down.

Important: TileCraft.exe itself has no idea any of this is needed — running it directly (double-click, a shortcut, lime test windows, etc.) uses the real Nvidia driver and crashes. Always launch via TileCraft Launcher.bat instead (it's what dev-native.bat itself uses to launch after building). Without vendor\mesa-x86\, dev-native.bat skips generating the launcher, builds normally, and runs TileCraft.exe directly against the real driver (and warns you first), which is expected to crash.

Lostgarden challenge

The original idea for this tool comes from lostgarden.com

Here's the test-cases he provides to check the efficiency of the tool.

This were made in just five 5 minutes (all of them!)

Test Cases

Examples

Here some example models. To import them in TileCraft there are two ways:

  • Click on and after CTRL+V or CMD+V one of this example Base64 strings
  • Otherwise you can download the PNG and load it in TileCraft (yes it works!)
A complex shape

Ff__1fb_QEW78K8-7ebTJDI_OVJXUpAjpswzUUY1p3At____9-F2vjJB33qSfoaPprO8Mzw5DkBLCjwAWldvAGlIj1CrKhJwRZrNMEtIzmJFGhKCq5rNkiNnvCLNRc3CI0USAnhmP0xpzGlDEt4BDng7eEPe3gEDLd4BQEXeAUOr7wFCvHkS
A truck

Ff__1fb_QEW7PqXyzu3fRFFcFRoMnpdtzMiPUUY1p3At6pA-9-F2vjJB1d7WfoaPprO8GG6LIxgUiyMnbos5BB6aIkQjqxInFIs4RM2rEkR4qxIDEotnGj6LZ3ASi3iA3os5EH-aWTREiGoAVYs4RnerREaZq0RGu6tERt2rREYzq0Q03ppE
A car

Df__1fb_QEW7PqXyzu3fRFFcFRoMO4GPzMiPUUY1p3At6pA-9-F2vjJB1d7WfoaPprO8GDyLI0RFqxImPIs2RKurEgNWi1UDfItVLMy7My0ziDMtM7szQL2LWHBni1YANYtWcDV7RA..
An happy farm ;)

E____wAA____PqXys9vuJDI_OVJXUpAjpswzUUY1p3At6pA-9-F2vjJB33qSfoaPprO8OxK8AUo0qwFLq5oBO828ATgjNBg5IlUDOd1VAwgeVSIBigESMXoBIjGIAQExqgEBUYgAMzYRiAE2FCWbNiM0vBYFFpo27ncCNt40BA..
A fancy home

Ev__1fb_QEW7PqXys9vuJDI_OVJXUpAjpswzUUY1x4J11M2l9fDJvjJB33qSfoaPprO8WzRo72tWaO9rjG2tWzdtrQk8bQgAaY0UQGl9Nghp3gAIPE0AWjeLrVk3TYtqjIutaYy9iwg8bZkwI94LMM3eCzDNVgsZNmh9
A dice

C___1fb_4NrTPqXyDDJAJDI_OVJXUpAjpswzUUY1p3At6pA-9-F2vjJB33qSfoaPprO8EUspByFLKQczVjRnM5o0ZzOaeGdDVokSM1Z4Z0OaiVYzVlZnM5pWZ0N4iTQ.
HOME (lostgarden test-case)

DP__1fb_QEW7PqXys9vuJDI_OVJXUpAjpswzUUY1x4J11M2l9fDJvjJB33qSfoaPprO8a4xdrVs3Xa0JPE0IAGmNFEBpfTYIad4ACDxNAFo3e61ZN02Laox7rWmMTYsIPF2Z
FACTORY (lostgarden test-case)

DP__1fb_QEW7PqXys9vuJDI_OVJXUpAjpswzUUY1x4J11M2l9fDJvjJB33qSpmxRprO8CS1tCAA1jRYIJt4ACC1NAAgtfZlLmt5FSIvNNkleIwlLi32rCy19qghpzUUIms1Z
STONE (lostgarden test-case)

CP__1fb_QEW7PqXys9vuJDI_OVJXUpAjpswzUUY1p3At6pA-9-F2vjJBY2tzfoaPoK66HTwqAh48KjUfPCpnPkQzZz6qRGc-u3dnPlWIZz5nVmc.
TREE (lostgarden test-case)

BP__1fb_QEW7PqXys9vuJDI_OVJXUpAjpswzUUY1p3At6pA-9-F2vjJBorAneocaoK66HTwqAh48KjUePCqbHTwqaA..
WOODCHUCK (lostgarden test-case)

DP__1fb_QEW7SGV9s9vuKztNOVJXUpAjpswzUUY1p3At6pA-9-F2vjJBorAneocaoK66FDwqGkRGmgFEm5oBQ0aaV0ObmldEVZpmRKqaZkQ2Vq5EnFauQqtWvUJFVr0ADwMK

TODO

The tag in bold, before every entry, indicates at what stage that feature will be, hopefully, implemented.

  • General
  • Check online for updates
  • BETA Housekeeping (make the whole more coherent)
  • RC Unified dispatcher
  • RC Online repository
  • RC Make sure everything got disposed/destroyed
  • RC Make sure every listener got removed
  • RC Look and fix every TODO in the code
  • POST RELEASE Support OpenFL3
  • Conversion of Java code to Haxe code
  • Internal Model
  • I/O + Base64 encoder/decoder (improved in alpha4)
  • Renderer (Fast+Lights)
  • GUInterface (improved in alpha6)
  • Model wysiwyg editor
  • Renderer
  • Convert LGModeler Renderer
  • Output different size ( 0.5 , 0.25 , 0.125 )
  • Fix incorrect rendering (ordering slices)
  • POSTFX shaders (apply FXAA to have smooth output image)
  • POSTFX make FXAA support alpha channel
  • POSTFX Use normal scaling with no PostFx if opengl not supported
  • Sync between renderers delays
  • BETA Support edge smoothing
  • BETA batch renderer and save to file
  • BETA Trick NORM to have N/E Ramps and rounded N/S edges
  • Model
  • Convert LGModeler Model
  • Support for PNG Output with embedded model data
  • BETA Add author and model name to PNG metadata
  • BETA Save enabled and lock to model data (tcMa)
  • BETA Permit change color0 and use it as floor color (rendered)
  • BETA Add more primitives (Prism, Arc)
  • BETA Extend to 64 shapes
  • RC Extend model to 32 colors (use the other 16 as replacement for batch rendering)
  • Interface
  • Resizable window
  • ShapeList dragging to reorder shapes in model
  • Add shape to model
  • Clone shape
  • I/O from string (Base64)
  • Feedback on Load/Save/Boot/Errors
  • Save/Load file
    • Windows: Save and load native dialogs
    • Mac: Save native + load textual (problems with systools)
    • Linux: Save and load textual (problems with systools)
  • BETAHistory (basic keep last 5 models as steps)
  • BETA Report waiting (render especially) with Thread (and GUI modal 'box')
  • BETA Minimap (Orthogonal Top and Side view)
  • BETA ALT (center transformation), SHIFT (keep it square), Rotation (single element, whole context)
  • BETA 90deg rotations (xyz) (changing positions and primitive type to simulate rotation)
  • RC Support light style scheme

Utilities

Conversion regexp from java to haxe

(public|private) (static )?([a-z]+)([^{;]+\([^{]+)
$1 $2function$4:$3
(int|byte|float|boolean)\[\] ([a-z0-9]+)
$2:Array<$1>
(int|byte|float|boolean) ([a-z0-9]+)
$2:$1
\(Int\)
Std.int

About

Haxe/OpenFL 2.5D Modeling Tool (prototype, no longer mantained)

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Haxe 96.6%
  • Batchfile 2.4%
  • PowerShell 1.0%