-
-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add functionality for generated maps #139
Comments
In general, I think this is a good idea. @TheRamenChef could you describe your requirements in more detail? What are the required engine extensions in you eyes? |
Basically, I want to be able to make procedurally-generated levels for better replay value. |
Any updates on this feature? |
In general, I think most of the API in the However, I still think there might be some missing or non-public APIs that we didn't come across yet. I'll investigate this and check for any missing pieces. |
I just wrote a quick test that checks for the available methods of the XML implementation compared to what is available on the interfaces (public API). de.gurkenlabs.litiengine.environment.tilemap.xml.CustomProperty ✔ de.gurkenlabs.litiengine.environment.tilemap.xml.Blueprint
de.gurkenlabs.litiengine.environment.tilemap.xml.GroupLayer
de.gurkenlabs.litiengine.environment.tilemap.xml.ImageLayer
de.gurkenlabs.litiengine.environment.tilemap.xml.Layer
de.gurkenlabs.litiengine.environment.tilemap.xml.MPublic APImage
de.gurkenlabs.litiengine.environment.tilemap.xml.MapObject
de.gurkenlabs.litiengine.environment.tilemap.xml.MapObjectLayer
de.gurkenlabs.litiengine.environment.tilemap.xml.Text
de.gurkenlabs.litiengine.environment.tilemap.xml.Tile
de.gurkenlabs.litiengine.environment.tilemap.xml.TileChunk
de.gurkenlabs.litiengine.environment.tilemap.xml.TileData$Compression
de.gurkenlabs.litiengine.environment.tilemap.xml.TileData$Encoding
de.gurkenlabs.litiengine.environment.tilemap.xml.TileData
de.gurkenlabs.litiengine.environment.tilemap.xml.TileLayer
de.gurkenlabs.litiengine.environment.tilemap.xml.Tileset
de.gurkenlabs.litiengine.environment.tilemap.xml.TmxMap
As a first step, we should iterate over these missing methods and check which ones should be included in the public interface. Then we can define further API that simplifies map generation, e.g. a helper class that simplifies the generation (also see #329 and This forum post) |
Not to be greedy, but can you point a link to these past games? |
Sorry, these were internal projects. But I'm currently working on extending Gurk Nukem with a mechanism to generate maps at runtime as an example project. In general: collision boxes are just Adding a mapobject to a layerlitiengine/utiliti/src/de/gurkenlabs/utiliti/components/MapComponent.java Lines 378 to 389 in 3455fa6
Creating a new MapObjectLayerlitiengine/utiliti/src/de/gurkenlabs/utiliti/components/MapComponent.java Lines 709 to 716 in 3455fa6
Creating a new MapObjectlitiengine/utiliti/src/de/gurkenlabs/utiliti/components/MapComponent.java Lines 866 to 904 in 3455fa6
If you'd rather use the engines |
Genius, that will work in theory. I'll check it out |
Previously, it was necessary to provide static TileData that was not considered to be changed afterwards. With this change, it's possible to change tiles on a map at runtime. The main API for this is ITileLayer.setTile. Don't throw InvalidTileLayerException, try to avoid crashing a game over all other code-design. Issue #139
96be92d introduces a new API to support generating maps: Usage IMap generatedMap;
try (MapGenerator generator = Resources.maps().generate(MapOrientations.ORTHOGONAL, "mymap", 100, 100, 16, 16, Resources.tilesets().get("tileset.tsx"))) {
tileLayer = generator.addTileLayer(RenderType.GROUND, (x, y) -> {
if (x == y) {
// draw a diagonal in another tile color
return 2;
}
// fill the entire map with this tile
return 1;
});
// set an explicit tile at a location
tileLayer.setTile(10, 10, 3);
// add a collision box to the map
generator.add(new CollisionBox(0, 50, 100, 10));
generatedMap = generator.getMap();
} |
LITIEngine currently has very little support for maps generated at runtime. I would like to have this functionality for the game I’m working on.
The text was updated successfully, but these errors were encountered: