This means that something is confused. You run a different application than you think from Lazarus The project that CGE creates does not contain any standard Lazarus (LCL)
You most likely have the old project (maybe the default, temporary empty LCL project) open. Unfortunately, double-clicking
gamestatexxx.pas doesn’t change the project in Lazarus, it just cannot, see Trello – we need Lazarus to expose this feature to use it from CGE.
The solution for now is just that you need to switch to the new project explicitly:
from CGE editor choose “Code → Open Project In Code Editor” (and confirm in Lazarus when asked whether to “open as a project”)
or, from Lazarus, use Lazarus “Project → Open Project… (F11)” and navigate to CGE project dir, and choose the
xxx_standalone.lpi project file.
Do this once, keep the Lazarus open. Now the Lazarus will know the correct project, code-completion will work (as Lazarus knows that project depends on
castle_base etc. packages), and running from Lazarus (F9 in Lazarus will work OK (do the same thing as running from CGE editor F9).