• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 07:35
CEST 13:35
KST 20:35
  • 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
[ASL20] Ro24 Preview Pt2: Take-Off7[ASL20] Ro24 Preview Pt1: Runway132v2 & SC: Evo Complete: Weekend Double Feature4Team Liquid Map Contest #21 - Presented by Monster Energy9uThermal's 2v2 Tour: $15,000 Main Event18
Community News
Weekly Cups (Aug 18-24): herO dethrones MaxPax6Maestros of The Game—$20k event w/ live finals in Paris30Weekly Cups (Aug 11-17): MaxPax triples again!13Weekly Cups (Aug 4-10): MaxPax wins a triple6SC2's Safe House 2 - October 18 & 195
StarCraft 2
General
Geoff 'iNcontroL' Robinson has passed away A Eulogy for the Six Pool Weekly Cups (Aug 18-24): herO dethrones MaxPax 2v2 & SC: Evo Complete: Weekend Double Feature The GOAT ranking of GOAT rankings
Tourneys
WardiTV Mondays Maestros of The Game—$20k event w/ live finals in Paris RSL: Revival, a new crowdfunded tournament series Sparkling Tuna Cup - Weekly Open Tournament Monday Nights Weeklies
Strategy
Custom Maps
External Content
Mutation # 488 What Goes Around Mutation # 487 Think Fast Mutation # 486 Watch the Skies Mutation # 485 Death from Below
Brood War
General
No Rain in ASL20? Joined effort [ASL20] Ro24 Preview Pt2: Take-Off BW General Discussion Flash On His 2010 "God" Form, Mind Games, vs JD
Tourneys
[ASL20] Ro24 Group F [IPSL] CSLAN Review and CSLPRO Reimagined! [Megathread] Daily Proleagues [ASL20] Ro24 Group E
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates [G] Mineral Boosting Muta micro map competition
Other Games
General Games
General RTS Discussion Thread Stormgate/Frost Giant Megathread Nintendo Switch Thread Dawn of War IV Path of Exile
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread Things Aren’t Peaceful in Palestine The year 2050 European Politico-economics QA Mega-thread
Fan Clubs
INnoVation Fan Club SKT1 Classic Fan Club!
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece [\m/] Heavy Metal Thread
Sports
Formula 1 Discussion 2024 - 2026 Football Thread TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
High temperatures on bridge(s) Gtx660 graphics card replacement Installation of Windows 10 suck at "just a moment"
TL Community
The Automated Ban List TeamLiquid Team Shirt On Sale
Blogs
Evil Gacha Games and the…
ffswowsucks
Breaking the Meta: Non-Stand…
TrAiDoS
INDEPENDIENTE LA CTM
XenOsky
[Girl blog} My fema…
artosisisthebest
Sharpening the Filtration…
frozenclaw
ASL S20 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1304 users

Game Programming: Part Two - Page 4

Blogs > CecilSunkure
Post a Reply
Prev 1 2 3 4 All
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
March 09 2012 20:41 GMT
#61
On March 08 2012 19:17 e-Goh wrote:
Hi ShadowWolf,

I'd pretty much agree with you. For those starting out, it doesn't matter what language you pick, be it C, C++, C#, Java, Python or whatever. You can write, object-oriented C, or non-object-oriented C++. It's up to the programmer how he executes his algorithms. Much like how exact build orders don't matter all that much to bronze leaguers, if the code is bad enough, the nuances of language architecture don't matter.

However, that being said, it's pretty obvious you're not a beginner, but are nevertheless looking for something more to chew on. Game programming, as opposed to application programming, largely focuses on how much performance you can eke out, oftentimes at the cost of convenience for the programmer or elegance of the code. The way modern computer architecture has been progressing, the main bottlenecks we generally face are not the speed in executing algorithms (cpus are quite fast), but memory accesses and management.

If you are writing for the PC, it doesn't really matter because gamers have humungous amounts of memory and caches the size of whales. It only becomes more of a concern when dealing with consoles, or mobile devices where the hardware is much more limited.

