Help implementing game logic from fish fillets

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
darkfrei
Party member
Posts: 1169
Joined: Sat Feb 08, 2020 11:09 pm

Re: Help implementing game logic from fish fillets

Post by darkfrei »

Thanks for screenshots, I know how to fix it: rewrite the gravity function :)
1) Take all blocks.
2) Remove all that have the collision to the map (after one movement down).
3) Remaining blocks, that collide just each other, interpritate as metablocks, check if they collide just themselves and no other metablocks.
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
glitchapp
Party member
Posts: 235
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Help implementing game logic from fish fillets

Post by glitchapp »

That sounds great!... but I don't think I will succeed myself in rewriting it, I don't understand how all the functions in the game logic interact... I will attempt it but not sure I will manage to do it.

quick update: there is a third level with the same problem:
laboratory.gif
laboratory.gif (92.27 KiB) Viewed 3650 times
I worked in the demo to make the game fully playable without the heavy assets and managed to get it as small as 1mb!. Now that the game is close to reach 1gb, this will be very handy for those only interested in playing the puzzle or anyone who want to test the game or debug it.

In that 1mb file the whole game is playable (there may be still some bugs but I tested it and all the levels load).

The levels in which the floating bug happens are: 23, 54 and 57

Thanks

* The demo has been updated, the non working menus have been disabled and the font size corrected so that is more easy to read and select.
Attachments
Fishfilletsmini.love
Press "O" for options, press "L" for level selection
(1016.9 KiB) Downloaded 120 times
Last edited by glitchapp on Wed Jul 20, 2022 6:11 am, edited 6 times in total.
User avatar
darkfrei
Party member
Posts: 1169
Joined: Sat Feb 08, 2020 11:09 pm

Re: Help implementing game logic from fish fillets

Post by darkfrei »

Thanks for the demo! I will try my best, but I need time for it :)

Update: please make the version number, for example game_6_42.love where all small changings are in the second number, but huge updates change the first number.
It's pretty complicated to understand what version I change for the gravity update.
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
User avatar
darkfrei
Party member
Posts: 1169
Joined: Sat Feb 08, 2020 11:09 pm

Re: Help implementing game logic from fish fillets

Post by darkfrei »

Here is the push-blocks and .love
push-blocks.lua
from fishfillets_mini-2022-07-20
(96.84 KiB) Downloaded 137 times
fishfillets_mini-2022-07-20.love
(1.02 MiB) Downloaded 137 times

Is it ok that some objects floating and not falling?
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
glitchapp
Party member
Posts: 235
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Help implementing game logic from fish fillets

Post by glitchapp »

Wow! you solved it again! Amazing!

There is something strange in level 57 (the laboratory). For the first time I see the ingame lagging a little... is it because that level has too many objects and there too many calculations with the new game logic?

It is not that bad but it is noticeable. Anyway do not worry, I just wonder... but it is not important at all and it only happens on that level.
Is it ok that some objects floating and not falling?
I don't understand your question here I'm afraid. Objects should never float (unless some kind of strange new mechanics are created). In the original mechanics objects should never float, but I don't see any object floating with your new game logic, or am I missing something?

Thank you darkfrei! It's amazing what you've done!

update: Definitely the new game logic impact performance a little. I have an idea: To use the new game logic only in the 3 needed levels, and use the old one on the rest, unless you have another idea...
User avatar
darkfrei
Party member
Posts: 1169
Joined: Sat Feb 08, 2020 11:09 pm

Re: Help implementing game logic from fish fillets

Post by darkfrei »

You are right, the lag on the level 57 is pretty big.

We can add some optimizations: don't update not moved objects AND return if nothing is falling.

Is this part here ok?
Attachments
2022-07-20T23_24_35-4. UFO. Biological Experiments.png
2022-07-20T23_24_35-4. UFO. Biological Experiments.png (12.65 KiB) Viewed 3556 times
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
glitchapp
Party member
Posts: 235
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Help implementing game logic from fish fillets

Post by glitchapp »

Hi Darkfrei, after testing more deeply the new game logic now I understand your question.
newgamelogic.gif
newgamelogic.gif (62.49 KiB) Viewed 3535 times
No it is not right and if you see the gif I attached here there are other objects floating too.

