Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Schütz committed Sep 28, 2017
1 parent 76dd497 commit 924880f
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 31 deletions.
4 changes: 2 additions & 2 deletions master/level.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ void newlevelpos()
bosses_killed = level / BOSS_LEVEL_DISTANCE;
else
bosses_killed = (-level + 1) / BOSS_LEVEL_DISTANCE;
// the number of monsters that can possibly appear increases for every 2 bosses killed
uint8_t num_monsters = random_below(MIN(bosses_killed / 2 + 1, NUM_MONSTERS)) + 1;
// the number of monsters that can possibly appear increases for every boss killed
uint8_t num_monsters = random_below(MIN(bosses_killed + 1, NUM_MONSTERS)) + 1;
for (uint8_t i = 1; i < num_monsters; ++i)
{
monsters[i]->look = random_below(NUM_MONSTER_LOOKS);
Expand Down
3 changes: 3 additions & 0 deletions website/Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
output/: content/*/*
pelican -d

clean:
rm -r output __pycache__
Binary file modified website/content/downloads/metro-hd.zip
Binary file not shown.
8 changes: 4 additions & 4 deletions website/content/pages/download.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,24 @@ of the presentation we gave at the end of the practical.

Statistics
==========
Our git repository has about 450 commits.
Our git repository has about 490 commits.

Regarding the lines of code, excluding those generated by scripts,
we have the :code:`master` folder:

.. code-block:: sh
$ find master/ -type f -not -name "sprites.*" | xargs sloccount
ansic: 3279 (98.44%)
ansic: 3287 (98.44%)
python: 52 (1.56%)
and the :code:`slave` folder:

.. code-block:: sh
$ find slave/ -type f -not -name "music.*" -not -name "fx.*" | xargs sloccount
ansic: 327 (75.00%)
python: 109 (25.00%)
ansic: 256 (70.14%)
python: 109 (29.86%)
.. _here: {filename}/downloads/metro-hd.zip
.. _GitHub: https://github.com/dotlambda/metro-hd
Expand Down
30 changes: 16 additions & 14 deletions website/content/pages/implementation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ Implementation

Drawing
=======
The display of the game console can recognise four grey scales.
The display of the game console can differentiate between four grey scales.
Each pixel on the display is defined by two bits
(00 ≙ white pixel, 01 ≙ light grey pixel, 10 ≙ dark grey pixel, 11 ≙ black pixel).

To convert png images into code we wrote a python script
that takes a png image as input and converts it into an C array.
To convert PNG images into code we wrote a Python script
that takes a PNG image as input and converts it into a C array.
The entries of the array are 8-bit entries that represent the different pages
(page ≙ four vertical pixels) of the image.

Expand All @@ -28,7 +28,7 @@ The details are explained in the `data sheet`_.
disable_window();
}
This is faster than using the :code:`page()` function, because fewer commands are send to the display.
This is faster than using the :code:`page()` function, because fewer commands are sent to the display.

In order to draw pixel-by-pixel and not only pagewise in the vertical direction,
we wrote the :code:`drawsprite_px()` function:
Expand Down Expand Up @@ -60,12 +60,12 @@ we wrote the :code:`drawsprite_px()` function:
Problem: Flash Size
-------------------
.. figure:: {filename}/images/speicherplatz.png
:alt: We currently use about 95% of the available flash storage
:alt: We currently use about 95% of the available flash storage.
:width: 50%

We currently use about 95% of the available flash storage
We currently use about 95% of the available flash storage.

Since the Atmega 328 only has 32 kiB of flash memory,
Since the Atmega 328 only has 32 KiB of flash memory,
we had to come up with creative ways to reduce the space used.
First, before storing the sprites as arrays in the :code:`PROGMEM`,
we wrote the calls to the :code:`page()` function by hand for every sprite.
Expand All @@ -82,10 +82,12 @@ Therefore, we split some sprites up into smaller chunks:

Level Setup
===========
Every level consists of a number of rooms, whereby the number of rooms is a random number between one and five.
Furthermore the monster(s), the positions of the platforms and water are chosen randomly for every new room and the floor and ceiling sprite is chosen randomly for every new level.
Every level consists of a number of rooms which is a random number between one and five.
Furthermore the monster(s) and the positions of the platforms and water are chosen randomly
for every new room and the floor and ceiling sprite is chosen randomly for every new level.

To make sure that a level you have already been to looks the same as before, we choose the seed of the random number generator depending on the level and on the room the protagonist is in.
To make sure that a level you have already been to looks the same as before,
we choose the seed of the random number generator depending on the level and on the room the protagonist is in.

.. code-block:: c
Expand Down Expand Up @@ -129,10 +131,10 @@ Below, we will explain the idea behind this algorithm using an exemplary level.
But now, we discover that there is no further path that we can take since the platform is too far away.

.. figure:: {filename}/images/dfs5.png
:alt: Therefore, we consider the other alternative. We see that we can jump ono another platform.
:alt: Therefore, we consider the other alternative. We see that we can jump onto another platform.
:width: 50%

Therefore, we consider the other alternative. We see that we can jump ono another platform.
Therefore, we consider the other alternative. We see that we can jump onto another platform.

.. figure:: {filename}/images/dfs6.png
:alt: Now, we jump over the gap between two platforms.
Expand Down Expand Up @@ -190,7 +192,7 @@ These take care of

Then, there is also a function :code:`move()` which automatically decides in which direction to move.
For example, a monster with :code:`movement==FOLLOW_PROTAGONIST` will automatically move towards the protagonist
whenever this function is called with that very monster as argument.
whenever a pointer to that very monster is passed to the function.

Course of the Game
==================
Expand All @@ -207,7 +209,7 @@ and the protagonist still has a rocket to shoot that is not yet moving,
the rocket is drawn to the screen and the protagonist loses one of his rockets.
To make sure that he still has the same number of rockets
when the game is resumed after turning the console off,
the number is in the :code:`EEPROM`.
the number is also stored in the :code:`EEPROM`.

.. code-block:: c
Expand Down
6 changes: 3 additions & 3 deletions website/content/pages/sound.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ because B1 is set to high at 0 and set to low when reaching :code:`OCR1A`.

:code:`OCR1A` is set in the interrupt of Timer2,
which is called with a frequency of 15625 Hz.
To e.g. generate a tone with 440 Hz,
we simply need to reach the maximum pulse width (255) with a frequency of 440 Hz.
To e.g. generate a 440 Hz tone,
we need to reach the maximum pulse width (255) with a frequency of 440 Hz.
To do this, the pulse width can simply be incremented by

.. math::
Expand All @@ -50,7 +50,7 @@ we use :code:`uint16_t` and increment the pulse width by
which is obviously a lot more accurate.
Additionally, Timer2 is used to keep track of the time.

To make easier to write our own music for the console and use existing tunes,
To make it easier to write our own music for the console and use existing tunes,
we wrote a Python script that converts MIDI files
into C arrays that are stored in the :code:`PROGMEM`.
We use the mido_ library to read the files.
Expand Down
6 changes: 3 additions & 3 deletions website/content/pages/the-game.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Order: 2

![](images/splash.png){width=100%}

We based our game on the Metroid Series, especially on Metroid Fusion which is an action-adventure jump'n'run game.
We based our game on the Metroid series, especially on Metroid Fusion which is an action-adventure jump'n'run game.

So what is there to do in our game?

Expand All @@ -17,7 +17,7 @@ Additionally there are different obstacles like water or spikes in the different

![Rest in the Recharge Room.](images/world4.png){width=50%}

Before every fifth level, there is a so called recharge room, where the protagonist can refill his energy and ammunition.
Before every fifth level, there is a so-called recharge room, where the protagonist can refill his energy and ammunition.

![Fight bosses.](images/world6.png){width=50%}

Expand All @@ -26,6 +26,6 @@ All the bosses have different moves and abilities, so none is like the other.

![Achieve Power-Ups.](images/world5.png){width=50%}

After successfully defeating a boss the protagonist obstains a Power-Up.
After successfully defeating a boss the protagonist obstains a power-up.

The amount of monsters which can appear in one room will increase by one after each successful boss fight.
10 changes: 5 additions & 5 deletions website/content/pages/the-task.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ The console should also have a sound output for music and sound effects.
The console features two microcontrollers:

* [Atmega328](https://en.wikipedia.org/wiki/ATmega328) with
- 32 kB flash
- 2 kB SRAM
- 1 kB EEPROM
- 32 KiB flash
- 2 KiB SRAM
- 1 KiB EEPROM
* Atmega168 with
- 16 kB flash
- 1 kB SRAM
- 16 KiB flash
- 1 KiB SRAM
- 512 B EEPROM

where the former is responsible for the game logic and controlling the display
Expand Down

0 comments on commit 924880f

Please sign in to comment.