Introduction - Getting started - First steps - Learn to code by making games in Tcl/Tk

These guides and tutorials will be written in Tcl/Tk. There are multiple reasons for this.

NOTE: This guide is a little bit "outdated" (it's from 2016) since then I have long been working on Phaser games in HTML5, CSS3 and JavaScript in 2017. Maybe I will also post the Phaser games someday too. For now follow along with the Tcl/Tk ones.

But learning to make games in Phaser is more difficult than doing them in Tcl/Tk because you need to understand HTML/CSS javascript and phaser, Whilst with Tcl/Tk you just need to know the basis of Tcl and Tk which are pretty easy. I recommend after you have a basic of programming knowledge to go after C/C++ based games and/or JavaScript games.

Tcl  goes perfectly together with Tk, a toolkit for drawing User Interfaces.
Tk by itself may seem a little outdated compared to modern alternatives but it's the perfect choice for beginners who have no previous knowledge of programming.

It has an very easy syntax and you can easily code very fast
by requiring nothing than a text editor and a Starkit, Cookit or a simple installation.

We'll be able to package our games/apps very fast and with extreme ease to distribute them to other platforms.
This means that the people "using" these apps will not even need to download and install anyother dependency.

You'll be able to run your Games  and apps on Andorid devices later with minimal changes.
Things that are very hard by using anyother platform/language since you'd have to almost rewrite everything.

The reason we use Tcl/Tk combination is so that you're introduced to programming concepts. Once you understand the thinking you can switch to anyother programming language you want.

Imagine having to develop a game purely in CSS/HTML BOOTSTRAP and combine it with javascript, jquery and with a server side language be it Perl, python, php, ruby..
For a complete beginner, well that person will spend a very long time learning the basics before he could do anything.
He would also be fixed to a specific toolset/ide.

You can create wonderful apps.

It's by no means a silver bullet language. It has certain limitations, but it gets the job done for what we want it to do

Download and install

Where to download and install Tcl from? You can get the Windows, Linux and Mac  32/b4 bit variants
http://www.activestate.com/activetcl/downloads

Direct links

Windows

http://downloads.activestate.com/ActiveTcl/releases/8.6.4.1/ActiveTcl8.6.4.1.299124-win32-ix86-threaded.exe

Linux

http://downloads.activestate.com/ActiveTcl/releases/8.6.4.1/ActiveTcl8.6.4.1.299124-linux-ix86-threaded.tar.gz

Now after installing Tcl you need a good all around editor.
You can either use Geany, Notepad++ or anyother one you enjoy.
I'd recommend Geany since it runs on both Linux/Windows.

https://www.geany.org/

From this step on there is basic programming knowledge required in Tcl, you can follow the tutorials knowing nothing and picking up things along the way.
Previous programming knowledge is great but not required.

For the moment I will refer you to other introduction tutorials and howto's in Tcl since there are so many existent.
This lets us focus on the task at hand.
You can review a list on http://wiki.tcl.tk/1304

Great introduction tutorials from
https://learnxinyminutes.com/docs/tcl/
http://zetcode.com/lang/tcl/
https://www.tutorialspoint.com/tcl-tk/tcl_overview.htm
https://en.wikibooks.org/wiki/Tcl_Programming

Some links to always keep in reach are the ones for the Tcl and Tk manuals where you can review how a command works and examples.
Finding examples is always easy on http://wiki.tcl.tk

https://www.tcl.tk/man/tcl8.6/TclCmd/contents.htm
https://www.tcl.tk/man/tcl8.6/TkCmd/contents.htm

Now let the fun begin!

If you're on windows you can open Wish or Tkcon.
You can copy/paste the following  code:

package require Tk
tk_messageBox -message "HELLO THERE!"

You should see the following:

TODO more links:

GAME ART FOR YOUR GAMES IF YOU DON'T WANT TO DRAW
http://opengameart.org

Game tutorials:

You can always review the sourcecode of other existing games made in Tcl/Tk by going on this link: http://wiki.tcl.tk/898

Up until mid 2017 i used Tcl for 10 years as my primary software development language for most of my projects as well as for client projects. Beginning 2018 I switched to Elixir for the development of most new projects. Tcl still remains a fond memory and will remain a cool language.

Found these interesting? Did you learn something? Leave a comment or contact me.

I recommend you learn HTML/JavaScript to learn making games. Switch to Phaser when you know enough HTML/CSS/JavaScript and start creating cool games!

 

 

You might enjoy these similar articles:

Be the first to comment!

The comments section is closed.

Subscribe to my awesome newsletter!








What to expect: Ultimate Knowledge regarding Business Efficiency, Personalized Marketing Experience, Software Development and Cyber Security tips and tricks. 1-3 mails per month. Unsubscribe any time. See the privacy policy to learn how we take care of your information.