In any case this is by no means any complain, this is a great improvement and those levels can now be solved (they could not be solved before).

The only problem now is that new game logic has created 2 new problems: Performance issue (only noticeable on the laboratory level so far) and now other objects strangely float (but it seems that this time does not affect the puzzle so much and the levels can be solved).

Thank you, I'm glad there has been a lot of progress, this game logic is way more complicated that I thought but I'm glad you are solving it!
User avatar
darkfrei
Party member
Posts: 1169
Joined: Sat Feb 08, 2020 11:09 pm

Re: Help implementing game logic from fish fillets

Post by darkfrei »

glitchapp wrote: Thu Jul 21, 2022 4:18 am The only problem now is that new game logic has created 2 new problems: Performance issue (only noticeable on the laboratory level so far) and now other objects strangely float (but it seems that this time does not affect the puzzle so much and the levels can be solved).

Thank you, I'm glad there has been a lot of progress, this game logic is way more complicated that I thought but I'm glad you are solving it!
I want to rewrite it again, but please move all long sound and graphics logic to the other file, then the physics logic will be more clearly.

The code now is:

Code: Select all

function pb:fallBlocks (blocks)
	local dx, dy = 0, 1
	for i = 1, self.gridWidth do
		for i, block in ipairs (blocks) do
			local metablock = self:getMetablock (block, {}, dx, dy)
			local metablockCanFall = true
			for i, b in ipairs (metablock) do
				local canFall = self:isBlockFalling (b, dx, dy, metablock)
				if not canFall then metablockCanFall = false end
			end
			
			if metablockCanFall then
				self:moveBlocks (metablock, dx, dy)
				for i, b in ipairs (metablock) do
					event_on_block_falling (b)
				end
			end 
		end 
	end 
end
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
glitchapp
Party member
Posts: 235
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Help implementing game logic from fish fillets

Post by glitchapp »

Hi darkfrei, the graphics and sounds code in the 1mb version of the game are not needed and can be deleted, I've just commented them because I did a quick work to reduce the size of the game to test it and provide it, but as soon as I have time I will delete them all and leave the game logic clean again.

I will publish it here with the game logic cleaned as soon as I have time, thanks for your patience!

Update: I cleaned the game logic, let me know if it is enough, now is almost like the original you created.
Attachments
Fishfilletsmini21.08.22.love
(1006.8 KiB) Downloaded 119 times
push-blocks.lua
(14.73 KiB) Downloaded 122 times
glitchapp
Party member
Posts: 235
Joined: Tue Oct 05, 2021 10:34 am
Contact:

Re: Help implementing game logic from fish fillets

Post by glitchapp »

Hi again,

This is a small update I did to the demo (attached here) with the following changes:

Some bugs due to the demo trying to find non existent assets are removed.
The old game logic and the new one are cleaned and the events and assets removed as this demo does not need them (this demo has no voices and no assets to reduce it to 1mb) now and you can switch them by changing this line to push-blocks (old) or to push-blocks2 (new)

Code: Select all

pb = require ('game/logic/push-blocks2')			-- load game logic
By default I left the second one. Most levels work right with this new logic including 10 and 18 (the picnic boat float in the air with the old logic, but it doesn't really affect the puzzle much), 23 and 54 (can not be solved with the old logic). I will probably create a condition to use the second logic on those levels so that the levels can be solved.

The only problematic level I see right now is the 57 which has performance issues and other objects floating in the air.

*update: another problematic level is level 60: it works right only with the old logic, with the new one can not be solved. I attached to gif to ilustrate the problem

Old game logic works as it should:
Old game logic, works as it should
Old game logic, works as it should
shinycave1.gif (146.96 KiB) Viewed 3312 times
New game logic does not work as it should:
new game logic, weird behaviour, objects float in the air
new game logic, weird behaviour, objects float in the air
shinycave2.gif (76.29 KiB) Viewed 3312 times
Attachments
luasokdemo.love
(1 MiB) Downloaded 87 times
Post Reply

Who is online

Users browsing this forum: No registered users and 69 guests