WARNING!
Few honest informations.
I have a few years experience
in software developer BUT I am
NOT a game developer! I am NOT
an expert.
This guide was written by
person who want write game as part of hobby and make dreams come to
true (As I want to write simple RPG game in future).
I put
best efforts to write accuracy informations, but I cannot
guarantee the perfect accuracy of all content in this articles
on this blog.
I do not take any responsibility or liability for any error, omission, inaccuracy or destructions!
I do not take any responsibility or liability for any error, omission, inaccuracy or destructions!
How to make simple game in Android
BASED ON GAME EXAMPLE:
DOMS COUNTRIES, CAPITOLS, FLAGS AND
CONTINENTS QUIZ GAME
Part 1b
A CHALLENGE
In this part, I will talk about challenge
“Write a game in one weekend”.If you are just interesting how I
wrote this game. Go to part 2 {link coming soon}
Cheats:
1. I already collect all graphics. I
used:
- Flags from http://www.free-country-flags.com/ with few exception when I used flags came from en.wikipedia.org or official country website, if was allowed
- Icons from http://www.famfamfam.com/ made by Mark
James
2. My design was heavy based on my application Doms learn Chinese (https://play.google.com/store/apps/details?id=dms.pastor.chinesegame)
3. My algorithms based on Doms learn Chinese, but
during development I discover mu current algorithm is rubbish, so I
need it to improve for quiz game otherwise it will cause out of
memory error bug.
Rules:
- Time frame from Friday 18.00 to Monday 2.00 (my original plan was Sunday 22.00, but due my plan to attend to drum workshop on Sunday, I moved deadline to 2 am).
- At Monday 2am game must be published.
- Game must be playable at end of time (it means no crashes allowed)
- It must contains 3 modes countries of the world, capital of the world and flags of the world.
- High score should works at least for highest score but top 10 will be welcomed.
DIARY
Friday evening
It was very easy as I used simplified design from Doms learn Chinese application.
Main menu has 4 options:
New Game - where user can select 4 game types:
- Country of the world,
- Capital of the
country,
- flag of the country,
- Saper mode
Tutorial – that explains how game works.
About - I have template for that,so it was copy and paste. Except for about game, where I need to write description.
I implemented UI and some code for display About and Tutorial stuff.
As I felt hungry, so it was a time for quick dinner at 20.00
Dinner over and at 21.00 with support of my friends red Porto wine and snacks I start to implement UI for level and results.
I created test file with 10 countries . I create a classes for basic flow level and result. I implement loading countries from file into memory and add validation to check is all data is correct. Everything went smoothly.
.
Around 2.00 I need to fix few... several mistakes with data. I start implementing prototype for capital of the country' and I copied all graphics (countries flag and etc.). I added 193 countries to file with all date and check can I play. Well I can play but glitches needed to be fixed.
Just before 4.00 I finished prototype works and I went to sleep.
Plan result:
UI(done), menu (done), prototype (done), country
and add all countries data (done).
I have done everything what I planned. So
far, so good.
Saturday
Plan for Saturday: country
of the world, capital of the world and flag of the world are done,
prototype of saper mode(if time allowed),
At 10.00 I get up and I was almost ready to action. Well, I needed to go to for a food can be useful for rest of the weekend.
At noon start
and implemented
'final version' of country of the world game and test it. I
implemented a result page. As
it works after another
few fixes and then, so
next game type capitals was straightforward.
At 15.00, I start implementing 'flags of the world' but I had a bit a problem with how to add name of resource dynamically but quick search on stackoverflow.com and few searches later this line...
decodeSampledBitmapFromResource(this.getResources(), this.getResources().getIdentifier(answerCountry.getFlagId(), "drawable", getPackageName()), 240, 160);
...I
solved my problem quickly and
then I smoothly
implement flag of the country game.
At 17.30 I decided to do
extra game mode called "walk-trough". Idea was
simple.. .User need guess all countries available in game. I
implemented,but during test I discover a problem .... a big
problem... .Game start crashes around 75% of test during out of
memory issue.
I attempt to solve problems in many ways:
I tried set flags:
"ii.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);"
I tried use:
android:largeHeap="true"
and many more things but problem stills exist.
More details can be found in part 5 (Implementation), where I describe more details about set image and how I solve problems related to flag of the world problem.
At 23.00 I gave up to solve this problem for now. I to implement other minor things like simple high score(where only highest score will be remembered), decided to resize some flag to one size, make other adjustment.
Near 1.45 am EUREKA! I realised that I need only activity for all levels, but as was late late to start re-design and re-implement level. I decided to continue to implement all little bits.
Around 3.00 I feel tired, but I have done almost all little stuff and some tests. I was bit worried about bug. I feel that's middle of the night is not best time to re-design stuff, so I I decided go to bed.
Plan result: country of the world(done), capital of the world(done) and
As You can see I didn't do everything, what I planned, as I spent too much time to solve 2 bugs (image issue and out of memory error), but at least I discover that my level/activity approach is rubbish, so I am happy with what I learn.
Sunday.
Plan for Sunday: test, saper
mode, countries and
continents mode, high
score, add project and released it, test
re-design of algorithm for level, walk-through mode.
I expect, that workshop will take 3 hours but in fact
First half of the day spent on drum workshop, where apart
of learning basics of play on drums (or revision in my case) I
had idea how to re-write my code.
I
start development on 5 o'clock (17.00).
Not
too much time left. Time pressure – a one of the best friend of
software developer before deadline – is with me. Let’s fun begin.
I rewrote code
for level and... which works and solved my problems. All test passed.
I allowed myself to eat
quick unhealthy dinner.
19.45. Implement Saper mode, in only 1,5 hour.
It was time now for implement country and continents mode, which
takes another 2 hours.
23.15
Final Testing,
refactoring
and improvements begins.
During final tests, I discover few problems:
- Some countries are not on specific continents, but they are rather in specific regions, so I renamed continents to regions /
- Region issue... Russia belong to 2 regions, but my program assumes that Russia belong to Europe, so answer that Russia belong to Asia is assumed as incorrect as it require some changes to code and I decided to ignore that (or implement in far away future) .
- Some countries has no official capital, some has 2-3 capitals. I arbitrary decided to choose one, but my code should randomly select one. I decided to ignore that (or implement in far away future)
- I discover that my
program theme looks very oldschool, then I realise that I forgot
about ad android:targetSdkVersion="16"
in all my programs. WHAT A
FAIL!: P. I fixed in 15 seconds. LOL;)
- Few minor glitches and bugs, but nothing
excited to wrote about it.
Near 0.30 .... all test passed, so
release v0.4 was ready to put on google play. I added title,
description all marketing bla bla bla and DONE! I pressed publish.
At 1 am. I am happy I
have done it! I can go to sleep I really needed
go to sleep as I work on Monday!
Plan result: All done!
You can download my game https://play.google.com/store/apps/details?id=dms.pastor.cccfQuizGame (It changed a lot since, then I decided do few “little bits” here and there.)
I have a great fun to do this challenge. I learn few
little interesting bits about Android and more, but if you are
interesting in summary and more details conclusion about this
project, go to part 10.
For folks who want learn how I wrote very simple game
as part of learn android development.. .Please go to part 2, I will
write what is good to learn and know about Android and Java to be
able to writing program for Android or part 3,if you already familiar
with programming in Java, as in part 3, where I describe my planning
stage.
Link to part 2:
What You need to learn
Link to part 3:
Planning
Link to part 10:
Summary
Thanks to:
- for flags http://www.free-country-flags.com/
- for icons http://www.famfamfam.com/
- for music that was my main entertainment over weekend with great drum and bass mixes http://www.bassblog.pro/
This comment has been removed by the author.
ReplyDeleteGreat diary, love reading devlogs :) Thanks for the link to my blog too!
ReplyDelete