You are on page 1of 17

EYE OF THE BEHOLDER ENGINE MECHANIC EXPLANATION

THE DUNGEON CRAWLER ENGINE.

PART 01
GOOD GAME PLAY FUNDAMENTALS.

Lets say, this is the original interface of the game with players and the dungeon window.

But you dont like this one and change it with this one, to make a different game.

Or you are a totally Eye of the Beholder Freak like me, and have a lot of fantasy and
create this one.

You can also change and interface and the players faces, you will find a lots of faces in
the internet. Generally , make a lots of changes create another game , a completely new.
You can put some compass with real motion, remember Lands of Lore. I dont like the
compass from Eye of the Beholder, create or find other compass from internet.
You are in the Dungeons and dragons Game RPG. Put some money system in your
game. Gold coins, Silver coins and Copper coins. Make changes more than Lands of Lore. Put
some markets in the game. Some Merchant in the woods.
In my lesson I will use this interface in the examples.

Put some spell system. Make your game intelligent for players. Make players find rune
stones and compel the players to remember the rune sequence to cast the spells. Put some
overland map in your game and some Automap.

In your dungeons create a lots of portals, more than Eye of the Beholder I, II, III, Lands
of lore does not have wall portals.

Make your portals, activated with rune pressing sequence. If you make a wrong sequence
summon some evil monster , or transfer your party in other place in the map. Put some vortex
in the portal. REMEMBER STARGATE.
And your deep levels of your dungeons , make then dark and Use torch to see inside
them.
Now all of them does not explain the Dungeon Crawler engine, gives an Idea how to
create another Eye of the Beholder game. Graphics, sounds, music, spells, intro, cinematics,
finale and game play will attract many players. Make your game Masterpiece, make the
EYE OF THE BEHOLDER IV
I am creating the EYE OF THE BEHOLDER IV make the EYE OF THE BEHOLDER V
hehe :o)
PART 02
EXPLANATION OF THE GAME ENGINE WALL SIDES

The party is moving in a map, a map with squares like chess. In to the original Eye of the
Beholder(EOB) you are traveling through a grid of 30x30 squares. In your own game you can
change the dimensions of your map, you can make 30x50 100x100 etc. I recommend to live the
dimension equal 30x30 or 40x40 or 200x200.
In this article, there will b some technical language for programmers, like pseudo C++
code. I will explain how to make it a playable game.
When the game starts, computer makes some initializations in memory and prepares the
position of players, (Position in the map in X,Y), status of the player (Health , experience,
weapons etc) , put the party somewhere in the game in one floor (The level), initializes the
direction, (North, south, east, west), put the monsters, prepares the graphics and begin the
game.
All of these things are familiar to programmers as variables and groups of variables
(Structs).
With this information you will receive, you will learn with approach, how to understand
the engine core.
But you need some other libraries to make sounds, music, graphics and cinematics.
If you have choose your language , I recommend c++ or c. And you choose your
graphics engine then start your core.
Programming libraries are stucks of ready programmed functions, which help you to
make the boring parts of the game , like , draw the sprites, play the music, manage your
keyboard and mouse events.
If you are programming with c++ , I recommend DEV C++ or Visual C++ 6.
I recommend Allegro library for your , Sprite Drawing functions ,your music and
keyboard and mouse events. This library does almost everything you want to create very easy
your desirable Eye of the Beholder, it has a lots of 2D function for your graphics.
The Eye of the Beholder engine is not 3D , is 2D only and is easy to create this kind of
game.
Lets start explain thing and what happened, behind the scene.
The space of the (Eob) are the levels , as a programmer I will say , I am in the big
skyscraper with a lots of floors Levels. If I want to say to the computer with c++ , create for me
one big skyscraper with 100 floors I will say.
Int Levels[100][30][30][4];
This means I said to my computer to create an array, a fourth dimensional table, but the
game is neither 3D nor 4D why I am creating the fourth dimensional array?
Is my skyscraper 4D , like time traveling? No.
No I will not create a sci-fi space game, but I need to explain to my computer that.
I want every floor of my game
Int Level[Number_of_Levels][x_size_in_squares][y_size_in_squares][four_sides];
This means, my capacity of my game is a big adventure with 100 levels , each level has
900 squares 30x30=900 , equal in size 30 horizontal , 30 vertical and four sides.
The fourth dimension is the direction of the wall, (North, South, East, West).
Each square is a cube, a hollow cube, with four sides, each side has one wall.
I render the walls in 3D to understand how the engine works.

