Simple Tiled Implementation - STI v1.2.3.0

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
ClaudeM
Prole
Posts: 30
Joined: Sat Oct 16, 2021 6:27 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by ClaudeM »

The triangulated rock now stays as one solid unit: one body with many pairs of shape & fixture.
Bulldozer-solid-rock-20211201.png
Bulldozer-solid-rock-20211201.png (38.83 KiB) Viewed 11669 times
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by Karai17 »

Are you tinkering with the box2d plugin or working on an hc plugin? it look slike the box2d plugin got borked at some point and i didn't notice. i haven't really looked at this code in quite a while and have been relying on pull requests for patches any time someone needs a new feature or found a bug.

either way, i'd ask that you update or add new test maps to the repo if/when you submit a pull request so that it can be shown that the plugin is functioning as expected.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
ClaudeM
Prole
Posts: 30
Joined: Sat Oct 16, 2021 6:27 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by ClaudeM »

I have made substantial changes to the Box2D plugin init function: moved triangulation from one function to the other, changed the order of operations so a new body is available sooner, and changed the main loop to step through the instances table. Next steps: look at layers, find how offset is added twice, attach image to body.

Any hints about that last one are appreciated.
User avatar
ClaudeM
Prole
Posts: 30
Joined: Sat Oct 16, 2021 6:27 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by ClaudeM »

Here is the game with the small test map.
Attachments
bulldozer-0.14.zip
(2.68 MiB) Downloaded 300 times
User avatar
ClaudeM
Prole
Posts: 30
Joined: Sat Oct 16, 2021 6:27 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by ClaudeM »

How are object positions updated in response to physics engine updates? I do not know how to establish that link.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by Karai17 »

You would need to pull the positional data from the physics object and apply it to the graphical object.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
ClaudeM
Prole
Posts: 30
Joined: Sat Oct 16, 2021 6:27 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by ClaudeM »

There are two options.

1) Replace the position and orientation entries in the STI table with references to the LÖVE2D physics engine values. They idea being that they refer to the same location in memory; that way the physics engine updates the values and STI uses them to draw.

2) Create a map:box2d_update function which finds the dynamic objects in the object layer and updates the position and orientation values from the physics engine values. The map table would need references to the physics objects.

The first one requires no extra work a run time. I need to confirm that Lua tables support this sort of thing.
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by Karai17 »

Only tables and functions are stored as references. I think it would be better to have an update function, that way it can be overridden if needed.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
ClaudeM
Prole
Posts: 30
Joined: Sat Oct 16, 2021 6:27 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by ClaudeM »

Agreed! I will create a new function.

Code: Select all

    -- Update dynamic objects. It must be called after the physics
    -- update has run and before calling the STI draw function.
    --
    box2d_update = function(map)

        -- One way to do this:
        --   - go through instances
        --   - find those on the object layer
        --   - find dynamic objects
        --   - copy position and orientation from the body
        --     to the object

        -- Is there a more direct way to find all dynamic objects?
        -- I could use the collision table.
        -- A collision table entry contains { object, body, shape, fixture, }
        --   - find dynamic objects
        --   - copy position and orientation from the body
        --     to the object

    end
markusm
Prole
Posts: 3
Joined: Sun Dec 05, 2021 7:23 am

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by markusm »

Hi,

I am a new user trying out Love, I have issues getting my tiled maps to show via sti (only get a black screen) so I tried the above example game (bulldozer-0.14). It hangs after pressing the space bar on my M1 Max MacBook Pro.

Extracting the tile maps to my project works (they are displayed), trying to find the differences to my tile maps.

I attached my world.map which only displays a black screen.
Attachments
Archive.zip
(2.32 MiB) Downloaded 301 times
Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests