PLEX Source Code Version 0.06

Comments 3 Standard

Total Time – 8 hours

I’ve fixed scrolling. The board now scrolls without a problem. To simplify things I’m currently working on selecting and moving blocks from only the top two levels. Another thing I fixed was making it so that when the character moved behind a tall block the lower half of their body is covered up by that block.

Right now I have it so you can select a block and then select the space you want to move the block to. I’m still working on updating both arrays so the block moves from one position to another. I have to do some blitting to remove the block from the screen and then to put it in its new position and add in some more calculations in my validMove function to make sure the character can’t move over water blocks or over spaces that don’t have blocks on them.

I’ve started downloading and incorporating sounds into the game as well. I now have a sound for moving a block, an error sound you’ll hear if the block can’t move to that position, and background music for the setup screens and different map screens. I tried to look for music that was upbeat and happy sounding. I ended up with mainly classical music although one or two of them sound kind of techno.

Here’s the source code with the sounds unimplemented (but some of the sound files in it). From here on out, since the sound files are so large, I’ll add them as a separate zip download and you’ll have to unzip them and add them in a folder called sounds before you run the game. That way I don’t have to upload the whole huge file with all the sounds each time.

Source Code Version 0.05

Leave a comment Standard

Okay, I spent another two hours working on the movement problems I was having in Plex. After printing the moves out in my debugger I figured out the reason why movement wasn’t working was because I had it always returning false at the particular depth I was using at the time (depth 0). After fixing that the character now cannot move past blocks that are tall.

The next thing I worked on was getting the board to stop scrolling unless the character’s position can be mod by 5. I did this by setting up a local x and y value that determine where the character is on the SCREEN. This is not the same relationship as where the character is on the entire board because the entire board won’t fit on the window.

After I got that working I had to mod the character’s local x and y values by 5 to reset it back to the beginning position on the screen. This makes it look like the character has scrolled along with the screen.

Now the problem I’m having is that when the character tries to move any further right on the board, the blocks from his right are coming back into view and the character is moving off the screen. My guess is that I’m doing something wrong with my local x and y values, like subtracting from them when I shouldn’t be which results in this error.

The new code is here. Available under the GNU public license.

Source Code Version 0.04

Comment 1 Standard

Total Time – 4 hours

So I have the board scrolling now without a problem. However when I check character movement to see if the character is moving to a valid block it doesn’t seem to be checking the coordinates. I can move the character around the screen unhindered by the taller blocks like it should be. I’ll have to figure out what’s going on there which I’m planning to do tomorrow morning. I’ll keep you updated.

Here’s my code so far. It’s available under the GNU public license.

PLEX Character Puzzles

Comments 3 Standard

Total Time – 2 hours. I would have spent more time working on my code but it seems that my laptop has died and I have to go get it fixed. Joy…

For each of the characters the puzzles will be different. However, you can see the initial starting position of each character in the game by looking at the game map above. When a new game is started the selected character will start at that position. They can interact with the other characters as NPC characters if they go to their location on the map. Each character has an ultimate goal they are working towards (a way to win the game) but they will have to complete smaller puzzles in order to finish their ultimate goal. I’m going to focus on Alex as the first set of puzzles and maps I complete before I move on to the next character.

Alex – He starts off in the builders guild part of the map. His ultimate goal is to figure out where the supplies went that were supposed to be delivered so he could build a house.

Builders Guild – on this section of the map Alex can buy some hard to find blocks from his parents store. Otherwise there is no actual puzzle for him to complete here. Once he returns to this part of the map and has figured out where all his supplies went the game is over.

Ash Canyon – Here Alex will have to move a few blocks out of his way before he can continue on to Fuzzyland. The blocks will have a certain pattern to them so they have to be arranged in a particular way before he can get through. A rock will block the broken bridge that leads to Merryfield so he can only continue on through Fuzzyland.

Fuzzyland – Here Alex meets Bella. She’s the daughter of the best item maker in Plex. She tells him that she can give him some bombs if he’ll help her get X amount of gems so she can run way from home. When he brings her that amount of gems then he’ll be able to buy bombs from the store. He won’t have enough gems to give her what she wants so he’ll have to continue on to Haymarket.

Haymarket – In haymarket Alex has a bunch of choices on where he’d like to go after he unscrambles the broken road so he can pass. Here he’ll find a few gems if he completes the road and he’ll see a key that’s surrounded by boulders and trees (that he can’t reach at this point).

Stone Castle – here he can help complete a tower on a section of the castle to receive a shovel courtesy of the king if he does. Now he can buy shovels from the store which will help him dig up blocks as his journey continues.