Each square is hollow, has 4 sides with walls. Each wall is a distinct element.
In each side you can put different graphic. The render bellow figures in 3D how wall will
appear if you put other graphics in each side.

Here you see, one the left texture with Curtain and on the right neat wall.
If you see the colors between the wall up and the wall down are different.
With one word, you dont need to play with color palette, to change dungeon. In the
original (EOB) engine, program plays with color palettes, when you are changing dungeon
layout. In my engine all are in 16 bit colors so you dont have to play with palettes when you
change a dungeon. Look the example bellow. Mix of Dungeons with Azure Darkmoon walls.
Remember the Dungeon with some turtles and a labyrinth with some medusas. I hate this
level.
In the figure you see azure level graphic wall, with deep dungeons together in one wall.

So now you can recognize this, there is no limit how many graphics you can put in only
one level. You can make a grand mix of graphics from all (Eobs) and create a totally strange
new level without need to play with palettes, because we dont have 256 colors , we have 16 bit
colors.
All of these squares if we put them in our floor side by side we will create this 3D figure.
This is our map and this is the way that the Eye of the beholder engine makes corridors and
dungeons. Look the figure and I will explain how the graphics appeared in the (EOB) engine.
If I cover then on the top, you will see a beautiful labyrinth with corridors.

Imagine my skyscraper, has 100 floors like this one, is a big chaos

All of them that I explained are in the way to understand how the wall appears with four
sides, but when you play the game you are looking the graphics in front of your eye, like first
person RPG. Lets Change Perspective view and now we will see the Dungeons, as we usually
see them in the game play.

PART 03 THE GAME ENGINE ON THE SCREEN OF THE PLAYER.

This is the interface of (EOB) This is my example in my engine.

The game action take place in a smaller window in the upper left corner on your screen.
In (EOB) and on the upper right corner in Lands of Lore and in my example.
In this screen this Smaller window, are the eyes of the players. The first person.
You are see the floor with marble tiles and the ceiling. This is your Back Drop.
With this backdrop understand where are you, in the game, if you see marbles you
understand, you are in a temple, if you see old dark stones or rocks, you are in the caver or
dungeon, if you are seeing other kind of backdrop for example if you are seeing flowers and
trees, you understand you are in the woods. (Forest).
Here in the figure there are some kinds of backdrops.

But you can make some mix of them and create other ones.

When you play you see the backdrop of the dungeon you are.
Now computer calculates the walls in front of you, when you are in the dungeon. There
are some images that put in front of backdrop, in special positions like a puzzle and creates the
illusion of 3D perspective of dungeon crawler view. Every wall has a small sprite of its position
if the wall is near or if the wall is far.
The walls put in front of the backdrop and covers the backdrop. The walls put in the hierarchical
sequence, first put the far away walls, the nearer walls that covers the far away walls below, then put the near
wall in front of the nearer walls and covers the nearer wall. And the left and right wall puts in front of the player
square.
The normal walls hierarchy is these :
First there are far-far side wall, are the smallest with the deepest color and are on far sides.

These tiles are 2 and is difficult to see with your eyes.


Second the far away walls, are the smallest with deep dark color.

These tiles are 5.


Then there are far away side walls, are small but little bigger than the far-far away wall.

These tiles are 4.


Then there are nearer wall, little bigger than the side wall, and its color is little whiter.

These tiles are 3.


Then there are nearer side walls are bigger than the previews wall to cover then in front and are
more whiter in color.

These tiles are 2.


Then there the walls in front of player.

These tiles are 3


At the position of the player there are visible only the left and right walls.
Are the biggest of the kind.

These tiles are 2.


The font and the side wall in front of player and in the sides of the players are the biggest
and most beautiful graphics of the game, because are very-very close and are big and clear. And
you can play with them better. In this part all game takes the action, because in this distance
you are able to pull levers, push button, pull ropes, activate key locks, open doors, put items on
wall niches, windows, and any kind of decoration, can be visible and very clear.
Some very beautiful walls in front of the player.
A beautiful tapestry with element of air.

