Help implementing game logic from fish fillets

General discussion about LÖVE, Lua, game development, puns, and unicorns.
glitchapp
Party member
Posts: 144
Joined: Tue Oct 05, 2021 10:34 am

Re: Help implementing game logic from fish fillets

Post by glitchapp »

Ok so the reason why it does not work is because the functions expect strings and not booleans and integer I guess? I will try what you said, will see if I manage to get it work.

Regarding your solution to convert the exit areas "on the fly", I tested it and it works partially, yes the fish can then go through the exit cells, but the level completion is not detected, I'm sure I'm missing something here, I think I need further explanation.

Thanks darkfrei, the game is almost completely playable now!
glitchapp
Party member
Posts: 144
Joined: Tue Oct 05, 2021 10:34 am

Re: Help implementing game logic from fish fillets

Post by glitchapp »

darkfrei wrote: Mon Aug 01, 2022 1:55 pm Nice! Do you have some gameplay video?
Here you are: https://ufile.io/gqrf3y8w

This is an amateur work, I'm not really skilled to make video edition so this is not official nor ready to be published anywhere (the mouse pointer is not even hidden) and is mostly aimed at developers and fans interested to see how the game is progressing, therefore I will not share it indifinitely. Hopefully I could get someone with more experience with video edition to get involved in a proper trailer. I still hope you like.

If anyone downloads it I'll be happy to know, feel free to give your feedback here.
glitchapp
Party member
Posts: 144
Joined: Tue Oct 05, 2021 10:34 am

Re: Help implementing game logic from fish fillets

Post by glitchapp »

Hi, this post is to inform of state of development and ask for help with the final missing functions.

The game is fully playable now, the game logic is solved. There are two functions that need to be completed:

The save and load game functions:
https://codeberg.org/glitchapp/fish-fil ... vegame.lua

The touch interface to play on mobiles and tablets is being rewritten as the old interface was a chaos that can not be maintained: https://codeberg.org/glitchapp/fish-fil ... rface1.lua

The assets for the interface are done so I only need to distribute them on the screen, an example of the assets used for it:
netcontrols.png
netcontrols.png (38.02 KiB) Viewed 1711 times
That interface shown above is an attempt at adding social features to the game. It can be found here: https://codeberg.org/glitchapp/fish-fil ... s/main.lua

The initial goal of that interface is to be able to play the game from another instance of the game including a mobile which could be used as a gamepad. If anyone wants to help with that any help is welcome too. The main challenge is to send the button's events through the network.

Thanks!
User avatar
darkfrei
Party member
Posts: 737
Joined: Sat Feb 08, 2020 11:09 pm

Re: Help implementing game logic from fish fillets

Post by darkfrei »

glitchapp wrote: Mon Aug 08, 2022 6:53 am The save and load game functions:
https://codeberg.org/glitchapp/fish-fil ... vegame.lua
Can you attach the actual 1 MB game? I've made the tool viewtopic.php?f=5&t=93639 to load default file, write it to the disc and then the new file will be used by default.
glitchapp
Party member
Posts: 144
Joined: Tue Oct 05, 2021 10:34 am

Re: Help implementing game logic from fish fillets

Post by glitchapp »

darkfrei wrote: Thu Aug 11, 2022 12:19 pm
glitchapp wrote: Mon Aug 08, 2022 6:53 am The save and load game functions:
https://codeberg.org/glitchapp/fish-fil ... vegame.lua
Can you attach the actual 1 MB game? I've made the tool viewtopic.php?f=5&t=93639 to load default file, write it to the disc and then the new file will be used by default.
Oh that sounds fantastic!
I've updated the game yesterday and you can download it from here: https://codeberg.org/glitchapp/fish-fil ... llets-mini

It is the same file I would attach here, I think it is better to keep it all there in one place.
glitchapp
Party member
Posts: 144
Joined: Tue Oct 05, 2021 10:34 am

Re: Help implementing game logic from fish fillets

Post by glitchapp »

This is absolutely not a priority, It won't even be a great deal if I don't manage to get it work, but just in case someone can find the reason:

The 3d engine does not completely work with the game logic of Darkfrei and still uses mine to draw the levels borders of the map in 3d. Strangely it can render the objects with the new game logic, but not the borders.

Code: Select all

