• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 05:52
CEST 11:52
KST 18:52
  • 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
Team TLMC #5: Winners Announced!3[ASL20] Ro8 Preview Pt2: Holding On9Maestros of the Game: Live Finals Preview (RO4)5TL.net Map Contest #21 - Finalists5Team TLMC #5: Vote to Decide Ladder Maps!0
Community News
5.0.15 Patch Balance Hotfix (2025-10-8)60Weekly Cups (Sept 29-Oct 5): MaxPax triples up3PartinG joins SteamerZone, returns to SC2 competition285.0.15 Balance Patch Notes (Live version)119$2,500 WardiTV TL Map Contest Tournament 154
StarCraft 2
General
TL.net Map Contest #21 - Finalists PartinG joins SteamerZone, returns to SC2 competition 5.0.15 Patch Balance Hotfix (2025-10-8) Geoff 'iNcontroL' Robinson has passed away Classic Games #3: Rogue vs Serral at BlizzCon
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament SC2's Safe House 2 - October 18 & 19 RSL Offline Finals Dates + Ticket Sales! SC4ALL $6,000 Open LAN in Philadelphia $2,500 WardiTV TL Map Contest Tournament 15
Strategy
Custom Maps
External Content
Mutation # 494 Unstable Environment Mutation # 493 Quick Killers Mutation # 492 Get Out More Mutation # 491 Night Drive
Brood War
General
Any rep analyzer that shows resources situation? Whose hotkey signature is this? BW General Discussion BGH Auto Balance -> http://bghmmr.eu/ I'm making videos again
Tourneys
[Megathread] Daily Proleagues [ASL20] Ro8 Day 4 Small VOD Thread 2.0 [ASL20] Ro8 Day 3
Strategy
BW - ajfirecracker Strategy & Training Siegecraft - a new perspective TvZ Theorycraft - Improving on State of the Art Current Meta
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread ZeroSpace Megathread Dawn of War IV Path of Exile
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
SPIRED by.ASL Mafia {211640} TL Mafia Community Thread
Community
General
US Politics Mega-thread The Games Industry And ATVI Stop the Construction YouTube Thread Things Aren’t Peaceful in Palestine
Fan Clubs
The herO Fan Club! The Happy Fan Club!
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023 NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023
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
Inbreeding: Why Do We Do It…
Peanutsc
From Tilt to Ragequit:The Ps…
TrAiDoS
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1222 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
Next event in 8m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
mouzHeroMarine 387
SortOf 132
StarCraft: Brood War
Larva 988
Shuttle 926
Hyuk 691
Mini 293
PianO 287
Leta 287
Stork 228
Pusan 202
sSak 88
EffOrt 85
[ Show more ]
ToSsGirL 64
Sharp 58
Sacsri 54
Backho 53
Yoon 38
Movie 35
soO 33
yabsab 26
Shine 26
NotJumperer 23
Free 17
ivOry 13
ajuk12(nOOB) 10
Dota 2
XcaliburYe954
Counter-Strike
Stewie2K1044
allub298
Super Smash Bros
Westballz22
Heroes of the Storm
Khaldor248
Other Games
singsing1590
Mew2King46
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• LUISG 35
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV9
League of Legends
• Jankos2093
• Stunt516
• HappyZerGling151
Upcoming Events
Sparkling Tuna Cup
8m
CranKy Ducklings3
Map Test Tournament
1h 8m
Zoun vs Spirit
Reynor vs herO
Clem vs MaxPax
OSC
2h 8m
IPSL
9h 8m
Bonyth vs Art_Of_Turtle
Razz vs rasowy
Afreeca Starleague
1d
Barracks vs Snow
Afreeca Starleague
2 days
Soma vs Bisu
OSC
2 days
OSC
2 days
The PondCast
4 days
OSC
4 days
[ Show More ]
CranKy Ducklings
6 days
Safe House 2
6 days
Liquipedia Results

Completed

Acropolis #4 - TS2
Maestros of the Game
HCC Europe

Ongoing

BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
C-Race Season 1
IPSL Winter 2025-26
WardiTV TLMC #15
EC S1
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
IEM Cologne 2025

Upcoming

SC4ALL: Brood War
BSL Season 21
BSL 21 Team A
RSL Offline Finals
RSL Revival: Season 3
Stellar Fest
SC4ALL: StarCraft II
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 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.