Page 87 of 92

Re: Simple Tiled Implementation - STI v1.2.3.0

Posted: Sun Nov 21, 2021 10:52 pm
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

Re: Simple Tiled Implementation - STI v1.2.3.0

Posted: Sun Nov 21, 2021 10:53 pm
by ClaudeM
Here is the ZIP archive for the game. I am using LÖVE2D 11.3 with master branch of STI.

Re: Simple Tiled Implementation - STI v1.2.3.0

Posted: Sun Nov 21, 2021 11:01 pm
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?

Re: Simple Tiled Implementation - STI v1.2.3.0

Posted: Sun Nov 21, 2021 11:04 pm
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!

Re: Simple Tiled Implementation - STI v1.2.3.0

Posted: Sun Nov 28, 2021 12:58 am
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?

Re: Simple Tiled Implementation - STI v1.2.3.0

Posted: Sun Nov 28, 2021 2:30 am
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~

Re: Simple Tiled Implementation - STI v1.2.3.0

Posted: Sun Nov 28, 2021 11:50 pm
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.

Re: Simple Tiled Implementation - STI v1.2.3.0

Posted: Wed Dec 01, 2021 12:31 am
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.

Re: Simple Tiled Implementation - STI v1.2.3.0

Posted: Wed Dec 01, 2021 1:32 am
by Karai17
I believe that is an offset value for staggered maps.

Re: Simple Tiled Implementation - STI v1.2.3.0

Posted: Wed Dec 01, 2021 11:07 pm
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 11060 times