function drawbordermap(block,x,y,tileSize)
	dream:draw(cube1, 10 , 10, 10,1,1)	-- not working
	-- map tile
						if palette==1 then love.graphics.setColor(cs1border1)
					elseif palette==2 then love.graphics.setColor(cs2border1)
					elseif palette==3 then love.graphics.setColor(cs3border1)
					elseif palette==4 then love.graphics.setColor(cs4border1)
					elseif palette==5 then love.graphics.setColor(cs5border1)
					elseif palette==6 then love.graphics.setColor(cs6border1)
					end
                if palette==7 then love.graphics.setColor(cs6border1)
					love.graphics.rectangle ('line', (x-1)*tileSize, (y-1)*tileSize, tileSize, tileSize)	
                else
					if not(palette==1) then
						love.graphics.rectangle ('fill', (x-1)*tileSize, (y-1)*tileSize, tileSize, tileSize)
						--love.graphics.rectangle ('line', (x-1)*tileSize, (y-1)*tileSize, tileSize, tileSize)
					end
								--dream:draw(cube1,  (x-1)*tileSize, (y-1)*tileSize, tileSize, tileSize)
              end
              if threeD==true then
                						--dream:draw(cube1,  1, 1,-60, 10,10,10)
              end
				
					if palette==1 then love.graphics.setColor(cs1border2)
                elseif palette==2 then love.graphics.setColor(cs2border2)
                elseif palette==3 then love.graphics.setColor(cs3border2)
                elseif palette==4 then love.graphics.setColor(cs4border2)
                elseif palette==5 then love.graphics.setColor(cs5border2)
                elseif palette==6 then love.graphics.setColor(cs6border2)
                end
                if palette==7 then love.graphics.setColor(cs6border1)
					love.graphics.rectangle ('line', (x-1)*tileSize, (y-1)*tileSize, tileSize, tileSize-15)
				else
					if not(palette==1) then
						love.graphics.rectangle ('fill', (x-1)*tileSize, (y-1)*tileSize, tileSize, tileSize-15)
						--love.graphics.rectangle ('line', (x-1)*tileSize, (y-1)*tileSize, tileSize, tileSize-15)
					--elseif assets==2 and nLevel==1 then
						--love.graphics.draw (level1style1, (x-1)*tileSize, (y-1)*tileSize, tileSize, tileSize-15)
					end
				end
end
That is the problematic function, when I uncomment the call to the 3d engine to draw the borders of the map in 3d, the following message appears:

Code: Select all

Error: 3DreamEngine/classes/scene.lua:48: attempt to perform arithmetic on local 'id' (a nil value)
stack traceback:
	[string "boot.lua"]:777: in function '__add'
	3DreamEngine/classes/scene.lua:48: in function 'add'
	3DreamEngine/init.lua:371: in function 'draw'
	game/logic/drawassets.lua:54: in function 'drawbordermap'
	game/logic/push-blocks.lua:554: in function 'drawMap'
	game/levels/changelevel.lua:1361: in function 'changelevel'
	game/levelmenu.lua:480: in function 'leveldraw'
	main.lua:388: in function 'draw'
	[string "boot.lua"]:618: in function <[string "boot.lua"]:594>
	[C]: in function 'xpcall'
To ilustrate the problem here is a screenshot: Image

What's happening in that screenshot is that the objects in 3d are rendered using the push-block logic of darkfrei, while the borders are rendered by my old and deprecated game logic. I can't make any call to 3dream from the drawborder function but it works perfectly from the function that render the objects, I don't understand why.

Any hint why this happens? The file can be found here: https://codeberg.org/glitchapp/fish-fil ... assets.lua

Thanks
glitchapp
Party member
Posts: 144
Joined: Tue Oct 05, 2021 10:34 am

Re: Help implementing game logic from fish fillets

Post by glitchapp »

Hi, I know there are several libraries to accomplish this and several solutions, but I want to ask first which is the best solution to the resolution problem:

Someone has tried to play the game on a laptop with 1366×768 resolution, I added that resolution to the options and this is the result:
resolution.jpg
resolution.jpg (80.21 KiB) Viewed 1443 times
A complete chaos with everything out of place. What is the best way to resize objects and backgrounds to the resolution?

Thanks
User avatar
darkfrei
Party member
Posts: 737
Joined: Sat Feb 08, 2020 11:09 pm

Re: Help implementing game logic from fish fillets

Post by darkfrei »

Native FullHD and upscaling for 4K or downscaling to laptop 1366x768.
Multiresolution: viewtopic.php?f=3&t=92171
glitchapp
Party member
Posts: 144
Joined: Tue Oct 05, 2021 10:34 am

Re: Help implementing game logic from fish fillets

Post by glitchapp »

Thanks darkfrei! unfortunetaly it does not completely work, the objects do not scale properly do not position properly, I think something else should be added to push-blocks so that the objects set in the right place
resizedark.jpg
resizedark.jpg (117.67 KiB) Viewed 1395 times

Code: Select all

function love.load()
mr = require ('lib/multiresolution/multiresolution')		-- multiresolution library by darkfrei

	local desktopWidth, desktopHeight = love.window.getDesktopDimensions()
--	love.window.setMode (desktopWidth/2, desktopHeight/2, {resizable=true, borderless=false})
	love.window.setMode (3/4*desktopWidth, 3/4*desktopHeight, {resizable=true, borderless=false})
	mr:load ()

Code: Select all

function love.update(dt)
  --rs.update()	--update resolution solution
  mr.update(dt)

Code: Select all

function love.draw(dt)
mr.draw()

Code: Select all

		if res=="1366" then resizeres (1366,768)
	 elseif res=="1080p" then resizeres (1920,1080)
	 elseif res=="4k" then resizeres (3840,2160)
	 elseif res=="8k" then resizeres (7680,4320)
	end
Update: The problem only affects the assets, if you press "G" and disable the assets then everything is in place:
update.jpg
update.jpg (62.42 KiB) Viewed 1383 times
I need to find a solution to the assets

update 3: Sorry for the many updates, I solved the problem, I just needed to resize the backgrounds to the right number to make everything fit like this:

Code: Select all

if res=="1366" then resizeres (1366,768)	expx=expx/2 expy=expy/2
update2.jpg
update2.jpg (340.4 KiB) Viewed 1376 times
Now everything is in place!

If anyone has an old device with lower resolution and want to play with 1366x768, you can now press "R" to switch to that resolution.

Unfortunately if you change level everything is out of place again, I will try to solve it in the future.
Post Reply

Who is online

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