• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 12:18
CET 18:18
KST 02:18
  • 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
RSL Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
Weekly Cups (Dec 15-21): Classic wins big, MaxPax & Clem take weeklies3ComeBackTV's documentary on Byun's Career !10Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win4Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump1Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2
StarCraft 2
General
What's the best tug of war? The Grack before Christmas Weekly Cups (Dec 15-21): Classic wins big, MaxPax & Clem take weeklies ComeBackTV's documentary on Byun's Career ! Micro Lags When Playing SC2?
Tourneys
OSC Season 13 World Championship $5,000+ WardiTV 2025 Championship $100 Prize Pool - Winter Warp Gate Masters Showdow Sparkling Tuna Cup - Weekly Open Tournament Winter Warp Gate Amateur Showdown #1
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 505 Rise From Ashes Mutation # 504 Retribution Mutation # 503 Fowl Play Mutation # 502 Negative Reinforcement
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ Recommended FPV games (post-KeSPA) BW General Discussion FlaSh on: Biggest Problem With SnOw's Playstyle soO on: FanTaSy's Potential Return to StarCraft
Tourneys
Small VOD Thread 2.0 [Megathread] Daily Proleagues [BSL21] LB QuarterFinals - Sunday 21:00 CET [BSL21] WB SEMIFINALS - Saturday 21:00 CET
Strategy
Simple Questions, Simple Answers Game Theory for Starcraft Current Meta Fighting Spirit mining rates
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Beyond All Reason Path of Exile General RTS Discussion Thread
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
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas Survivor II: The Amazon Sengoku Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread The Games Industry And ATVI Russo-Ukrainian War Thread How Does UI/UX Design Influence User Trust? Things Aren’t Peaceful in Palestine
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List TL+ Announced Where to ask questions and add stream?
Blogs
National Diversity: A Challe…
TrAiDoS
I decided to write a webnov…
DjKniteX
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2179 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
Big Brain Bouts
17:00
#103
Elazer vs Nicoract
Reynor vs Scarlett
RotterdaM632
IndyStarCraft 79
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 632
SKillous 190
BRAT_OK 90
IndyStarCraft 79
MindelVK 23
StarCraft: Brood War
Rain 5154
Sea 4396
EffOrt 978
ggaemo 288
Shuttle 197
Mini 182
Sharp 169
Barracks 114
Snow 106
JYJ 76
[ Show more ]
hero 74
Hyun 71
Terrorterran 34
PianO 33
Sexy 21
yabsab 18
Shine 10
HiyA 10
JulyZerg 7
SilentControl 7
Bale 6
Dota 2
qojqva5362
XcaliburYe596
Fuzer 225
LuMiX1
League of Legends
Trikslyr45
Heroes of the Storm
Khaldor241
Other Games
singsing2058
B2W.Neo1022
crisheroes351
DeMusliM334
Beastyqt214
XaKoH 82
C9.Mang063
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• HeavenSC 17
• 3DClanTV 16
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Michael_bg 11
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota2140
Other Games
• Shiphtur172
Upcoming Events
Replay Cast
7h 42m
Sparkling Tuna Cup
1d 16h
Krystianer vs TBD
TriGGeR vs SKillous
Percival vs TBD
ByuN vs Nicoract
OSC
2 days
Replay Cast
2 days
Wardi Open
2 days
OSC
3 days
Solar vs MaxPax
ByuN vs Krystianer
Spirit vs TBD
OSC
6 days
Liquipedia Results
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.