A beautiful sign on the wall, to read and take information about some warning or some riddle.

Also make it gold in upper left. If you are in a palace.


A beautiful window in the nigh or in the day.

Window, with wall mix.


A beautiful frozen key lock

A beautiful new graphic mix. A window with good rotten key lock.

or you will need 3 keys to unlock one door.


So you can imagine, there is no limit in your fantasy.
Now its time to say something technical.
When the game starts, computer initialize a group of variables in about your player. The group
is assigned as struct in C++ language. If I want to say I have my party I need to say to the
computer.

struct Party {
int party_pos[100][30][30][4];
int direction;
int x;
int y;
int player1_hp;
int player2_hp;
int player1_mp;
int player2_mp;
int armor_class;
};

This is small code, I say to computer create one group of variables numerical and then initialize
them.
In this group, I say the party can be in my big map with floors.
I define some direction.
Some position in x,y
And some characteristics for players as , hit points, mana points for mages, armor for fighter
etc.

The next step is to load some map in memory and start fill the floors of my skyscraper with
walls, doors traps, levers, but only as graphics. They will not work.
If you want to make them work, the mechanism is more complicated.

My map file could be a text file , or you can make it encrypted with a special algorithm to not
be accessible by cheaters. Hmm this door is locked, lets remove the door from map file.
No-no never. Stay and play.

Also you can put your map files in one zip file and lock the zip with password if dont you want
to make encryption algorithms,

The map file format in my engine is similar to the original, the original , is in binary format,
mine is in special text format.

Each square has four sides for each wall direction. If I want to create horizontal 30 squares I
make this.
Each 00 is the palette of wall from 00 to 99 different kind of walls, lock, levers, stairs etc.
The _ character is the mark of my program to know if the square is end and lets go to next
square.

This example appears one simple map with 6x6 squares 36.
The palette of :
00 is an empty square Means player pass through.
01 is a solid wall with some marbles.
02 is a solid wall in flip, about this I will explain later on with is flipped.
03 is a illusion of solid wall, but this wall is fake, need special (True seeing spell to see it).
04 is one window.
05 blah blah

01.01.01.01_04.01.01.01_01.01.01.01_01.01.01.01_01.01.01.01_01.01.01.01_00.00.00.00
01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01_00.00.00.00_00.00.00.00_00.00.00.00
01.01.01.01_00.00.00.00_00.00.00.00_00.00.00.00_00.00.00.00_00.00.00.00_01.01.01.01
01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01_01.01.01.01_01.03.01.01_01.01.01.01
01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01_00.00.00.00_00.00.00.00_00.00.00.00
01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01
01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01

With this map file you see some 01 and 00 that means there is a corridor which turns to the
right and there is one window at the end of the corridor.
The red color , the map file will be black and white there are no colors in map files.
I made the 04 in red to explain. Why only the first is 04 and other three are 01?
This means the wall which faces on the north will have one window texture and other sides will
be only solid wall.
I made the 03 in the map with blue.
This means , in this square there will be an illusion wall that faces only on the south. So if the
player passes the illusion square , there is no return, because the green 01 is the north solid wall
and you cant pass through a solid walls. So you are trapped and you are enter in other map
which leads you perforce , to a corridor with a stairs which leads down to the other level with
dungeon and very evil monsters.

So from this you can understand, when you create your map, you are create your own
adventure.

Now I will explain how the graphics are appeared on the screen with this map.

This map load the level 20 on my big skyscraper.


So if I want to say to my computer, that I am in the 20th floor I need to say with pseudo code,
with my own created function.
Loadmap(c:\eob4\map20.maz);

In the similar way, original (EOB) loads the .maz files in the memory and creates the illusion of
wall an the levels.
But the real mechanic is more complicated.
You need to make a loop to scan whole 6x6 squares.

