Simple Tiled Implementation - STI v1.2.3.0

Showcase your libraries, tools and other projects that help your fellow love users.
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 »

do you need proper physics for your game? box2d might be overkill. it might be worth looking into using the bump plugin instead
Last edited by Karai17 on Sun Nov 21, 2021 10:55 pm, edited 1 time in total.
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: 31
Joined: Sat Oct 16, 2021 6:27 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by ClaudeM »

Here is the ZIP archive for the game. I am using LÖVE2D 11.3 with master branch of STI.
Attachments
bulldozer.zip
(2.68 MiB) Downloaded 888 times
User avatar
ClaudeM
Prole
Posts: 31
Joined: Sat Oct 16, 2021 6:27 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by ClaudeM »

Hum . . . interesting suggestion: use bump instead of Box2D. I want to push the rocks (well, I want my grandson to push the rocks); that is quite simple. I will read about bump and consider switching. Thanks.

Will AABB make all the rocks effectively rectangular? Will they rotate when pushed at an angle? Much to think about.

Thanks again for the suggestion.

P. S. So, am I going off the beaten path?
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 »

i don't think bump is able to rotate, everything would be a rectangle.

you're not necessarily going off the beaten path, but it's worth mentioning that box2d is a full physics engine which is almost always overkill. i think the LHC library can do rotations bit there is no current plugin for sti.. but you could make one!
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: 31
Joined: Sat Oct 16, 2021 6:27 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by ClaudeM »

I made a smaller 8 x 8 map with one rock and added print statements to the Box2D plugin. I begin to understand: Each collidable tile has a corresponding static collision rectangle, but it is offset by a factor of two. Similarly, the rock has a dynamic collision rectangle. I just need to follow the code logic till I find where the tile polylines are replaced with rectangles and where the factor of two is added. Same with the rock. This will be easier that making a HC plugin from scratch.

Why does a four vertex polyline get a newEdgeShape instead of a newChainShape.

I will look at HC to see if it can do what I want. Can STI work without a plugin, with hand made HC code?
Attachments
Bulldozer_20211127.png
Bulldozer_20211127.png (71.75 KiB) Viewed 13157 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 »

The plugin is how the data from STI gets inserted into the Box2D world. You could write custom code to handle it but it woudl have to effectively do what a plugin would have to do anyway so if you're gonna write HC code, may as well wrap it up~
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: 31
Joined: Sat Oct 16, 2021 6:27 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by ClaudeM »

Good point! If I decide that HC can do all I need, it is better to make a plugin for it than to put the code in my game.
User avatar
ClaudeM
Prole
Posts: 31
Joined: Sat Oct 16, 2021 6:27 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by ClaudeM »

Karai17,

What is the meaning and purpose of oy in sti/init.lua ?

Code: Select all

        newInstance.oy    = tile.r ~= 0 and tile.height or 0                              
Thanks.
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 »

I believe that is an offset value for staggered maps.
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: 31
Joined: Sat Oct 16, 2021 6:27 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by ClaudeM »

Thanks to your encouragement, I am making progress. Some problems remain: 1) Not all walls are present. 2) There a double offset for the rock. 3) The rock triangles are not bound together. This is great!
Bulldozer-broken-rock-20211201.png
Bulldozer-broken-rock-20211201.png (38.52 KiB) Viewed 12496 times
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 0 guests