Game Development Community

Console and Debug Info issue

by Lou · in Torque 2D Beginner · 08/22/2013 (12:31 am) · 4 replies

Hey everybody !!

I just arrived in you great community :).
I'd like to do some experiment with Torque 2D MIT, but after following the (great !) tutorial, I am stick with two minor things. So I hope you could help me.

The first things is I can't get the FPS showing (neither in the starterProjet, nor in the tutorial projet).
I get the other debug information, such as collision, aabb, etc... but not the fps :'(.

Here is the function coming in the starterProject. I just add the last line.

function BlankGame::create( %this )
{
    new Scene(mainScene);

    new SceneWindow(mainWindow);
    mainWindow.profile = new GuiControlProfile();
    Canvas.setContent(mainWindow);

    mainWindow.setScene(mainScene);
    mainWindow.setCameraPosition( 0, 0 );
    mainWindow.setCameraSize( 100, 75 );

    mainScene.setDebugOn("fps");
}

The second thing is about to shwo the console "in-game". It doesn't work :(.

But, it's work in the sandbox.....(both fps showing and the console).

Am I missing something ?

Thanks in advance for your responses.

Also, if you have any suggestion to how I should organise my projet (according to module and "relationship" between, don't hesitate ;).

PS : Sorry if there is any mistake in my english :/


EDIT : The metrics doesn't show as well :/. I got only the "gray bar", but nothing is written on it.

About the author

Recent Threads


#1
08/22/2013 (1:28 am)
Hey Lou! Welcome to the Community!

I've never seen that problem before, it might be hard to debug.

First off, what branch of the repository are you using?

Also, what modules do you have in your project?

Check to make sure you have the 'AppCore' module loaded, this is the module which initializes the canvas.

Aside from that, look at the console.log file located in the root directory of your project. Does it show anything resembling an error message near the end?

Console
The console is originally defined in Sandbox as well, if you want to use the console in your project, copy the following files into one of your own modules.

- Sandbox/scripts/console.cs
- Sandbox/gui/ConsoleDialog.gui.taml
- Sandbox/gui/guiProfiles.cs
- Sandbox/assets/gui/bluegradient.asset.taml & blueGradient.png

I personally created a module named Utilities for such purposes, so just replace 'Utilities' with whatever you choose to name your module.

In this module's main.cs, don't forget to execute the console.cs and guiProfiles.cs files like so :
exec("./scripts/console.cs");
exec("./gui/guiProfiles");

Lastly, read the gui file which defines the console and assign ctrl+~ to summon the console.
MyModule.add( TamlRead("./gui/ConsoleDialog.gui.taml") );
GlobalActionMap.bind( keyboard, "ctrl tilde", toggleConsole );

Run your project and ta-da! The console should work as it did in the Sandbox.

Module hierarchy

You are free to organize modules however you need.

I use these modules in my projects

- AppCore - contains the basis for the application
- Utilities - contains various helper functions, including console
- ToyAssets - where I keep all Assets
- GameModule - This is the main module for the game.
#2
08/22/2013 (2:29 am)
Hi Simon,
And thanks for your quick reply.

I finally got it :).

For the branch I am using, I downloaded the binary from garage game. I suppose it' the last branch.
I have no special module except the BlankGame from starterProject and the AppCore module. And both of them are loaded according to the console.log file.

For the fps/metrics issues :
- I think it comes from the guiProfile. As soon as I add it, when trying to resolve the console issue, it works :).

For the console, it's OK as well. I figure it out to adapt it to my "blank game" (ie. removing what's uneccesary from guiProfile and so on).
I found that I needed somme more images as well ;).

All seems to work now :)

As for the module hierarchy, many thanks. I will use it.
I thought I had to do a more complexe one, base on game part and logics :/.

Such as :
- AppCore
- Utilities
- Map
- Player
- Enemies
- Menu
- etc...


Many thanks !!
#3
08/22/2013 (2:47 am)
Glad to help!

If it works once you add in the guiprofiles, it means that the text color displaying the fps metrics was probably detailed in the guiprofile.

I suggest creating a template for your BlankGame and saving it somewhere. Next time you start a project, just copy that project to a new directory and you'll save lots of time.

Modules

It's really up to you, you could even stick everything into one giant module or separate every little thing in modules. Your example would also work fine!
#4
08/22/2013 (2:51 am)
Yeah, I just made a copy of my new starterProject :)

For the fps metrics, I hesitate about the guiProfile, but I tought the functionality was "built-in" into the engine, so not related to scripts files :/

Ok, for the module ;).

Have a nice day.