nav2

Wednesday, March 16, 2016

Construct2 and Fusion 2.5 review, Learning Python and applying it to Gdscript (Godot)

I recently started learning Python. A lot of people say that it is a good first language to learn. The truth is that in the past I have used visual programming tools such as Clickteam Fusion and Construct 2. You still do programming in them - you execute functions, deal with gotchas that come from programming, write expressions and learn some syntax. But they aid you along the way - offering an easily accessible list of conditions and actions you can use. Behaviours and types of objects you can attach - each brining ready functions to use in your game. All paired with a nice level editor.

But having used them for a while, I quickly found out the disadvantages:

Fusion - It's a really nice application. Having used it for years now and even halfway created a stealth game in it - I like their engine. I am even selling some stuff at their store.The biggest disadvantage of using it is truly how bad it is at code reusal and instancing. It is so bad that people serious about making a game in it write their own level editor for the thing.
Functions in it are called 'fastloops' and you can not pass any arguments or return a value. You can not nest conditions in any way. You do a lot of copy and paste of conditions and actions. It is designed from the ground up to be good at copy and pasting, but not good at any instancing.
The level editor can not give unique values to different instances of an active object. You can do it via code during runtime, but not in the level editor. As a result you do a lot of copy and paste of an object in order to create variations of it. when you change the logic of one copy, it only changes in that one copy. This gets even worse when you consider using it on different levels - called 'frames' in fusion. All of your logic is attached to rooms. If you change a piece of logic in one room, the same piece will not change in all the other rooms. So imagine coding your game's inventory and hud. Later on you find a bug, and you fix it in one frame, then manually copy and pasting the logic too all the 150 other frames.
Fusion has a global event sheet , but the issue with it is that it can not use any 'qualifiers' (the way they call tags). This as a result locks you out of the opportunity to use a piece of logic globally on objects with the same tag. So it doesnt solve the problem with instances of an enemy not having the ability to vary in variables.
Fusion's editor has some bizarre hardcoded logic into it. You can not create your own qualifiers, just use the ones that come with the engine. The animation editor does not let you erase,reorder or rename the first 5-6 animation clips. Some clips are hardcodedly marked to have one properties, others have a different set of properties.
Exporters are fusion's biggest weakness at the moment - this is where people who write plugins for the engine must rewrite their plugin for each exporter. As a result a lot of features are supported under one platform and not available on the other platforms. A thing as simple as loading a json file and parsing it is not available as a built in feature.

To give them some credit - at least you can compile native code to different platforms - if you have bought the (expensive - hidden cost) exporters.

Construct2 - Scirra's tool is like a successor of fusion in terms of vis programming and it solves all the problems of code reusal. All of them. As a result it's community is much bigger and there are a lot more addons and features created by the community. The one big advantage of C2 is really also it's strength focused development. It compiles only to html5. That lets you port your game to all mobile and desktop platforms for free - you don't have to buy any expensive exporters. However that comes at a development cost - your game is basically loaded in a stripped down web browser - that adds about 100mb to it's download size and also there is some noticeable performance cost - especially on older mobile devices.

Then Godot caught my eye and I immediately fell in love with it.It excels at code reusal, comes with a huge amount of very useful functions. It compiles native code to all mobile and desktop platforms. Unlike the above two - it is both free and can be used to also create 3D games! The biggest advantage however I found out to be the open source nature and the community that has formed around it. Godot's community is wonderful, vibrant and very responsive. You have an issue? Post it on their fb group and in 5 minutes someone helps you out. If it's missing and it makes sense to have it - someone implements it the next day or puts it on the roadmap.

The engine has wonderful design, but it comes at some cost. You have to actually sit down and this time learn programming for real! No clicky visual stuff.
So I did and found out that gdscript is very similar to python. it can't have two iterators in FOR loops among other things, and some of the syntax and method names are different, but otherwise it's almost python.
Added that Blender, Inkscape and some of the other tools (Maya) that I love are written or use python for custom addons - it was an obvious choice for me to learn it. And someone from the Godot community had the perfect timing to point me to the Coursera courses!

so far I completed 2 of the 4 courses. I found them to be very good and they did enable me to do much more advance stuff with Godot and not have to ask stupid questions. The first course teaches about programming flow. The different types of loops, variable scopes, order of command execution, functions for code reusal and so on.

 The second course teaches about data structures in Python. How to load data from a text file and scan through it. Cut it, change it, load it into different structures (dictionary,lists,tuples) and use it to classify it's contents. This course is very key if you need to write an application (and most do) that saves data to the user's hard disk. When they save their game for example. This is where flow becomes a key to processing that information. 

No comments:

Post a Comment