astrochili / defold-trenchfold Goto Github PK
View Code? Open in Web Editor NEWA toolkit to design a level in TrenchBroom and export it to Defold
License: MIT License
A toolkit to design a level in TrenchBroom and export it to Defold
License: MIT License
Hi
Thanks for the example, having issue with Defold 1.6.3
/example/main.collection The file '/assets/maps/level/level.collection' could not be found.
Too many brushes with different textures along one wall create a large fragmentation of convex shapes.
But in fact they are one big convex shape.
It would be nice to merge convex shapes automatically when it's possible.
It might be worth considering the idea of a separate compose, where each entity is in a separate gameobject. Each mesh and collision object should be located in its local center relative to its gameobject. This will allow us to move individual entities as needed, and dynamic objects will be handled correctly.
It's possible to find shared brush planes and find overlapping faces within. This will allow to automatically remove unused mesh geometry.
This flag should help to place brushes with decal faces along walls, and automatically place them to the minimum distance to the wall when exporting.
Not sure about the final implementation yet.
Now each texture creates a separate mesh. According that post it would be great to find a way to merge all the textures in one to generate one mesh.
This can also open the way to make a lighting map.
Similar to a game object, it should be possible to place a collection file. In general, the implementation is most likely very similar to the current implementation of the game object.
First of all, converting the map file distributing within the github project works fine. However, when I open the map file in Trenchbroom (on Windows 10), save it and re-export the .obj file without any changes - I got an issue with the map conversion proccess:
There is nothing special, it happens due to Windows encoding: the re-exported .obj file has CR/LF instead of just LF. So, I made a change in a regex pattern in the utils.get_lines funciton to : '[^\r\n]+
function utils.get_lines(content)
...
for line in content:gmatch '[^\r\n]+' do
table.insert(lines, line)
end
...
And now it works with both the CR/LF and LF line endings, on Mac and Windows.
Maybe it can help.
Now the script analyses an .obj
file that contains ready-to-use vertices, normals and uv coordinates. This requires exporting the .obj
from TrenchBroom every time the geometry is changed. It would be great to analyse the map itself to skip the export step.
This is an example of the brush:
// brush 104
{
( -144 -64 80 ) ( -144 -63 80 ) ( -144 -64 81 ) retro/TECH_4B 0 16 0 1 1
( -144 -64 80 ) ( -144 -64 81 ) ( -143 -64 80 ) retro/TECH_4B 0 16 0 1 1
( -144 -64 80 ) ( -143 -64 80 ) ( -144 -63 80 ) retro/TECH_4B 0 16 0 1 1
( -128 64 144 ) ( -128 65 144 ) ( -127 64 144 ) flags/unused 0 16 0 1 1
( -128 64 96 ) ( -127 64 96 ) ( -128 64 97 ) flags/unused 0 16 0 1 1
( -128 64 96 ) ( -128 64 97 ) ( -128 65 96 ) retro/TECH_4B 0 16 0 1 1
}
What does it mean:
(point_1) (point_2) (point_3) texture offset_x offset_y angle scale_x scale_y
The points generate a plane, not a face, we need to calculate the intersections of all the planes to produce vertices.
So we need to do three things:
offset_x
, offset_y
, angle
, scale_x
and scale_y
values.At the moment, I don't understand how to do any of these tasks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.