The reason why game developers are not the biggest fan of STL is because it does a huge amount of alloc/deallocs on the heap during runtime. I've seen a single std::string initialization make 20 small allocations at once! This causes memory to fragment and results in less memory being available. Imagine memory pockmarked with 16kB holes while trying to allocate 4MB. All that memory in the holes aren't available because they aren't big enough to accomodate the new allocation. We much prefer pre-allocated fixed-size memory pools/containers when possible.

Lately, there's also been a movement against inheritance in general. The strength of C++ has always been that it naturally causes data that gets used together (i.e. in an object) be located close together in memory. However, when working repetitive operations on a set of many objects (e.g. updating the x, y, z position of all game objects), it thrashes the cache with all the superfluous data. Instead of one memory fetch retrieving 16 sets of useful coordinates, it now only retrieves one, simply because of the way memory is arranged.

The name of this new movement is dubbed data-oriented programming (as opposed to object-oriented though they are not mutually exclusive), and is by and large championed by a fellow called Mike Acton. Google him to find out more, but just be warned he can be a wee bit overzealous. It just so happens that straight C lends itself more to this style of programming, though there's no compelling reason why it can't be accomplished in C++ as well. It is a non-intuitive approach though, which can be unsettling for a generation of programmers brought up on pure OOP, myself included.

I hope that gave you some food for thought. Programming is like a never-ending learning adventure!

Pretty interesting post, thanks for taking the time to write this!
ShadowWolf
Profile Joined March 2010
United States197 Posts
March 10 2012 00:15 GMT
#62
Sorry, I lost track of this thread - if CecilSunkure hadn't responded I probably wouldn't have remembered to reply.

