0 votes

Hi there,

I'm working on a game where you are a piece of light roaming around space, absorbing other light and talking to other entities.

Currently, the "sky" is composed of a 3x3 matrix of "starfields" - which are area2D's the size of the screen. Each "starfield" randomly has stars added to it when it is instanced. To make things are bit more complicated, the starfields are regenerated with a treadmill mechanism, meaning that when the player enters a new starfield, I rejig the "sky" to be a new site of 3x3 starfields. I mention it because it might have something to do with the problem.

The problem?

Sometimes when I launch the game everything works - the sky renders 9 starfields, and each starfield renders some 1-50 stars. Sometimes it doesn't. In the latter case, all the nodes are added to the tree (they are present when I check in a remote view when the game is running). I'm probably missing some easy way to debug this, but I'm not sure what I could be missing. Could I be using add_child incorrectly?). Here's a bit of code if it helps (I can add more details or link to some devlogs if additional context is useful):

Sky.gd: https://pastebin.com/f2S2BLWw
Starfield.gd: https://pastebin.com/XQhdSzrZ

Thanks for any input!

Godot version 3.4.2
in Engine by (12 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.