GUI completely unresponsive + rendercam no active camera

Hi there,

This is my first time using Defold outside of the tutorials, and I am creating a 3D first person shooter, set in WW2. As I understand it, Defold is more suited to being a 2D engine, however this project is for my coursework, and the exam board penalises for using Unity because there are too many wizards. Not sure about Unreal engine, however it is now too late to change it.

Q1: I have created a main menu gui, to allow the player to view controls and start and exit the game, and a corresponding collection, along with a main gui in main.collection. In the main menu, there are box nodes, with text nodes as childs. I have the background as black, and the boxes at white. When I build the game, and click on the white boxes nothing happens. Any suggestions here? I am using collection proxies to switch between the gui menus.

Q2: After I have built the game, and unsuccessfully tested it, when i reopen the console i get a rendercam error “DEBUG:SCRIPT: NOTE: rendercam - No active camera found this frame…using fallback camera. There will be no more warnings about this.”
I’ve added it as a dependency, fetched libraries, then I have made rendercam/rendercam.render as my bootstrap render script. I have also added the camera.go from rendercam to main.collection, positioned it. I am aiming for a perspective camera, and the camera is central. My settings are
Active
Near Z = 0.1
Far Z = 1000
View Distance = 0
FOV = 0.784
Use View Area
View Area = 1920x1080.
Fixed Area

I am using rendercam to use rendercam.recoil(), and rendercam.shake(). I have local rendercam = require “rendercam.rendercam” in my function init() for the script for the player. Do i also need this in main.script?

Q3: How do i create a flat map, combined with walls as obstacles? I used Tiled, and exported the tilemap, to Defold. I am planning on using a Box as a wall, and adding concrete colour on top of it. How do I go about doing this?

Thanks In Advance

1 Like

What is supposed to happen? What does your GUI code do?

Is the camera working after this?
This may not be a error, depending on how your project is set up. If you’re loading things with collection proxies then there can be a few frames without a camera and it’s not a problem (if you’re just showing a black screen or only GUI anyway).

So it sounds like you want to use a tilemap for the floor, and then make 3D wall blocks on top of it?
Make a 3D box mesh, and a game object with it for your wall block. When you initialize the level, have a script that iterates over each tile in the floor tilemap and spawns a wall block in the appropriate position if the tile is a wall tile.

So I have 1 box for entering the game, 1 box for viewing a texture (i.e. a picture of a table showing controls and what they do) and 1 box for exiting the game using the @system command. None of them respond to the click. In game.input_binding i have Left Click bound to the command “touch”. I then do local start = gui.get_node(“start”), and likewise for the other box nodes.

I have a loader.script file which is used to swap between collections, with local functions unloading the guis, with msg.post(), and then i resolve it in the individual gui_script

I changed the bootstrap collection to main.collection to get past the main menu gui not working, and it stays on a black screen, but the error message is no longer present. It stays for a minute (max I’ve waited)

Yes exactly. That makes it clear and easy to understand. Thank you

Hmm. Well without more info I’m just guessing, but it sounds like you don’t have code to make your interface interactive? GUI nodes don’t “respond” to anything by themselves. There’s a simple Button example here:

There’s also a couple GUI libraries on the asset portal if you don’t want to do everything yourself.

If your camera is working the way you want, then you can ignore that warning from Rendercam.

2 Likes
function init(self)
msg.post(".", "acquire_input_focus")

end

function on_message(self,message_id,message,sender)
if message_id == hash(“enable”) then
msg.post(".", “acquire_input_focus”)
end
if (message_id == hash(“disable”)) then
msg.post(".", “release_input_focus”)
end

end

function on_input(self,action_id,action)
if (action_id == hash(“touch”) and action.pressed) then
local start = gui.get_node(start)
local exit = gui.get_node(exit)
local options = gui.get_node(options)

	if (gui.pick_node(start, action.x, action.y)) then --coordinates of the box, and the position of the mouse click
		msg.post("loader:/go#loader", "start_game") --if the coords of mouse and box match up, then the message "start" is sent to loader.script
	end
	
	if (gui.pick_node(exit, action.x, action.y)) then
		msg.post("loader:/go#loader", "quit_desktop")
	end
	
	if (gui.pick_node(options, action.x, action.y)) then
		msg.post("loader:/go#loader", "main_opt")
	end

	if (action_id == hash("touch") and action.released == true) then
		local textExit = gui.get_node("exit")
		if(gui.pick_node(textExit, action.x, action.y)) then
			msg.post("@system:", "exit") {code = 0}) --tells the system to close the game, once the quit button has been clicked on
		end
	end
end

end

This is the script I have for the main menu gui. I had a look at the example, and couldn’t see any differences between them.

I might just use a library.

Thanks for all of your help

1 Like

Hello again

I have been using gooey to handle the input from the user, and this tutorial to switch between the different collection proxies. As far as i can tell, i have done everything as stated, including changing the game.input_binding file as stated.
Do you have any suggestions to look for?

Thanks

Zip the project (exclude build, .git and .internal folders) and share it here so that we can take a look!

Archive.zip (1.0 MB)

Thank you

1 Like

You need to assign mainmenu.gui_script to mainmenu.gui, or else your code won’t run:

3 Likes

I’ve now assigned mainmenu.gui_script to mainmenu.gui, however it still doesn’t work. Do you have any other suggestions? Thanks

Edit: When ive put main.collection as the bootstrap, I get the Error

ERROR:GAMESYS: Failed to create Model component. Material vertex space option VERTEX_SPACE_LOCAL does not support skinning.

Any suggestions?