Interesting thoughts e-Goh. While (ignoring VC6 cuz it's terrible) I'm not specifically familiar with an implementation of STL that would allocate 20 small 4kb pieces for a string, I know that some consoles, my understanding is that especially the PS3, don't really handle heap allocations very well and you have to be super-careful and micro-manage every single access to the heap regardless of how big or small it tends to be.

There was an interesting push for data-oriented programming when I was in college, too. It really was lead by people whose ideas were terrible, so I had some natural bias against it but I did look around a little bit and I see some areas where it could be of great assistance. I read this PDF, which really seemed to do a good job: http://www.rti.com/whitepapers/Data-Oriented_Architecture.pdf.

To be honest, I think this is where a multi-paradigm language such as C++ really shines because you can have segments of your application using a more traditional OOP style mixed with areas of your application that focus on the data-driven design and then use more of the functional/template driven design patterns as the glue to bring the worlds together in a generic way without either having to be exposed to the nasty bits of the other. For example, I really like how DDP aligns better with parallelism and alleviates some of the nastiness and slowness that constantly handling concurrency can cause you but I would be apprehensive to say that it's a superior overall architectural design. However, the nature of C++ allows you to use the best parts of each from a pure point of view and really put together a strong architecture.

Your point about inheritance is interesting to me because I find it hilarious how often (especially games) misuse or overuse inheritance where even basic composition would make things so much easier to understand. For whatever reason, application and game developers seem absolutely obsessed with enormous inheritance chains that accomplish little beyond making things almost impossible to understand and removing any semblance of type safety. The Half-Life SDK is a great example of this phenomenon. I've always chatted with coworkers and discussed their use of inheritance and whether they consider other techniques to build what they're trying to build that would reduce those chains and possibly even provide opportunities for further growth. It's almost ironic that inheritance chains seem to end up a funny way that code becomes coupled.

At any rate, yeah - I always love learning new things. I've built a few games in the past, but never been happy with them. It's one of those things I've always been interested in doing but something I've never been interested in completing I guess. After I kinda build up the core systems I seem to lose interest really fast for whatever reason.

But I mean, the code I work on has either dealt with huge data structures or had very narrow windows in which action was possible. I've always enjoyed trying to squeeze every bit of performance out of something and try to make it fit in a tiny window, which is why I'm looking forward to hopefully receiving my raspberry pi sometime in the near future. I wrote a horrible shell of an OS a long time ago, so I was thinking about giving that another go just on a hobby level :-D
Prev 1 2 3 4 All
Please log in or register to reply.
Live Events Refresh
Afreeca Starleague
10:00
Round of 24 / Group F
hero vs Alone
Royal vs Barracks
Afreeca ASL 8371
sctven
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Harstem 272
StarCraft: Brood War
Britney 31050
Calm 12217
Sea 3247
Jaedong 2943
Bisu 2720
Rain 2130
Flash 1908
Horang2 1563
BeSt 734
EffOrt 637
[ Show more ]
actioN 501
ZerO 397
Pusan 353
Mini 296
Larva 270
ggaemo 194
Hyun 193
Mong 172
Soulkey 142
Last 126
Hyuk 114
Backho 84
PianO 72
ToSsGirL 59
Liquid`Ret 41
TY 39
soO 36
Killer 36
JYJ35
Sharp 35
Icarus 22
ajuk12(nOOB) 19
Sacsri 18
Terrorterran 14
NaDa 13
Sexy 13
JulyZerg 12
SilentControl 10
scan(afreeca) 10
HiyA 8
ivOry 6
Beast 3
Light 0
Dota 2
Dendi607
qojqva545
XaKoH 335
BananaSlamJamma195
XcaliburYe149
KheZu57
Counter-Strike
olofmeister1852
fl0m1774
x6flipin495
edward32
Other Games
singsing2061
B2W.Neo1155
crisheroes325
Pyrionflax325
Fuzer 267
SortOf157
ArmadaUGS34
Dewaltoss23
MindelVK9
Organizations
StarCraft: Brood War
UltimateBattle 215
lovetv 8
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 14 non-featured ]
StarCraft 2
• StrangeGG 64
• LUISG 29
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV263
League of Legends
• Jankos795
Upcoming Events
Replay Cast
12h 25m
The PondCast
22h 25m
WardiTV Summer Champion…
23h 25m
Clem vs Classic
herO vs MaxPax
Replay Cast
1d 12h
LiuLi Cup
1d 23h
MaxPax vs TriGGeR
ByuN vs herO
Cure vs Rogue
Classic vs HeRoMaRinE
Cosmonarchy
2 days
OyAji vs Sziky
Sziky vs WolFix
WolFix vs OyAji
BSL Team Wars
2 days
Team Hawk vs Team Dewalt
BSL Team Wars
2 days
Team Hawk vs Team Bonyth
SC Evo League
3 days
TaeJa vs Cure
Rogue vs threepoint
ByuN vs Creator
MaNa vs Classic
Maestros of the Game
3 days
ShoWTimE vs Cham
GuMiho vs Ryung
Zoun vs Spirit
Rogue vs MaNa
[ Show More ]
[BSL 2025] Weekly
3 days
SC Evo League
4 days
Maestros of the Game
4 days
SHIN vs Creator
Astrea vs Lambo
Bunny vs SKillous
HeRoMaRinE vs TriGGeR
BSL Team Wars
4 days
Team Bonyth vs Team Sziky
BSL Team Wars
4 days
Team Dewalt vs Team Sziky
Monday Night Weeklies
5 days
Replay Cast
5 days
Sparkling Tuna Cup
5 days
Liquipedia Results

Completed

CSLAN 3
uThermal 2v2 Main Event
HCC Europe

Ongoing

Copa Latinoamericana 4
BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Qualifiers
ASL Season 20
CSL Season 18: Qualifier 1
Acropolis #4 - TS1
CSL Season 18: Qualifier 2
SEL Season 2 Championship
WardiTV Summer 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025

Upcoming

CSL 2025 AUTUMN (S18)
LASL Season 20
BSL Season 21
BSL 21 Team A
Chzzk MurlocKing SC1 vs SC2 Cup #2
RSL Revival: Season 2
Maestros of the Game
EC S1
Sisters' Call Cup
IEM Chengdu 2025
PGL Masters Bucharest 2025
MESA Nomadic Masters Fall
Thunderpick World Champ.
CS Asia Championships 2025
Roobet Cup 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 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.