A new way to learn how to program

by Ashley | 3rd, May 2012

We've always intended Construct 2, our HTML5 game creator, to be useful for people who don't know how to program. You can be anyone from an artist to a student in high school and still make a game without a single line of traditional programming. However, some people quite rightly point out it is still a sort of programming: you're creating a set of logical rules to define the behavior of something running on a computer. It's just Construct 2's event system is easy enough for complete beginners to work with. There's a little bit more to it than that, though.

One of our secondary goals with Construct 2 is to help people learn to program "for real" (as in traditional, typed languages). We think it is a great stepping stone to get people involved with computers and on a path that leads to deeper involvement in technology. This is why we think Construct 2 is great for schools and universities, and we always love to hear from people using it in education! Projects like MIT's Scratch also aim specifically to teach programming concepts to kids, but our intention is slightly different: to make a 'non-programming' environment that is both easy for young people and also useful for real, productive professional work - a rapid development environment for all.

To help make Construct 2 a valuable educational tool, we've deliberately taken inspiration from traditional programming languages. If you're familiar with Construct 2's event system but have still never written a line of code, you may be surprised to find out you probably know several key programming concepts already! To illustrate the point, I thought I'd point out several places where Construct 2 is analogous to programming, and how this might make your life easier if you try to learn a language like Javascript. I'll be comparing events with analogous psuedo-code (not a real language, just for demonstration) to show the programming concept used. (To programmers: obviously the code snippets aren't going to be real or perfect, they're just there to illustrate the analogy.)

First of all is simply the ability to think logically. Events are designed to be intuitive, but thinking logically always helps you understand how things are working and how to fix problems. This is a very high level aspect, but with practice you get better, and logical thinking is always a benefit when programming. For example, the usual "if condition true then run actions" is a simple logical thought process.

Simple event logic

Recent releases also allow you to use 'Else'.

Simple event logic

...and you can also create 'OR' blocks, simulating the logical 'or' operator.

Simple event logic

There's also the game loop. Games are typically programmed with an infinite loop that keeps running frames. This is implicit in Construct 2, but it's still there in the engine: events are run and then the screen is drawn in a constant infinite loop.

The game loop

Loops are common in programming, and Construct 2 has them too. In fact, the 'For' loop is based on the code equivalent.

Event for loop equivalent

Construct 2 also has a 'For each' loop, but this is in fact implicit to most conditions, so the actual 'For each' loop is only needed occasionally. As described in the How Events Work manual entry, conditions already test each instance individually. There's a lot more to it than that, but the event below could be compared to the code snippet. So even a simple condition involves a loop!

Event for-each loop equivalent

There are other kinds of loop supported too, like the While loop which repeats until its condition is false:

Event While loop equivalent

Let's not forget general maths skills. While Construct 2 tries to take care of most of the complexities for you, if you know math well it can give you an advantage in making advanced games. In other words, if you want to, you can still easily enter advanced formulae in Construct 2 - it doesn't prevent it or make it difficult. It also provides a simple and visual place to experiment with math, and helps introduce you to graphics-based geometry (for example, X increasing to the right and Y increasing downwards).

Event math

Of course, we've already used variables, which can store numbers or text. There are also 'triggers' which fire when something happened - these are also common in programming as callbacks, such as assigning some code to run when a key is pressed.

Event variables

Perhaps the most interesting and advanced programming concept that has made its way in to the event system is the idea of variable scope. That means the places you can use a variable. In Construct 2, creating a variable in a subevent or group will make a 'local' variable which can only be used in its subevent range or inside that particular group. This idea was directly inspired by the same thing in programming languages, where a local variable declared inside a function or loop block can only be used in that block. It cannot be used outside that range, and in fact the same variable name can be used elsewhere in different non-overlapping ranges, giving you more flexibility in variable naming. This is quite an advanced concept, and if you've got your head around Construct 2's local variables, it should help you understand scope in programming too.

Event variable scope

Notice also the comments in both examples - programmers can never get by without some notes to help them remember what's going on. Event groups also further help with organisation, similar to 'regions' in some code editors. Event sheets are also a bit like different source files in a programmed application - separate documents that have a more specific purpose, rather than just one huge document to make everything work. Event sheet includes are a bit like the #include directive from C and C++, although that is generally replaced with some kind of "module" system in newer programming languages.

There are plenty of technologies involved behind the scenes that you can play with if you choose to, ranging from HTML, the Javascript SDK, JSON, XML and XPath, AJAX, the browser, and so on. This could be a good grounding in using real web technologies.

