Skip to content

Commit 5b61df9

Browse files
committedJan 11, 2019
Finished for playtesting
1 parent cea750c commit 5b61df9

30 files changed

+363
-5349
lines changed
 

‎README.md

+58-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# TETRIS ALMOST FROM SCRATCH
2-
This is an attempt of making the game [Tetris](https://en.wikipedia.org/wiki/Tetris) using modern programming languages. The idea is to time the development and track the progress and the time it took to get in each stage in this document. If possible I want to finish this project in under 12 h.
2+
This is an attempt of making the game [Tetris](https://en.wikipedia.org/wiki/Tetris) using modern programming languages. The idea is to time the development and track the progress and the time it took to get in each stage in this document. If possible I want to finish this project in under 24 h.
33

44
Tetris is the first software to be exported from the USSR to the US and became and not only became one of the most famous computer games, it has been released for nearly every videogame console and computer operating system.
55

6-
For this project, I'll be using the engine built for the [tetris-almost-from-scratch](https://github.com/luxedo/tetris-almost-from-scratch). I'll try to improve it and try to draw only characters on screen. The idea is to simulate the original game and also show an improved view using the same engine.
6+
For this project, I'll be using the engine built for the [asteroids-almost-from-scratch](https://github.com/luxedo/asteroids-almost-from-scratch). I'll try to improve it and try to draw only characters on screen. The idea is to simulate the original game and also show an improved view using the same engine.
7+
78
![original tetris](https://upload.wikimedia.org/wikipedia/en/7/7c/Tetris-VeryFirstVersion.png)
89

910
The game is based in html5/canvas, CSS and ES6 javascript.
1011

11-
#### Check it out [here](https://luxedo.github.io/tetris-almost-from-scratch/)
12+
#### Check it out [here](https://tetris-almost-from-scratch.firebaseapp.com/)
1213

1314
## Goals
1415
* ~~Add `LICENSE.md` and `README.md`~~
@@ -28,8 +29,7 @@ The game is based in html5/canvas, CSS and ES6 javascript.
2829
* ~~Create "next piece" display~~
2930
* ~~Create Menu screen and Credits screen~~
3031
* ~~Create high-scores~~
31-
* Add sounds
32-
* Improve webpage
32+
* ~~Add sounds~~
3333
* Fix playtesters requests
3434
* Finished!
3535

@@ -160,9 +160,11 @@ were above that line.
160160
## 13:00 - Create levels/scoring
161161
The scoring system I used was the [Original Nintendo Scoring System](http://tetris.wikia.com/wiki/Scoring). In summary it is a table of a base according to the number of broken lines times the current level+1.
162162

163-
For the levels, I chose to increase it for every 10 broken lines, as in the NES version.
163+
For the levels, I chose to increase it for every 10 broken lines, as in the NES
164+
version.
164165

165-
To show the socores (`СЧЕТ`) and the level (`УРОВЕНЬ`) I decided to use the original words in russian.
166+
To show the socores (`СЧЕТ`) and the level (`УРОВЕНЬ`) I decided to use the
167+
original words in russian.
166168

167169
![score](/report-assets/score.gif)
168170

@@ -187,5 +189,52 @@ the background and border for those screens to inherit.
187189

188190
![Menu and Credits](/report-assets/menu_credits.gif)
189191

190-
## 19:00 - Create high-scores
191-
I implemented the High Scores for the [Asteroids](https://luxedo.github.io/asteroids-almost-from-scratch/) project, so I just had to copy that and do some refactoring.
192+
## 22:30 - Create high-scores
193+
I implemented the `High Scores` for the [Asteroids](https://luxedo.github.io/asteroids-almost-from-scratch/) game and deployed on [Heroku](https://www.heroku.com/).
194+
I'ts quite easy to work with them but unfortunately I'm out of [dynos](https://www.heroku.com/dynos).
195+
Because of that I had to look for another host.
196+
197+
I chose to host at [Firebase](https://firebase.google.com) because their free tier
198+
is quite nice. This game is not built for mobile but I intend to port it in the
199+
future. It was also a chance to learn how to use the `Firebases`'s services and I
200+
really enjoyed the experience. It took around 5 hours of studying and messing around
201+
and 30 minutes of coding to make the `High Scores` work.
202+
203+
In the end, `Firebase` takes care of a lot of complexity when setting up a
204+
database which is very nice. In the end, I just had to use their javascript
205+
client to read and write in the database and hopefully the security part is
206+
handled by them. I still don't understand how [Progressive Web Apps](https://developers.google.com/web/progressive-web-apps/)
207+
are meant to be built, but I know that this app is working.
208+
209+
![High Score](/report-assets/high_score.png)
210+
211+
Because of the Firebase studies, I'm going to extend the project's deadline to
212+
26 hours.
213+
214+
## 26:00 - Add sounds
215+
Phew this took more time than I imagined. I just blew my newest deadline.
216+
217+
I had code from the previous games to play sounds, but I decided to
218+
investigate whats new. I found out that the [Web Audio API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API)
219+
is much better than the old `<audio>` tags that I used to use. I had
220+
to learn how to use it, but it feels much better than the old method
221+
that included a couple of `setTimeout`s.
222+
223+
I'm not sure if the original tetris had sounds or music. For nostalgia
224+
sake, I included the game theme in the `Menu Screen`. I also added some
225+
generic blip noises for other commands.
226+
227+
I made a class to hide the complexity of dealing with sounds:
228+
229+
![Sound](/report-assets/sound_class.png)
230+
231+
Then I just have to call the sounds whenever they're needed:
232+
233+
![Calling Sound](/report-assets/calling_sound.png)
234+
235+
236+
Thanks to [archive.org](https://archive.org) for the theme, `n_audioman`,
237+
`LittleRobotSoundFactory` and `jeckkech` for the other sounds in [freesound.org](https://freesound.org)
238+
and `David Whittaker` for the gameover sound at zxart.ee.",
239+
240+
Now, I'm releasing the game for the playtesters.

‎firebase.json

-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22
"database": {
33
"rules": "database.rules.json"
44
},
5-
"functions": {
6-
"predeploy": [
7-
"npm --prefix \"$RESOURCE_DIR\" run lint"
8-
],
9-
"source": "functions"
10-
},
115
"hosting": {
126
"public": "public",
137
"ignore": [

‎functions/.eslintrc.json

-123
This file was deleted.

‎functions/index.js

-36
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.