First you need to say to your program in which level you are , to make a relation of the .maz
file with the correct map.
You can put some header strings before you start scanning your file and create your map.
You can say to the program read first the header strings , what I mean.
This file will not have only the wall, but will have and the info of the level.
So you can read the square bracket bypass this and then read 5 ascii characters , I mean you
pass the bracket then read the word Level so the program understand the next info are about
map file. Then read the 20 with 2 ascii characters only and stores the string 20 in a variable.
Active_Level=atoi(string(5,2)); this is a pseudo code. You will create a function that says
Pass the first 5 characters and take the last 2, the only 20. The atoi function is real in c++ ,
means alp arithmetic to integer. Convert one word in number. In my file the Word Level20 are
without spaces so I need to take only the word Level and only the number 20.
I keep the string Level and now I know this is about the level and I store the number 20 in
one integer.

My map array I had said before is a fourth dimension table. Int Levels[100][30][30][4];

And put my active level in my skyscraper like this.

Levels[Active_level][30][30][4];

[Level20]
01.01.01.01_04.01.01.01_01.01.01.01_01.01.01.01_01.01.01.01_01.01.01.01_00.00.00.00
01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01_00.00.00.00_00.00.00.00_00.00.00.00
01.01.01.01_00.00.00.00_00.00.00.00_00.00.00.00_00.00.00.00_00.00.00.00_01.01.01.01
01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01_01.01.01.01_01.03.01.01_01.01.01.01
01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01_00.00.00.00_00.00.00.00_00.00.00.00
01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01
01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01

Now I know that , this map will fill the 20th floor of my dungeons.
Then I need 2 loops.
For in c++ and other languages are very useful.

After that if I know , the info which will follow are about the wall.
My code will be like this.
For (map_x=1; map_x<=30; map_x++)
{
For (map_y=1; map_y<=30; map_y++)
{
read_wall(north);
read_wall(south);
read_wall(east);
read_wall(weast);
Now I am reading the file with each walls
Then I call some function to bypass the _ character

Levels[Active_level][map_x][map_y][read_wall];

Remember is a pseudo code.


Looks like c++ but some functions need to be created by you.
And I close the brackets.
}
}

Now the level 20 map filled.

Then now we need to check If we are facing in north. We had this struct in the program before.

struct Party {
int party_pos[100][30][30][4];
int direction;
int x;
int y;
int player1_hp;
int player2_hp;
int player1_mp;
int player2_mp;
int armor_class;
};

if we need to put the player in the map.


We need to say.

Party.x=2;
Party,y=3;

And the party will stay at the yellow square.

Remember the file

[Level20]
01.01.01.01_04.01.01.01_01.01.01.01_01.01.01.01_01.01.01.01_01.01.01.01_00.00.00.00
01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01_00.00.00.00_00.00.00.00_00.00.00.00
01.01.01.01_00.00.00.00_00.00.00.00_00.00.00.00_00.00.00.00_00.00.00.00_01.01.01.01
01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01_01.01.01.01_01.03.01.01_01.01.01.01
01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01_00.00.00.00_00.00.00.00_00.00.00.00
01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01
01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01_00.00.00.00_01.01.01.01_01.01.01.01
The player will see this on the screen.

This was a very good remix of walls and backdrop.

Why is this happened and how?

When the party is facing to the north and if there is a wall in front of players, you are checking
if in on square in front of you there is a wall.

On the Map players are moving in x and y positions


If you are facing to the north and you have a wall in front of you, check the party y position -1
on the map and the x position is the same.
If I want to do this with code I will write this.

If (Levels[20][Party.x][Party.y-1][1]==04)
{
//This is your function of printing sprites on the screen
drawsprite(screenx,screeny,Wall_texture);
}

If you want to check if there is a wall 2 squares far from player you need to check your party
Y position 2 you will write this code.
With order first the far sprites and then the nearer sprites to cover each other.

If (Levels[20][Party.x][Party.y-2][1]==04)
{
//This is your function of printing sprites on the screen
drawsprite(screenx,screeny,Wall_texture);
}

If (Levels[20][Party.x][Party.y-1][1]==04)
{
//This is your function of printing sprites on the screen
drawsprite(screenx,screeny,Wall_texture);
}

The screenx and screeny variables are the variables in pixels to plot your sprite on the screen.
Lets explain this better if you dont understand.