Finally, the Families system introduces a simple model of inheritence. You can define events, instance variables and (in a future release) behaviors which all the objects in the family inherit. Each object in the family can individually add their own separate variables, behaviors and events as well, extending the family with their own customisations. Adding an object to multiple families even mimics multiple inheritence. All of these are concepts used in all modern object-oriented programming languages, and we've snuck them in to Construct 2.

I think it's worth mentioning one more thing - the "cool" factor :) For many young people being able to make your own game is just awesomely cool. You can get a shooter with some simple action, effects and sound going in just a few minutes, so there's not much investment necessary to get something rewarding. It's fast, easy and visual. That might be enough to get you hooked!

We also have more plans to make useful programming-like concepts in a simple way with events. We want to add built-in support for functions, although there's already a third-party Function plugin by rexrainbow. Better modularity is also an idea we've been thinking about, making it easier to share events between projects, or even creating custom objects purely from events. However these will need some more thought and careful implementation, and probably won't turn up for a while.

Comparing events to programming, you might be wondering: "why not make a programming alternative for events?" This is actually quite a common request. Unfortunately it's something we've thought about a lot and we don't think it's practical. The examples shown above are not realistic since they're just fake examples, and when you get down to the technical details of events they're actually quite complicated (take the fact a simple condition is a loop, for instance). This means the corresponding code would be quite complicated too, and possibly too complicated to be useful. We could invent our own language, but this is extremely time consuming, difficult, and unfamiliar (since it won't be a language anybody already knows). On top of that we think as a small company we should keep a strong focus, and our aim is not to get side-tracked in to making a programming editor. Also, we experimentally added Python to Construct Classic. This was potentially very cool, but I'm not satisfied we ever got it working well. It also really confused people. I've lost count of how many people talked about Construct Classic being "a python editor" or "based on python". Neither is accurate! It only used python as script snippets in addition to an event-based system - but newcomers didn't really understand the difference or didn't know which they should start with. There are also a truckload of scripting tools out there which are far more mature and useful for programmers, but very few non-programming game editors. So I think we should stay unique and remain known as a no-programming tool - even if you are inadvertently learning a few things about programming in the process!

We'd love to hear more about Construct 2 in schools or education. Has Construct 2 helped you or anyone you know get involved in computers or programming? How did it go? Do you have any ideas to help make the process better? Let us know your thoughts!

Now follow us and share this

Tags:

Comments

5
fawdda 3,577 rep

Unique!! ;)

Thursday, May 03, 2012 at 3:40:02 PM
12
Cpryd001 4,236 rep

Yes! I taught a middle school art class semester with Construct 2, and I plan to do it again in the summer! The class was so successful that they wanted to create a department just for that kind of game programming!

If anybody wants to wow a middle schooler, simply open up a pre-made game, and have the middle schooler put their own artwork in place of the main character. It triggers this 'Oh my think of the possibilities' switch in their heads!

Thursday, May 03, 2012 at 3:46:47 PM
2
urbano 4,754 rep

LOL ^_^X VERY GOOD

Thursday, May 03, 2012 at 3:49:44 PM
5
Ashley 112.1k rep

@Cpryd001 great to hear! We've seen a lot of funny games with cutouts of people's faces in games, seems like a popular way to get going :)

Thursday, May 03, 2012 at 3:55:42 PM
4
AndyWatson 6,522 rep

Wow, kickass blog entry.

Thursday, May 03, 2012 at 4:04:21 PM
5
rexrainbow 14.0k rep

A complex problem will not become easier in a text editor. The complex might come from algorithm, or software architecture.

I thought a good software architecture is important than a text editor. And the architecture of events plus plugns is beautiful in my point of view -- to keep event sheet short and read-able, and hide algorithm behind plugins.

More over, plugin is not only a functional block. Plugins could be composed to be a framework.

Thursday, May 03, 2012 at 4:18:14 PM
5
Armitage1982 3,194 rep

I learned development from middleware and game making software.

If your game is a little different from the mass (and it's probably the case if you don't have a strong programming background) you will reach limitations very early.

That's probably why I think there is still a strong wave of bad criticisms from experimented developer about game maker software. Which is stupid since both world would benefit from each others like Unity3D for example.

The only think I hope with Construct 2 is that you gonna be able to evolve and break the limitations of the software by having access to a whole range of low level tools. Something well integrated, optimized and easy to use for developer that don't always need to use the WYSIWYG interface (mainly for logic).

I still have a lot of doubts about Javascript and HTML5 performances, but seeing how step the learning curve is when you need to use C libraries to wrap/port/extend tools supposed to be "simple" with Basic Syntax, I sometimes feel it would be better to directly use a native language.

