2014-02-01 17:11:40 +01:00
|
|
|
---
|
|
|
|
title: Dawn of Chaos
|
2019-06-19 13:37:04 +02:00
|
|
|
date: 2004
|
2019-06-23 22:38:36 +02:00
|
|
|
dev: delphi, directx
|
2014-02-01 17:11:40 +01:00
|
|
|
---
|
|
|
|
|
2019-06-23 22:38:36 +02:00
|
|
|
During the first year of undergraduate study at Epita we have to develop a
|
|
|
|
project in either Delphi or OCaml within a team of four to validate the year.
|
|
|
|
Since this is the only year we are allowed to make a video-game, we chose to
|
2014-02-23 16:29:37 +01:00
|
|
|
create a Diablo-like in Delphi as our school project in 2004.
|
2014-02-01 17:11:40 +01:00
|
|
|
|
2019-06-23 22:38:36 +02:00
|
|
|
For most of the student, and for my team, this is the first programming project
|
|
|
|
we do ourselves. As such, we were lacking best practices and we learned along
|
|
|
|
the way. The development was quite hard, because at the time we had no
|
|
|
|
programming skill. Moreover, our team quickly fell out, with one member quitting
|
|
|
|
the school after a few months and another one struggling with programming. It
|
|
|
|
ended up being a two-persons project.
|
2014-02-01 17:11:40 +01:00
|
|
|
|
2014-02-23 16:29:37 +01:00
|
|
|
Nevertheless, this was a truly rewarding experience since I learned the basics
|
|
|
|
of video game creation and DirectX programming.
|
2014-02-01 17:11:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
GRAPHIC ENGINE
|
|
|
|
--------------
|
|
|
|
|
2014-02-23 16:29:37 +01:00
|
|
|
We had the choice between DirectX and OpenGL for developing our graphic engine.
|
|
|
|
Most of the students chose OpenGL but we thought DirectX was more suitable for a
|
|
|
|
Windows game because we had no intention to port the project to Linux.
|
2014-02-01 17:11:40 +01:00
|
|
|
|
2019-06-23 22:38:36 +02:00
|
|
|
We used the [Jedi Project](http://www.delphi-jedi.org/) headers as a means to
|
|
|
|
use DirectX with Delphi. The first contact with DirectX was harsh but after
|
|
|
|
carefully reading the SDK documentation I was able to grasp the basics. I would
|
|
|
|
like to thank my fellow student Buckman for helping me figure the logic of
|
|
|
|
DirectX out.
|
2014-02-01 17:11:40 +01:00
|
|
|
|
2019-06-23 22:38:36 +02:00
|
|
|
The 3D models should have been generated with Maya but we were not able to
|
|
|
|
produce any good 3D assets by ourselves. So we searched graphism websites for
|
|
|
|
simple models and we modified them with Maya. For the texturing part and the
|
|
|
|
conversion of the Maya file format to the DirectX one, we used Deep Exploration
|
|
|
|
(by Right Hemisphere).
|
2014-02-01 17:11:40 +01:00
|
|
|
|
2014-02-23 16:29:37 +01:00
|
|
|
In order to make things dynamic, we just added a game loop with mutable
|
|
|
|
variables (by pressing keys for moving the camera for instance). Unfortunately,
|
|
|
|
the game loop was not set on the time but on the cpu cycles. As a result, it
|
2019-06-23 22:38:36 +02:00
|
|
|
runs as fast as your cpu can, making things lagging.
|
2014-02-01 17:11:40 +01:00
|
|
|
|
2014-02-23 16:29:37 +01:00
|
|
|
Finally, I added a 2D display for game informations such as health. It was done
|
|
|
|
using DirectSprites and DirectFonts. A bug with the proportions forced me to
|
|
|
|
tweak the sprites size manually in order to make the game look as expected on
|
|
|
|
screen.
|
2014-02-01 17:11:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
PATHFINDING
|
|
|
|
-----------
|
|
|
|
|
2014-02-23 16:29:37 +01:00
|
|
|
For the pathfinding, I used the classic A*. Each tile of the map is enabled or
|
|
|
|
not, make a boolean map on which I applied the pathfinding.
|
2014-02-01 17:11:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
SOUND ENGINE
|
|
|
|
------------
|
|
|
|
|
2019-06-23 22:38:36 +02:00
|
|
|
"Sound engine" might sound a bit fancy for what was done. At first I thought I
|
|
|
|
would use the DirectSound library since our graphic engine was done with
|
|
|
|
Direct3D but I quickly changed my mind.
|
2014-02-01 17:11:40 +01:00
|
|
|
|
2014-02-23 16:29:37 +01:00
|
|
|
DirectSound allows you to use incredible 3D sound effects like reverberation but
|
|
|
|
it was a nightmare to use it. I spent an entire night just for trying to play a
|
|
|
|
simple .wav file. Without success.
|
2014-02-01 17:11:40 +01:00
|
|
|
|
2014-02-23 16:29:37 +01:00
|
|
|
Then I tried Fmod that everybody was using at the moment and I was able to play
|
|
|
|
a .mp3 file in 10 minutes and 3 lines of code.
|
2014-02-01 17:11:40 +01:00
|
|
|
|
2014-02-23 16:29:37 +01:00
|
|
|
For the needs of the game, I included a background music and I added step sound
|
|
|
|
effect when the player is walking.
|
2014-02-01 17:11:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
AI
|
|
|
|
--
|
|
|
|
|
2014-02-23 16:29:37 +01:00
|
|
|
The AI is just some nested conditions ("if .. then .. else"). The principle was
|
|
|
|
the following: an enemy is making his rounds and it attacks of the hero is close
|
|
|
|
enough. The enemy goes back to making his rounds if he is almost dead or if the
|
|
|
|
hero is getting away (the hero is of course faster than any enemy).
|
2014-02-01 17:11:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
WHAT WAS DONE BY OTHERS
|
|
|
|
-----------------------
|
|
|
|
|
2019-06-23 22:38:36 +02:00
|
|
|
My friend created a truly rich map editor that was used for making the game. He
|
|
|
|
also created the elements of the world. He was then able to define position and
|
|
|
|
rounds for the enemies directly from his editor. Our game engine only had to
|
|
|
|
get his data from the editor in order to generate the levels.
|
2014-02-01 17:11:40 +01:00
|
|
|
|
|
|
|
At last, he was in charge for the management of the hero: life, equipment, etc.
|
|
|
|
|
|
|
|
|
|
|
|
LAST WORDS
|
|
|
|
----------
|
|
|
|
|
2014-02-23 16:29:37 +01:00
|
|
|
Our game was quite pretty but it was very slow due to the too detailled models
|
|
|
|
used for the hero and the enemies. It lacks animation too. I really wanted to
|
|
|
|
incorporate animation but I wasn't able to.
|