In this figure we have the map as a grid. The blue square is the position of our part.
The white lines on the grad are the visible walls in our eyes and these walls are drawing on the
screen for now.
The wall A is the left wall this wall appears in the party_x-1,party_y
We plot the sprite of Wall A 133 pixels horizontal and 7 pixels vertical to put correct on the
screen and make the graphics good.

The code here could be

If (Levels[20][Party.x-1][Party.y-1][3]==01)
{
//This is your function of printing sprites on the screen
drawsprite(133,7,Wall01a);
}
Now you are checking the next wall in front of you 2 squares in front and 1 square to the left.
The sprite will plotted on the screen 158 pixels horizontal and 15 pixels vertical.
The code will be like this.

If (Levels[20][Party.x-2][Party.y-1][3]==01)
{
//This is your function of printing sprites on the screen
drawsprite(158,15,Wall01b);
}
Now the next wall will be plotted on your screen but the code will change a little.

The code Levels[20][Party.x-2][Party.y-1][3] The 3 will change now.


The new code will be
If (Levels[20][Party.x-3][Party.y][1]==04)
{
//This is your function of printing sprites on the screen
drawsprite(182,27,Wall04c);
}
This means in the fourth dimension the table Levels[First][Second][Third][Forth] is the
direction of the wall.

In the map file I had this. 00.00.00.00_00.00.00.00_...


The fourth dimension of my array when if is 1 means the wall face North
The fourth dimension of my array when if is 2 means the wall face South
The fourth dimension of my array when if is 3 means the wall face West
The fourth dimension of my array when if is 4 means the wall face East
In our example the Window square is 04.01.01.01 that means the wall that faces in North is 4
If (Levels[20][Party.x][Party.y-3][1]==04)
We are on Level20
If (Levels[20][Party.x][Party.y-3][1]==04)
We are on square x position of our party
If (Levels[20][Party.x][Party.y-3][1]==04)
We are checking in 3 squares far in front of our party is something
If (Levels[20][Party.x][Party.y-3][1]==04)
We are checking the North side of square for us.
If (Levels[20][Party.x][Party.y-3][1]==04)
We are checking the palette of the wall, no the color palette we check the kind of wall.

This is the only the one quarter of the wall engine.


If you want to turn to the left right you are changing direction
If you where North and turn left, now you will facing to the West
If you where South and turn Right, now you will facing to the East

The difficult part is only the North and West. The South and East are almost the same with
negative sign.
The North Code was
If (Levels[20][Party.x][Party.y-3][1]==04) //Check for North
Now will change a +3 and
The South code will be like this one.
If (Levels[20][Party.x][Party.y+3][2]==04) //Check for South
You need to assign some direction flag with value from 1 4
If (Direction_Flag==1) { then draw_walls_North(); }
If (Direction_Flag==2) { then draw_walls_South(); }
If (Direction_Flag==3) { then draw_walls_West(); }
If (Direction_Flag==4) { then draw_walls_East(); }

And then use the code. Like a function

Draw_wall_West()
{
If (Levels[20][Party.x-1][Party.y][3]==01)
{
//draw the sprite correct on my screen.
}
}
If you want to check the East wall , negative the sings
Draw_wall_East()
{
If (Levels[20][Party.x+1][Party.y][4]==01)
{
//draw the sprite correct on my screen.
}
}
So you will have this on your screen.

This is the West wall not North wall.


If you want to appear the East wall , just negative your sings.
When I mean Negative I mean Reverse when some sing is - minus turn it to the + Plus
When a sing is + plus turn it to the minus -
When turning your player check the last direction_flag variable. You can put the direction
variable to your party group struct.
Like this;

struct Party {
int party_pos[100][30][30][4];
int direction;
int x;
int y;
int player1_hp;
int player2_hp;
int player1_mp;
int player2_mp;
int armor_class;
int direction_flag //This variable added now
};

check: If you facing to the North.


When you press 7 key to turning to the left
If (Party.direction_lag==1) { Party.direction_flag=3; } //New Direction is West
When you press 9 key to turning to the right
If (Party.direction_lag==1) { Party.direction_flag=4; } //New Direction is East

This was the Map Explanation only , how the graphics appear on the screen.
I will post how the event are working with game , how to push buttons on the wall, how to open
door and how to interactive change one wall in runtime. In other document

You might also like