Word Game Engine Example

Word Game Engine ala PopCap’s Bookworm Adventures

This is the tutorial part of the Word Game Engine I posted more than year and a half ago (see it here), so view the page to see the actual demo of this.

Warning, this will not be a full pledged tutorial, however I tried with all my might to do good commentary on the scripts in this project source, so it will help you a bit on understanding what’s going on every blocks of GML code in there so you better download it and try it on your Game Maker Studio Standard or Pro to see for yourself.

Note that there are lots of ways to program a similar engine like this, but this one is geared towards Windows based builds, as it accesses regular text files on working directory, you can still use the source and convert it for other platforms (html, android, ios) if you like, I think the same engine will still work anywhere except maybe the way you load the lexicon library or database.

Speaking of lexicon library, I chose to use this english language words list from this site www-01.sil.org, it has 109582 words, it may not have every word in existence but I think it is good enough. The wordsEn.txt from the site has each words on every lines, that means one word per line, this is easy to access in Game Maker’s file string handling functions. However, I needed to group the words that belongs to a number of characters and put them all into their corresponding data list (store them in game maker’s data structure list or ds_list) which will be kept in memory while the game is on

What you will learn on this project source?

From beginner to intermediate GML skill

You will be introduced to lots of Game Maker Language programming here. For loops, if statements, switch case statements, global and local variable scope concepts.

Minimal use of GameMaker’s drag and drops, more usage of GML scripting

It is hard to achieve a functional game like this using only GM’s drag and drop approach, so we are going to do more Game Maker Language scripting as it is really the next step to being a good GameMaker developer. I actually don’t use any DnD’s.

Extensive usage of GameMaker’s data structures namely, ds_list and ds_grid

Do not underestimate the power of data structures, this can become your ally in handling data in your games. You can model them to how you want your data to be displayed on screen, you can pass data from one structure to another, create temporary storage data structures, but be aware that they are stored on your system’s memory so you better clear them off when they’re purpose has been served.

Learn basic handling of string from text files

In the olden days, text files are used as basic database storage, and in this game we are using a text file will serve as our lexicon library.

Learn how to traverse a grid structure using nested for loops

There is a great usage of for loops in this source. We use nested for loops to either access data, modify data or display data in draw events. Loops are such a work horse in this example, so you better need to master them otherwise you may cause infinity loops errors easily

Download Source
Demo Page Link

If you are having trouble understanding on some parts please don’t hesitate to post your questions on the comments section. Have Fun!

You may also like...

1 Response

  1. Je Poy says:

    Thank You Very Much for this Sir 😀

Leave a Reply

Your email address will not be published. Required fields are marked *