There is a lot of middleware and a lot of programming languages, but only a few complete the bridge between. More important they nearly all stop to evolve one day or give birth to a new *but different* version leaving previous users with bugs or broken features :(

Thursday, May 03, 2012 at 4:31:58 PM
1
VampyricalCurse 8,034 rep

I personally think that traditional programming (coding), should stay for software development. Making a game entirely by coding it's just tedious and requires way too much time, that for an indie game designer it's in most cases an impossible task, not to mention for a hobbyist. I make music, story, most of the graphics, etc., that alone consumes more time than I'd like to admit.
Once I am done with assets, I'd like to go and work on the system and I'd want it to be a more relaxing experience and coding isn't.

I will never go back to coding for game development, I can tell you that much, it's just not practical in my opinion. Learning a programming language takes time, mastering it takes even more and not everybody has the time to learn. I do however wonder, with software like C2 and such, what good will coding be for games in the future?

Thursday, May 03, 2012 at 4:42:17 PM
5
arevirlegna 3,649 rep

I've used MIT's Scratch for teaching with good results and I am considering using Construct2. The problem is when the students transition to a more traditional CS class and get "console shock"! This is actually a serious problem because students feel cheated or lied when they are taught what "real" programming is. Of course, the tool is not to blame but the design of the courses. A "peeling the onion" approach may be the answer: start with a wonderful tool like Construct2 and slowly reveal the complexity using other media-rich environments until students reach the core and learn about recursion, signals, sockets and so on --hopefully without crying all the way in (sorry, could not resist). I think this approach could also help in making kids more interested in STEM education (Science, Technology, Engineering and Math).
Thanks for the great work you guys do and keep it up!

Thursday, May 03, 2012 at 4:45:39 PM
5
DravenX 6,922 rep

Lol i mentioned this a while ago about classic construct but no one would believe me.They would say "no it's an event driven system only" but look closer and you will see that it's just an easier way off programming.

Thursday, May 03, 2012 at 5:13:28 PM
3
TheJanMan 4,120 rep

I have a friend looking for a tool to make a game for their thesis at their university and I mentioned C2. Hopefully I get to hear their reactions on the tool soon! Cheers!

Thursday, May 03, 2012 at 7:41:57 PM
3
balaporte 2,788 rep

I'm learning C now while still using Construct 2, and I agree using Construct will teach some basic concepts of programming. I also strongly agree with your focus on keeping Construct as a "rapid development environment" - I use it because I can make my games NOW without having to spend my time setting everything up first. However, I think Armitage1982 has a good point that if you want to make a game that's unique, you may find yourself wanting to break out of the limitations of the environment. At that point you are probably going to want to actually code. That's why I'm back in school.

In short, I think Construct 2 is excellent for what it is, and it's by far my favorite no-coding environment, but that may limit its scope as an educational tool beyond introducing someone to the "wow" of making your own game.

Thursday, May 03, 2012 at 7:46:02 PM
3
Wastrel 10.9k rep

Excellent post, Ashley. Coming from programming background, I could sense the correlations between C2 and coding, but now I can see you put a lot of thought into making the interface and events.

Thursday, May 03, 2012 at 8:28:41 PM
5
Kyatric 41.3k rep

@balaporte, @arevirlegna: I think that in the course of going from "non-programming" (C2) to "real programming" (any coding language) C2 still offers the bridge of the javascript SDK.
Javascript is a "true language" (despite all the debates that may come around this notion, in opposition to the event-driven programming, it is) and C2 still offers the opportunity of quick reward in that case.
Code a few lines on your plugin, open the IDE, add the custom plugin, use it, preview the project, you have a direct correlation between code you made and the result on screen.
The JS SDK helped me getting into javascript quite quickly and in a fun manner. I had a purpose and I could value the progression in "the blink" of a preview.

Thursday, May 03, 2012 at 9:01:40 PM
6
Kyatric 41.3k rep

Before using Construct I had first been messing with several coding languages over the years. I understood some of the basic concepts of programming, I could initialise a window in C and I could handle some database interactions in PHP/MySQL.
But my first really finished projects came from C2.
At first, I qualified CC as the interface between what I had in mind and a finished product. Everything seemed logic and visualizing the tools helped me anchor the programming concepts in my mind.

I've always considered that knowing what I already knew about programming helped me at first in picking CC/C2 quickly, and then, since I work only on C2, it helped me understanding further complex programming concepts by being able to play with them, or simply being faced with "how do I setup a project and what events do I use to get this specific behavior for my project ?".

What I like most about CC/C2 is the easiness of the experimentation.
Execute the soft, throw a few objects/events, preview. There's no coding language that allow you to do this, this easily, in my knowledge.
And experimentation is not punished, but accompagnied.

Thursday, May 03, 2012 at 9:02:10 PM

Leave a comment

Everyone is welcome to leave their thoughts! Register a new account or login.