Waterville – Alex can go here from haymarket. He’ll come to a shore with a ton of water blocks between his way and the path to landslide. Here he’ll need a ramp to make his way across the water. Once he gets across Tanya will warn him of the boulders and rocks in landslide and tells him about how the water level is dropping and how worried she is about it. Tells him about the rumor that landslide is a goldmine if you start digging and moving things around.

Mercy Valley – Alex can go here from haymarket. If gives Kitty a shovel (because they’re out of shovels here) then she’ll give him a ramp. She tells him that they’ve been really short of shovels in the valley lately and she’s not sure why. If Alex can fix the slope on one side of the valley then he can pass across to boulder canyon but Kitty warns that there’s a monster through the pass and he probably shouldn’t go through until he knows how to defeat it.

Landslide – this part of the map is packed with blocks. In order for Alex to get through he’ll have dig his way through blocks, and then move a path out of the way. For every block he digs up he’ll be rewarded with gems. (he should have enough after this to bring gems back to Bella.

Wishingwell Falls – in this part of the map Alex meets Raven, the princess of Plex. Raven is off on a big adventure but she won’t let Alex pass through into boulder canyon until she can bring him a key she needs to open a treasure chest (the key is in haymarket). Once Alex brings her the key back she’ll tell him how to beat the monster in boulder canyon.

Boulder Canyon – Alex defeats the monster. He can’t face the monster until he’s helped Raven.

Merryfield – The last stop before Alex can finish the game. He finds Lisa whose missing her sheep. She says knows whats happened to his supplies but in return for telling him he has to rebuild the bridge between Merryfield and Ash canyon. Once Alex does that Lisa gives him all his supplies saying that the people who were going to deliver it got attacked by the monster and then were too scared to continue on their journey to his place. She gives him a ton of blocks and Alex can return home.

Builder Guild – once he’s back in the builders guild Alex can use the blocks he received to build a house. Once his house is complete the game is over and the person playing Plex can try playing the game as one of the other 5 characters where the storyline and puzzles will be different.

PLEX Loading Maps From A File

Leave a comment Standard

loadmapfromfile_screenshot.jpgTotal Time – 6 hours.

Okay, so I finally got a map to load from a file. I had a few problems I had to deal with. Reading the file in I had issues with the formatting so I did have to change it a little from what I previously described in the last post. Instead of having all of the maps in one map file, I’ve decided to break them up into multiple files

My reasoning was: A character can only be on one map at a time. If I kept all of the maps in a single map file then I would have to parse all the way through the map file to find where the map data started. When I started thinking about this I realized this may end up being a problem. Maps can have a huge amount of data in them, after all they are at least 15 wide x 15 tall x 4 deep. So, the easier solution would be to keep each map in its own separate file. Therefore I added on a map class that will keep track of which map file data is to be loaded for the different maps in the game.

Because each game someone plays the character will now have multiple maps as well as a player file and npc file, I decided to make a single file for the saved game which outlines all the different file a single game uses. For instance, when you save your game it will create unique files for the state of every map in the game, as well as a player file and npc file. It saves the names of these files in a saved game file.

So, when a saved game is loaded, it opens the saved game file, reads in the files for the player data, npc data, and then all the files for the maps. These filenames are stored in the map class and the game class. From there, the game can load the player and npc data to setup the game state back to where it originally stopped, as well as read in the data for whichever map the character is currently on.

The only problem I’m running into right now has to do with drawing the blocks on the game screen. Using the function I wrote before for the online version of the game, I was expecting it to draw blocks the same way it was before. Instead the blocks seem to be covering the screen completely and I’ll need to go in and figure out why. I believe it has something to do with the format I’m using to draw the blocks to the screen but I’m not 100% on that.

One decision I decided to make was to have every plex file have a .plex extension, no matter which type of file it was (map, player, npc). My thought process here was if I use a saved game file then I already know which format each file is in and I can parse them accordingly.

Map Parser


* Purpose: parse a story map file

* Precondition: file is valid and decrypted

* Postcondition: map has been loaded into the story map array


bool game::parseMapFile(char *filename)


ifstream file;

char name[255], peek, block[2], x[3], y[3], z[3];;

if (!file) //could not open the file

return false;

while (!file.eof())


file.get(x, 3, ','); //get first coordinate


file.get(y, 3, ','); //get second coordinate


file.get(z, 3, '\t'); //get third coordinate


file.get(block, 2, '\n'); //get the block


int newz = atoi(z);

int newx = atoi(x);

int newy = atoi(y);

int newblock;

if (block[0] == '-') //no block in that spot

newblock = -1;


newblock = atoi(block);

//covert coordinates to integers

//fill the map array

switch (newz)


case 0: storymap0[newx][newy] = newblock;


case 1: storymap1[newx][newy] = newblock;


case 2: storymap2[newx][newy] = newblock;


case 3: storymap3[newx][newy] = newblock;


case 4: storymap4[newx][newy] = newblock;






return true;