• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 16:05
CEST 22:05
KST 05:05
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
TL.net Map Contest #21: Voting10[ASL20] Ro4 Preview: Descent11Team TLMC #5: Winners Announced!3[ASL20] Ro8 Preview Pt2: Holding On9Maestros of the Game: Live Finals Preview (RO4)5
Community News
Chinese SC2 server to reopen; live all-star event in Hangzhou18Weekly Cups (Oct 13-19): Clem Goes for Four3BSL Team A vs Koreans - Sat-Sun 16:00 CET7Weekly Cups (Oct 6-12): Four star herO85.0.15 Patch Balance Hotfix (2025-10-8)81
StarCraft 2
General
RotterdaM "Serral is the GOAT, and it's not close" Weekly Cups (Oct 13-19): Clem Goes for Four Chinese SC2 server to reopen; live all-star event in Hangzhou The New Patch Killed Mech! 5.0.15 Patch Balance Hotfix (2025-10-8)
Tourneys
Tenacious Turtle Tussle RSL Season 3 Qualifier Links and Dates $1,200 WardiTV October (Oct 21st-31st) SC2's Safe House 2 - October 18 & 19 INu's Battles #13 - ByuN vs Zoun
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 496 Endless Infection Mutation # 495 Rest In Peace Mutation # 494 Unstable Environment Mutation # 493 Quick Killers
Brood War
General
Is there anyway to get a private coach? SnOw's Awful Building Placements vs barracks BW General Discussion BSL Team A vs Koreans - Sat-Sun 16:00 CET BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[ASL20] Semifinal B [Megathread] Daily Proleagues 300$ 3D!Community Brood War Super Cup #4 Azhi's Colosseum - Anonymous Tournament
Strategy
[I] TvP Marine Usage Roaring Currents ASL final Current Meta BW - ajfirecracker Strategy & Training
Other Games
General Games
Path of Exile Nintendo Switch Thread Stormgate/Frost Giant Megathread Dawn of War IV ZeroSpace Megathread
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread The Chess Thread Men's Fashion Thread
Fan Clubs
The herO Fan Club!
Media & Entertainment
Anime Discussion Thread Series you have seen recently... [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023 Formula 1 Discussion NBA General Discussion
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Recent Gifted Posts
Blogs
The Benefits Of Limited Comm…
TrAiDoS
Sabrina was soooo lame on S…
Peanutsc
Our Last Hope in th…
KrillinFromwales
Certified Crazy
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1755 users

Student Game Dev Part 20 - Score and decisions

Blogs > Soan
Post a Reply
Soan
Profile Blog Joined August 2010
New Zealand194 Posts
Last Edited: 2014-04-13 00:13:24
April 12 2014 06:35 GMT
#1
+ Show Spoiler [Previous parts] +
Part One - It begins
Part Two - Technical Foundation
Part Three - Game Design
Part Four - Input and Physics
Part Five - More Physics Things
Part Six - Even More Physics
Part Seven - User Interface
Part Eight - UI and the Editor
Part Nine - Editor Progress
Part Ten - Progress, and videos
Part Eleven - Fixing the Physics
Part Twelve - Unproductive
Part Thirteen - Context menu + enemies
Part Fourteen - Enemies and Problems
Part Fifteen - Play testing
Part Sixteen - Editor and Art
Part Seventeen - Video!
Part Eighteen - Layers and Music
Part Nineteen - Water and Enemies


This Week
Hello again TeamLiquid! Welcome back to my blog about the development of The Adventures of Sam the Pirate, the 2D platformer I'm creating as the final game project for my Bachelor of Software Engineering degree. Last week I talked about adding water to the game, fixing the enemy movement, and starting to add coins to the game. Bit of a later post, been pretty busy looking at houses to rent and moving into some temporary accommodation. This week I'll be talking about implementing the score and displaying it. I'll also talk about a decision I made regarding the number of levels, and have another new piece of music.

Score
Implemented scoring this week, so now when the player kills an enemy, or collects a coin their score goes up. Score is saved per level, so each level has its own high score, instead of their being a total overall score that carries on from level to level. I will be adding a level selection screen to the game, similar to what is present in Super Meat Boy, so that is a big part of the basis for score being individual to each level. So players will be able to replay any level they like, in order to try and beat their highest score. While it is implemented, I still need to compare the score earned against the current high score before saving it out to file.

Rendering the score was slightly tricky, as I don't want to render just straight text, as the SDL library I'm using for text is a bit slow when compared to normal sprite rendering. So I decided to use a sprite sheet, containing the digits 0-9, and use that instead. In order to do this, I need to pull out each individual digit from the number, and then render each individual digit. Pulling each individual digit out out of the integer is the tricky part, but I remembered having covered this in a class somewhere, so a quick google to refresh my memory and it was all done pretty easily. Ended up with code that looks a bit like what is listed below. If you've got any questions about it, feel free to poke me on Twitter.

tempScore = currentScore; // save the current score into a new temporary variable as we'll be modifying it
lastDigit = tempScore % 10; // the modulus operation gives us the last digit of the score
numbersSprite->setClip(numbersArray[lastDigit]); // each number from 0-9, matches an array index of clipping areas for the number spritesheet
numbersSprite->setPosition(position); // set the position to render at
numbersSprite[lastDigit]->Render(); // render the number
tempScore /= 10; // divide by 10 to shift the score 1 decimal point to the right. Using integers to everything after the decimal is lost.
position.x -= spriteWidth; // change the position for the next digit, rendering from right to left


This is repeated until tempScore is 0, at which point we have finished rendering the current score and can stop. This kind of code is like magic and makes me feel like a wizard.

Decisions
After thinking about it for a while, I decided to cut the total number of levels from 40 to 20 this week. In one of my earlier blogs I talked about the variety of environmental hazards and enemy types I wanted to include. I've come to the realisation recently that I probably don't have time to implement more than what I already have. This is all fine and good, as I expected I might have to cut some things in order to complete the game on time, but how would I fill out 40 levels with the current mechanics?

Currently, I have one enemy type, moving platforms as a level mechanic, and water as an environmental hazard. I might have time to implement some quicksand as another environmental hazard, but what would 40 levels of this be like? I think it would be pretty boring, if nothing new is introduced occasionally from level 1 all the way to level 40. I already have 17 levels designed on paper, so cutting the total to 20 makes sense, and it's also a nice round number.

I'd also been planning on implementing a timer, with a lower time resulting in a higher score, but I'm not sure I'll have time to implement this either.

Music
New piece of music, for the zombie pirate fort area of the game.

Oops, looks like your browser doesn't support the audio tag yet. You can download the file manually: http://swashbucklinstudios.com/wp-content/uploads/2014/04/Fort-area.mp3

If you're interested in more music from the artist, he has a website over at Eternal Vibration that you can check out.

What's Next?
Next week I'll be tidying up the visual side of the score a little, and start implementing sound. Would've like to have the score side completely done this week, but I've been a bit busy outside work, looking at houses and preparing to move.

Keep up to date!
Be sure to follow me on Twitter, and like the Facebook page to stay up to date on future content and blog posts when they happen. If you have any questions don't hesitate to ask, either through Twitter or Facebook! You can also check out the blog, previous posts, screenshots and videos over at my site.

JieXian
Profile Blog Joined August 2008
Malaysia4677 Posts
Last Edited: 2014-04-12 06:53:25
April 12 2014 06:52 GMT
#2
woow it's Pebble's music!!
Please send me a PM of any song you like that I most probably never heard of! I am looking for people to chat about writing and producing music | https://www.youtube.com/watch?v=noD-bsOcxuU |
EatThePath
Profile Blog Joined September 2009
United States3943 Posts
April 12 2014 17:58 GMT
#3
This is repeated until tempScore is below 0, at which point we have finished rendering the current score and can stop.

Do you mean less than 1? Otherwise dividing by ten will never get you below 0 right? And yes I love that modulo 10 trick. ^^
Comprehensive strategic intention: DNE
Soan
Profile Blog Joined August 2010
New Zealand194 Posts
April 13 2014 00:12 GMT
#4
Dividing by ten will get me to 0, in a way, as I'm using integers. So when I divide by 10 and it becomes 0.123 for example, the .123 is lost and I get 0. Guess I should edit it to clarify that.
EatThePath
Profile Blog Joined September 2009
United States3943 Posts
April 13 2014 00:19 GMT
#5
On April 13 2014 09:12 Soan wrote:
Dividing by ten will get me to 0, in a way, as I'm using integers. So when I divide by 10 and it becomes 0.123 for example, the .123 is lost and I get 0. Guess I should edit it to clarify that.

oh I'm a dummy and skipped that part. yeah ees gut :D
Comprehensive strategic intention: DNE
Please log in or register to reply.
Live Events Refresh
Next event in 14h 55m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
mouzHeroMarine 558
UpATreeSC 108
Railgan 39
Codebar 34
StarCraft: Brood War
Hyuk 1189
EffOrt 377
Backho 86
Free 20
scan(afreeca) 14
NaDa 5
Dota 2
monkeys_forever257
capcasts54
Counter-Strike
Stewie2K301
kRYSTAL_27
Super Smash Bros
Chillindude33
Heroes of the Storm
Liquid`Hasu462
Other Games
Grubby3632
FrodaN2128
fl0m1135
Beastyqt626
Skadoodle297
ToD124
Trikslyr49
ViBE36
Mew2King34
QueenE32
Organizations
Counter-Strike
PGL238
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• Hupsaiya 21
• davetesta3
• intothetv
• AfreecaTV YouTube
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• 80smullet 25
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota257
Other Games
• imaqtpie1281
• Shiphtur196
Upcoming Events
WardiTV Invitational
14h 55m
Online Event
19h 55m
RSL Revival
1d 5h
RSL Revival
1d 13h
WardiTV Invitational
1d 14h
OSC
1d 18h
SKillous vs goblin
Spirit vs GgMaChine
ByuN vs MaxPax
Afreeca Starleague
2 days
Snow vs Soma
Sparkling Tuna Cup
2 days
WardiTV Invitational
2 days
CrankTV Team League
2 days
[ Show More ]
RSL Revival
2 days
Wardi Open
3 days
CrankTV Team League
3 days
Replay Cast
4 days
WardiTV Invitational
4 days
CrankTV Team League
4 days
Replay Cast
5 days
CrankTV Team League
5 days
Replay Cast
6 days
The PondCast
6 days
CrankTV Team League
6 days
Liquipedia Results

Completed

Acropolis #4 - TS2
WardiTV TLMC #15
HCC Europe

Ongoing

BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
C-Race Season 1
IPSL Winter 2025-26
EC S1
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual

Upcoming

SC4ALL: Brood War
BSL Season 21
BSL 21 Team A
BSL 21 Non-Korean Championship
RSL Offline Finals
RSL Revival: Season 3
Stellar Fest
SC4ALL: StarCraft II
CranK Gathers Season 2: SC II Pro Teams
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.