0 Favourites

Subscribe

Get emailed when there are new posts!

Stats

  • 1,579 words
  • ~6-11 mins read time
  • Published
  • 164 visits
  • 0.5 visits per week
  • 222 page views

License

This blog post is licensed Creative Common Attribution Required v4.0.

Share

Enjoy this blog? Share with your contacts!

Share now

Report this blog post

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.

Recent releases also allow you to use 'Else'.

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

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.

Loops are common in programming, and Construct 2 has them too. In fact, the 'For' loop is based on the code 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!

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

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).

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.

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.

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!

Disabled Comments have been disabled for this blog post by the owner.