DEV Community

Winston
Winston

Posted on • Updated on

Godot Engine: TSCN

In this series I want to share a few things that I love about the Godot Game Engine. Today I will write about the TSCN file format.

In fact this post is not only about the TSCN format. It is about the fact that most file formats in godot are human readable text formats.

What is TSCN?

TSCN is the file format used by godot to store scene files. The format is explained very well in the official documentation. I will not cover these details here.

It basically is a text file specifying the contents of a scene. It contains the complete node tree of the scene and can also contain subresources.

Other files stored as text format

Most things in godot are stored (or can be stored) in plain text:

  • Resources (.tres files)
  • Project Settings (project.godot file)
  • Import Settings (.import files)
  • Scene files exported by other applications (.escn files)
  • probably some more that I have missed

Performance

The TSCN files are stored as binary .scn files in the internal .import folder. This way they load very fast.

Why I love the text files

I use git for all my projects. The text file format works perfectly with git. Every change I do in my scenes can be tracked by git. While every little change in the scene can be tracked this can also be too much. I like to group logically connected changes together to not clutter my git history too much.

Another point I love is that I can search for things easily. Forgot in which file the enemy named "KlingonShip01" was? Simply search in all files in the project directory! As everything is stored in plain sight it is very easy to find things.

Last but not least I love the simple structure of these files. It is not only easy to read, it is also easy to generate. For my current space game I wrote a small python script that generates scenes. It looks up the positions of planets and stars in an online database. Based on this gathered data it generates godot scene files.

Thank you for reading! ✨

This is the second post in my series "Things I love about Godot". I will probably cover the editor interface and more in the following posts. If you have any questions or suggestions please let me know!

Top comments (3)

Collapse
 
itsoasi profile image
Oasi

I've been using godot for a while now, and have been practicing writing heavily simplified engines based off of it in python and c++ (more or less as a learning experience and to get a better understanding of the languages). However, the readable text scene situation sort of eludes me, lol. How did you go about accomplishing that?

Collapse
 
missamarakay profile image
Amara Graham

Just found your series! Godot has been on my list of things to look at for a bit now. Human readable files are so important.

Collapse
 
winstonyallow profile image
Winston

Thank you so much for your comment! Godot has so many small details which make it wonderful to work with (in my opinion).