Feedback loop

Original Author: Kyle-Kulyk

Android Marketplace, plug..plug..plug).  I thought I’d take a moment to highlight how some of the feedback we received changed our game during development.

“It looks like a grave yard” 

Itzy3D was always about creating from the beginning.  The central idea that the entire game was based on was that users like to create things, they like to draw, they like to make patterns, and they like to feel like they have an impact on the game world they’re part of.  In Itzy3D’s case we gave the player the opportunity to create spider webs of various shapes and sizes, enough to complete a level and advance in the game.  However our core group is made up of programmers, not artists and as we looked at other indie games like Feist, Limbo and Pixeljunk Eden, we liked the idea of a muted or shades of grey color scheme and the plan was to bring color to the levels with multicolored fireflies and spinning multicolored webs.  The webs were quickly ditched.  They looked awful.  Rainbow spider-webs seemed so good in my head, but in reality it just didn’t play out.  Add to that, our 3D, shades of grey layout made it nearly impossible to distinguish the background from the foreground which made it hard for users to figure out just where they should be making their webs.

Itzy3D Before

Itzy3D After

“Give me a way to kill those buggers”

Another idea we had from the onset was that Itzy3D should be a relaxed, casual and user-friendly title.  We didn’t want users to feel they had failed playing the game.  We wanted each play through to be fun, but relaxed fun rather than hectic fun.  One of the main enemies in the game is the wasps which zoom around each level before spotting Itzy and attacking.  Rather than take away a life or lead to a game over scenario, we simply had them knock Itzy down if he wasn’t hidden and remove a portion of his available web.  So we threw in an enemy that could never be defeated, much like the old Qix arcade game that had inspired Itzy.

We had no idea just how frustrating gamers would find this decision until our demo was released and we started to receive feedback about the inability to mount any offense whatsoever.  And it was from this feedback that Itzy received a system of power-ups based on the color of large fireflies caught.  Now, aside from other power-ups such as improved speed and web stretch, Itzy could also freeze his enemies in place, listening to them buzz furiously or actually take the fight to the enemies for a limited time much like Pac-Man powering up, but instead of eating the wasps he incapacities them temporarily with his mighty, Kung-Fu Punch!

“Monkey Factor 5”

I had the opportunity to sit down for coffee with a game industry vet and ex-Bioware employee who offered up this piece of gaming wisdom that has stuck with me.  When discussing game controls, ease of use is king.  While we thought our controls were simple enough, he asked “Yes.  But are they Monkey Factor 5 simple?”  The answer was a resounding no.  For the sake of variety we built-in a few different moves for the player to interact with Itzy’s world.  One problem, that was pointed out to us more than once was that we had two different controls for web spinning.  A swipe started Itzy spinning a web strand; a tap on Itzy anchored the web strand.  Watching people play Itzy, what we thought was straight forward always seemed to trip up players.  They would swipe to start and then swipe, expecting it to anchor the web to an object.  Or they’d swipe, then figure out the tapping, but then try tapping again when starting a new web.  There was no reason to have two separate motions for web spinning.  The two moves seemed simple enough, but they certainly weren’t “Monkey Factor 5” simple.  Now, spinning webs is easy.  You simply tap Itzy to anchor the web strands, stretch them out and anchor by tapping again.

“I’ve been playing for a minute already and I haven’t even seen your main character”

We struggled with the tutorial.  Like the controls, we thought our game was simple enough yet realized that we had a lot going on that needed to be explained somewhere.  We originally weren’t even planning on including a tutorial, but no one would read our instructions included and ultimately would play the game without any idea as to what they were meant to do.  So we included a small tutorial level that the player needed to complete to move on to the meat of the game.  We included our instructions as slides within the tutorial and we felt the need to explain absolutely everything.

We realize now, there were so many things wrong with that idea.  No one likes to read walls of text, first off.  They just skip through so we might as well have not had anything.  Secondly, it’s not a game at this point.  As a helpful developer offered, when you begin the game you’re immediately hit with walls of text.  Games should make an impact immediately and our game had you reading text before we were even introduced to the main character.

The tutorial never satisfied any of us but we just couldn’t put our fingers on what was wrong and through the feedback we revamped the tutorial to encourage the gamers to explore and learn the game mechanics through play, not through walls of text.

We’re indebted to our fans and to the developer community for their continued feedback on our games.  Time is a valuable commodity for everyone, so it means a lot to us to those of you who have offered your time to help us create better products.  Cheers!

The Craft of Game Systems: Tuning RPG Content

Original Author: Daniel Achterman

This article primarily focuses on PvE combat in RPGs, though its methods can be applied to PvP or other types of games.

Role playing games have a tremendous amount of content, each piece with multiple parameters that define what they do in combat. Damage dealt by a sword, bonus granted by a skill, total health of a level 23 bandit, etc. It’s not too hard to tune content when you look at a single game zone or a fixed character level – you can playtest that area and tweak values until the game feels right. However, trying to tune values for a giant world with 100 levels of content and multiple classes is much more complicated. How do you choose values for RPG content without playtesting and brute force tuning every type of character at every level?
Diablo III Demon Hunter Progression
Many factors increase character power as they level up in games like Blizzard’s Diablo III.

A computational approach can help you quickly generate first pass values for these massive amounts of content. The method is to calculate how each piece of content affects a character’s effectiveness in combat and express that “power” in terms of a universal unit. That allows you to compare very different types of content in a mostly apples-to-apples way, enabling you to do a variety of powerful things:

  • Compare different classes and tune them relative to each other.
  • Identify items or abilities that are likely to be unbalanced.
  • Determine what stats enemies need to be a good challenges for characters.
  • Solve for the parameter values of a skill or item to make it as powerful as it should be.

That last one is especially important. Not guessing. Solving. (then tweaking)

It’s not an exact process. It requires a lot of estimating and approximating, and it can’t be done for certain types of content. However, where it does work, you can use it to rapidly generate parameter values that will be about 80% right.

The Method

Here are the steps:

  1. Implement your core minute-to-minute gameplay. Creating a progression of content won’t help If the game doesn’t play the way you want it to, and you’ll have to redo the work after you fix your core gameplay. Create a vertical slice of your game that plays the way you want.
  2. Design the stats that define the “base power” of a character of level X. “Base power” is defined by the stats that improve steadily as a character levels up and which are not influenced by player choice, such as health, base damage, expected armor, or THAC0.
  3. Identify other game content that magnifies a character’s combat effectiveness as he levels up. This can include systems like item modifiers, skills, WoW’s ability glyphs, or LoL’s runes. These combine to give the character’s “total power”.
  4. For each piece of content, determine how to express its value as a percentage modifier to a character’s base power. For instance, a 2% damage bonus increases a character’s power by 2%. “Percentage bonus to base power” is the universal unit you’ll use to compare different types of content.
  5. Choose what impact you would like each type of content to have on total character power as the character levels up. Should each skill point increase a character’s base power by 5%, so they’re twice as powerful after spending 20 points?
  6. Given each piece of content’s intended effectiveness, solve for its parameters. If you know the intended bonus to base power you want a piece of content to grant, and you know how to calculate its power from its parameters, you can work backward to solve for its parameters.

Base Power

Defining base power is something I struggle with because it’s so specific to each game. The best definition I’ve found is that it’s the combination of all character stats that increase automatically as a character levels up, without involving any choice by a player. Examples include things like character health or THAC0 in D&D. WoW characters get a fixed set of stat points when they level up, and skills increase steadily in effectiveness.

Expected damage per second and armor are also part of base power. Though these don’t increase automatically (the player has to find new gear), game content tends to be designed with the expectation that players are maintaining up-to-date gear. Games like WoW assume that players are using items with appropriate for their level, so unmodified item stats are part of base power.

Power Magnifiers

Power magnifiers are pieces of content that modify a character’s base power in combat. Their significance to his overall power generally grows as he levels up. Here are some examples:

  • Skill Points or Talent Points. Each point increases character power by a percentage.
  • Item Modifiers in tons of RPGS. They get more numerous / significant at higher levels.
  • Materia in Final Fantasy VII. Players get more powerful Materia and can use more at once as they progress through the game.

Materia in Final Fantasy VII at different levels.
The impact of Materia on FFVII character power increases as they gain more slots and more powerful Materia.

Players generally get to choose which power magnifiers they want to take to customize their character, and different classes use different power magnifiers. They key to balancing classes against each other is to ensure their available power magnifiers have equivalent effectiveness.

Power Magnifier Value as a Percentage of Base Power

Express the value of a power magnifier as a percentage of a character’s base power. “Percentage bonus to base power” is the universal unit to use to compare different types of bonuses. Since all power modifiers are relative to base power, I like to define base power at any level as 1.0, for 100%. An unmodified level 1 character has a base power of 1.0, and so does an unmodified level 54 character. If a power magnifier increased a character’s effectiveness by 5%, it would have a value of 0.05.

To translate a bonus to “effectiveness”, calculate how much it increases the damage a character does in a fight before he is killed. So, a bonus that keeps him in a fight twice as long would double his effectiveness and have a value of 1.0 (because it is a bonus of 100%).

A particular power magnifier generally becomes available at a certain level, and is tuned to be appropriate for that level. For instance, see the “Affix Level” values in this chart of Diablo II item affixes. Determine its percentage value relative a character’s base stats at the level it is intended for. Some examples:

Percentage Damage Bonus

Imagine a skill that increases character melee damage by 1%. Since this is presumably a skill for melee characters, assume they always get its benefit; so it has a value of 0.01.

Conditional Damage Bonus

A sword has a modifier that gives it a 5% chance to deal 30 bonus damage on an attack. This is an average of 1.5 damage per attack. If base damage per attack is 100, then its value is 0.015.

Percentage Health Bonus

A 10% bonus to health increases the time that a character stays alive by 10%, thus increasing the damage he does in a fight by 10%, so it has a value of 0.1.

Armor Bonus

Say an armor bonus would improve a character’s damage resistance from taking 75% damage from an attack to taking 72%. This means he is taking 72 / 75 = 96% as much damage as he was before, multiplying his survival time by 1 / 0.96 = 1.04 times. Thus, the bonus value is 0.04.

Total Power

Each power magnifier that a character gets adds to his base effectiveness in combat. His total power is equal to the sum of his base power and all those magnifiers:

Total Power = Base Power + All Power Magnifiers

Power is relative to character level, so it’s more precise to write:

Total Power at Level X = Base Power at Level X + All Power Magnifiers at Level X

Remember, base power at any level is defined as 1.0. Thus, a level X character’s total power is the number of times more powerful he is than an unmodified level X character.

Planning a Progression of Total Power

Total power is what designers care about when tuning stats for content that opposes players, like monsters. As a designer, choose what value you want your game’s various power magnifiers to add to character effectiveness over the course of the game.

Systems can add power at different rates. A skill system might add 1% to total power each level. Unlocking a new ability might add a big chunk at a specific milestone. Players will focus most on content that has the biggest impact on their power, so assign systems value based on how central they are to your game design.

Here’s an example of how a total power progression could look. At level 1, no power magnifiers are in effect, so total power is equal to base power:

Total Power at Level 1 = 1.0

At level 10, the player has 9 skill points, each worth 0.01. He also has bonuses from item modifiers that increase his power by a total of 5%.

Total Power at Level 10 = 1.0 + 0.09 + 0.05 = 1.14

At level 25, the player now has 24 skill points, his item modifiers are now worth about 27%, and he’s unlocked a super power that increases power by another 20%:

Total Power at Level 25 = 1.0 + 0.24 + 0.27 + 0.2 = 1.71

In other words, a normal level 30 character is 1.71 times as powerful as a level 30 character with unmodified gear, no skill points spent, and who doesn’t use his super power. We can even chart out his total power over time:
Power Progression

In this chart, skills add a linear bonus to power, item modifiers add a gradual quadratic bonus, and ability unlocks add chunks of power every few levels. The purple line shows the total power of a character at each level, and that’s what monsters should be tuned against.

Solving for the Value of a Power Magnifier

Now that you’ve defined the expected power progression for characters in your game, you can look up the intended power value of any particular piece of content. For instance, if a level X character should get a 0.05 * X bonus in power from item modifiers, and is likely to have 10 modifiers on his equipment, then a level X modifier should increase power by 0.005 * X.

Once you know the intended power of a piece of content, do the math backwards to solve for parameter values that will give the content the intended power. Here are two examples:

Conditional Damage Bonus

A level 10 sword has a modifier that gives it a 5% chance to deal X bonus damage on an attack. Say the intended power of a level 10 modifier is 0.06, and the base damage per attack is 100. Thus, it should deal an average of 0.06 * 100 = 6 bonus damage per attack. Divide by the chance of dealing damage to find X. X = 6 / 0.05 = 120 damage.

Armor Bonus

A level 10 helmet has a modifier that increases armor. The intended power of a level 10 modifier is 0.06. For an armor bonus, this means the character should survive 1.06 times as long. Therefore, he should take 1 / 1.06 = 0.94 times as much damage with the modifier as without. Assuming a base character takes 75% damage from an attack, the modifier should be high enough to reduce damage taken to 0.94 * 75 = 70.5%.

Caveats / Where Doesn’t This Method Work?

This method is best suited for PvE combat in RPGs. Though it can be applied to other types of games, there are some game designs for which it’s simply not a good fit. For example, it would be difficult to apply to action games where damage taken and received vary dramatically with player skill. Imagine an RPG where combat is based on regularly stunning or knocking away foes. It may not be possible to make sufficiently accurate value estimations in those games.

It can also be difficult to apply this method to game content whose value is not easily enumerated. Examples include bonuses to:

  • Projectile weapon or spell range
  • Movement speed
  • Healing power
  • Total mana.

In the case of bonuses like the above, you can either make a sophisticated mathematical model to get an accurate value estimate, or just guess and test, and go with what feels right. Either method can work great.

Good luck and have fun! As always, feel free to post questions in the comments, or comment me at @DanielAchterman or danielachterman@gmail.com.

Why You Should Be Using Construct 2

Original Author: Rob Braun

Note: I in no way represent the makers of the Construct 2 software. I am merely a fan of the program and simply trying to bring a wider awareness of the software to the general public.

For those in the dark (which I’m willing to bet is most of you) Construct 2 is a game development IDE that is easy to learn and very powerful. Construct is unique in how it goes about working its magic because Contruct 2 uses a proprietary system for the back end. Instead of using a traditional coding/scripting language like C, Javascript, or Lua, Construct 2 is based around an event system that takes the place of normal code. While people from a heavy coding background might view this as a handicap, the developers of Construct  have done an amazing job of creating a system that can accomplish just about anything.

A huge plus with Construct is that it exports created projects as HTML5.  This allows content creators to quickly get their games out there for the world to see. It also means you don’t have to create different versions to run on different operating systems. This one-size-fits-all approach streamlines the game development process, taking a huge burden off the shoulders of the developer.

The biggest plus of Construct is that it is a perfect platform for people just starting out in game development. The user interface is centered around drag-and-drop functionality, allowing you to quickly block out your level design with basic colored blocks. This combined with preloaded behavior types, such as platforming and 8-directional movement, allow for simple prototypes to be created and tested in a matter minutes. The event system is also incredibly intuitive for anyone with event the most basic understanding of game/programming logic, allowing for the rapid creation of additional functionality.

Whether you’re a student or AAA dev, Construct 2 offers something for everyone and is constantly updated and improved upon by its creators. In an effort to keep the engine as up-to-date as possible, the two men behind Construct’s creation release updates every couple weeks, which means bugs get fixed quickly and new functionality is added often. So, go show a little gamedev love to an amazing product and download the free version at Scirra.com and play around with it a little, and if you like it, download the fully licensed version to help fund an amazing product.

EDIT: Construct is currently available on PC only. While this does suck for people who own Macs that are interested in the program, you must keep in mind that the program is being developed by only 2 guys. Last I had heard, a Mac port was on the agenda but wouldn’t be a reality until they had the time/resources to dedicate to it.

Playing Games – a short play by David Clark

Original Author: Lisa Brown

David Clark, because I found it delightful and thought that you other game developers out there might also find it delightful.

Here’s the background: In his graduate studies a year or so ago, David had an assignment to create a play out of an oral history. So he needed to collect stories from various subjects and then find a way to cut them and craft a short play (using only the transcribed interviews as text).  For his subject he chose the history of games in the lives of several friends.

This 10 – 15 minute play originated out of 6 interviews ranging from ten to forty minutes each, all of which needed to be transcribed before he could edit them.  Thus, some of the phrases are a little weird, namely “Tandy Color Computer II” turned into “candy-colored computer cube,” which is kind of awesome (the interview was over skype so I blamed my poor microphone for the mistranslation)



PLAYING GAMES

_____________________

Adapted from the experiences and stories of

video gamers.

by

David Clark

Characters

Maria – Doctor, 30

Lisa – Game Developer, 28

Scott – College Professor, 27

Beth – Costume Shop Manager, 28

Darlene – House Cleaner, 51

While edited, the material used in this script, with few exceptions, is the words of actual interviewees.

SETTING: A space. Three bodies..

Initially, as they speak, the individuals begin in the following positions: Darlene: sitting, computer in lap. Beth: Lying down. Lisa: Sitting, relaxed. Scott: standing, leaning. Maria: sitting, on edge.

 

DARLENE

Well, when the video games first started it was the Pong . . . thing . . . was the very first.

And it was a pretty stupid little boring game and . . . um . . .

I didn’t really play that much.

MARIA

My parents had an Atari for as long as I can remember.

I think my earliest memories are watching my dad playing Space Invaders,

which I was never good at, and I was in awe of.

LISA

My brother and I had a candy-colored computer cube, which is very,

well you got it at Radio Shack.

I was obsessed with this game, but my brother was like

“the controls are too complicated for you to play. You are too little for it”

and I was like, “Waa. No.”

DARLENE

And . . . and then. . . it . . . the Colecovision had a more . . . racing games kind of things. Those were totally boring to me.

SCOTT

I probably started, I don’t know, the age of 8 or 9 with the Nintendo System.

You know, Super Mario Brothers, obviously, but Dino Riki was a big one in my family, we played Dino Riki a lot.

I was never very good at it.

BETH

When we were little kids . . . I had an N-E-S,

Although I don’t remember when we got it. I think it was a fairly new thing.

MARIA

I remember, whenever I started hearing about the Nintendo,

and like the cool kids in my class,

which I never was,

started talking about like how there were mushroom forests

and you could jump on things,

and I was like “Yeah . . . I . . . have . . . that.”

But I did not.

LISA

Then we –

My parents got us an original Nintendo, as old people call it

A Nintendo Entertainment System as new people call it,

And basically every Friday night we’d go to the video store

and rent a game for the weekend

and it was like a big bonding ordeal for my brother and I .

BETH

I had an N-E-S.

I remember playing Duck Hunt.

And Super Mario Brothers.

because it was like a two pack on the same –

was it on the same disk?

Yeah, it was on the same – or cartridge I guess.

My mom played Super Mario Bros a lot and

she got really excited when she found the princess.

And she would take Polaroid photos of the tv screen when she found the princess.

MARIA

That was a lie.

But then I got one for Christmas and it was like the best Christmas Ever.

DARLENE

And then . . . somebody bought a Tetris game. Tetris was just . . . fun to me.

LISA

I saw a commercial for Spyro the Dragon and –

for those who do not know me, Dragons are a very important part of my life.

So I bought a Playstation One.

It was the first console I’d ever bought with my own money.

I played the crap out of that game.

BETH

I . . . really like shooters, but not like . . . like sneaky shooters.

Like the Rainbox Six series and stuff like that and like Assassin’s Creed was fun.

I like Halo.

That was cool.

I like . . . I . . . I really. I kinda like killing things a lot.

SCOTT

I started playing Final Fantasy, on Playstation,

and from there kind of made the transition to World of Warcraft.

Which is basically almost all I play at this point.

MARIA

Scott, College Professor in Biology.

SCOTT

I got into the whole fantasy genre in the end, I guess.

(pause)

To not put too fine a point on it, it’s because it’s . . . it’s pretty.

It’s kind of . . . what – an escape from the world.

And it’s not just the fantasy genre, it’s also the style of game.

When they went to Final Fantasy Eleven it was ugly.

It was drab, like was, it just was dirt colors,

and that’s not what I’m going to the fantasy world for is dirt color and muted things. Then Final Fantasy XII did the same thing with dirt colors and not interesting and

I don’t know,

I ended up in World of Warcraft because everything is bright and vivid

and I don’t know, just prettier. More fun.

There was a quest line that was very popular in the day.

There’s the leader of the undead folk, the forsaken.

Well, you go on a quest and discover some of her past

and find like a lost piece of jewelry that you return to her

which reminds her of her past as a living being, instead of an undead person,

and she sings what became known as a song called “The Lament of the Highborn”

while spirits are going around.

Everyone kneels down to mourn the loss of, I guess, her humanity.

So it’s, Lady Silvanus is the leader, and you’re, you’re kneeling down,

mourning the loss of her humanity.

And people would make new characters just to do this quest over

and over

and over again to see this moment of –

I mean, it just drew you.

It was, It was beautiful and part of the story and it just . . .

It was a good moment. It was a high moment in the game.

SCOTT

Maria, Medical Doctor

MARIA

I’m kinda of a child, which fits, cause I’m going into Pediatrics

(Katamari Music)

I like things that brightly colored and pretty. So, something like Halo –

I mean resolution, I really don’t care about resolution.

I want it to be fun and happy and I want things to be brightly colored

and I’m a positive reinforcement girl.

So when I do something,

I want it to make like a really rewarding sound, like “dur-doo-da-doo”.

I win.

At this.

So, I’m like a Mario Kart Girl.

Zelda.

Just the reveals in Zelda,

like when you unlock a new area and you have the sweeping camera view

and there are waterfalls and there are Zoras.

Like that . . . that works for me.

I have a PS2, primarily for Katamari Damacy,

because why do you not want to roll people up?

You make pretty stars

and while you’re doing it there are like people screaming as you roll them up.

Which I find, really therapeutic

after I’ve had like a stressful day

or a dissertation defense

or whatever.

MARIA

Beth, Costume Designer and Shop Manager

BETH

I like an objective.

Like, I like having to strate – strategize.

I like, I like there to be a game to it.

I didn’t kind of like . . . oh, Grand Theft Auto.

Like, I liked playing it when I get to run over people and then run from the cops,

but I didn’t like doing the actual game because it was just like

pick up this person,

take this, you know drugs to this other person.

I don’t want be a messenger service.

You know, I feel like, I could just have a job where I do that.

Why would I want to do what I do normally.

I do that.

I don’t get to run into mobs and kill a whole bunch of people in my everyday life.

I mean, maybe, maybe if that was my job . . .

Maybe I’d want to play Viva Piñata or something.

If I was a mass murderer.

(BETH sits up)

BETH

This . . . is going to sound really stupid –

I apologize that you guys have to hear this –

Like when we were playing Mass Effect, right?

And you wanted to go back and try to beat it so that everybody lived?

And to me, it was important that in my plot line, that people had died.

The plot was important,

like that the characters dying, to me, was more important than like “winning” it.

Your point in the game is like,

you’re protecting these people.

So like, you’re the person who’s . . . who’s trying to protect them.

I felt like that was,

I don’t know,

that was important cause I was . . .

I was sad that they had died.

MARIA

I am not someone who gains as much satisfaction out of feeling . . .

like I’m creating the story,

like choose your own adventure.

I’m not interested in that.

I like seeing the story that’s already created

And seeing how like there’s the interesting interactions between things.

I’m a character driven person.

Like Birdo.

Super Mario Brothers 2?

Difficult to understand.

I believe she’s male.

Is Birdo male, with the bow and the spitting of the eggs?

Birdo was ahead of his/her time.

You know what, we need to ask Birdo,

because gender is all about what you choose right?

Doesn’t matter if he’s a boy or he’s a girl,

it’s whatever he wants to be.

He/She.

SCOTT

Darlene, operates a house cleaning service.

DARLENE

So Zelda just was very obsessed . . . obsessive.

It was like all I could think about was playing Zelda.

I didn’t want to stop to do house work.

(puts down computer)

And I was the mother of three.

I didn’t want to stop and cook.

I didn’t want to stop and go to bed.

(Stands, moves toward audience)

I stayed up all night and played Zelda

and when I did go to sleep

I dreamed of flashing swords

and beating hearts

and little marching men shooting things at me.

MARIA

I didn’t have the first Zelda game.

But my cousin did.

And I thought that it was amazing.

There’s something about . . .

Even though it was an 8-bit game

And the graphics were like

I mean they were total crap, right?

(standing and moving toward audience)

But when you saw a fairy

And the circle of hearts went around her.

In my head,

you like found some beautiful thing

And like some magic was happening.

I’m someone that lives a lot in my head, and I’ve had a very overactive imagination.

DARLENE

I don’t know why Zelda more than James Bond, which I was never very interested in

Or the Donkey Kong which I couldn’t stand.

It was like . . . the . . .

the Zelda just drew me in.

It was like there was this story line to it –

Maybe it was because I was good at

It was a story.

You know, it gave us a little story.

You know, there was a princess and there was a hero and there was missions.

MARIA

Lisa, Game Developer

LISA

The first Halo.

In undergrad

With all my friends, playing like every day.

That’s just what we did.

Like constantly.

And it was such a unifying part of my life.

And I remember, you know,

Playing and being the one that couldn’t steer good

And was always getting killed.

And the idea that –

Four player split screen multiplayer was the way you played back then

It wasn’t –

Online multiplayer for consoles didn’t exist

So that was just how you played

It was such an important part of my life

And like the friendships I formed around that

And like the balance of that

Compared to the amount of work I was doing at school at the time

And it was just a huge like important social thing

BETH

(talking to audience, but also others)

I actually really like playing co-op games.

Because I like playing with somebody else.

Like it’s . . . I don’t know.

It’s like why don’t you go to the movies by yourself?

LISA

Game development is a huge team effort.

More so than anything else I’ve ever done

In that you have people with very, very different skill sets

Having to work together to create a specific experience

For Players.

So being able to collaborate and sort of connect over shared experiences

And figure out what experience you want your players to have

And how does that relate to what I’ve had.

MARIA

I have games that I have strong sentimental ties to,

just because they were very good social tools . . .

like Super Mario Strikers for Gamecube.

Super Mario Strikers is a soccer game.

It’s four player co-op

It was never referred to as Super Mario Strikers.

It was only called soccer.

And this was a game that you could play and it-

I think it was a very good team building exercise

Like, my friends would come over

And at this time we all had grown-up jobs

Like we were software developers,

Or glassblowers

Or graduate students

Or medical student

Like we had things we were supposed to be doing

But it’s a way that you could interact, I think

Face to face

Although my dog hated it because there was lots of shouting.

LISA

You know, designing single player experiences

Or like some games designed with the idea that

You might be playing the single player campaign

But they’re designing with it in mind that

You are not alone.

Like I know, Uncharted developers,

Had that in mind when they were making it such a cinematic game

Cause they had the idea that not only is it fun to play

But it’s fun to spectate as well.

You’re constantly about:

What is the experience I want the players to have

And how can I make that experience like . . .

A positive one through the design of the game.

SCOTT

(standing)

The social aspect of World of Warcraft is a big draw in that . . .

It’s not just you working alone.

It’s you working in conjunction with –

You know, if you’re running dungeons

A group of four other people

Who all have jobs to do

And if everybody does their job

You win

If everybody doesn’t do their job,

Then you fail.

Mostly with completely random people

With everybody just coming together

Doing their job

And then going their separate ways

Occasionally, you get someone who is not good

People are usually willing to explain things.

People are generally willing to help, you know

Everybody become better, so that

overall,

the group can be successful

And if somebody is completely out of it

Then yes,

You can kick them out.

LISA

(moving down)

Making games is all about wanting to create something

that someone else is going to experience.

So it’s very . . . serving of others.

You don’t always get to make the games that you like to play

It’s a lot of work.

It’s a lot of nitty gritty team work

It’s toil and effort.

And . . . but being able to like see that you’ve made something

And millions of people have had that experience

That you crafted.

It’s just sort of mind blowing.

MARIA

I mean, just working in a children’s hospital

I think that as a concept video games are important to me

I can see, particularly with our long term illness kids –

Who have blood disorders or cancer disorders

That they look forward to the time when the can go to the all-star room

The All Star Room? It has different names in different hospitals

But in the Long’s Children Hospital of the University of California in San Francisco

The All Star room is the children’s technology room

And they can go to the All Star Room

And they have a lot more consoles, including the Wii

So they can play online with other kids in –

Who are in other hospitals

So that’s a way to feel connected and socialize which is very important particularly from

You know, like six to thirteen,

If you spend all your time in the hospital

(Pause)

MARIA

That’s my history with video games.

BETH

And I think that is the extent of things –

It’s an interesting way of telling a story.

LISA

It’s a way of like learning about each other and learning about your relationships through playing games.

The History of Lisa and Games. Done.

(The actors freeze, as if the play is about

to end)

MARIA

Portal!

You asked what game was important

And I didn’t even think about it

Cause I was thinking about childhood.

Portal.

Portal has influenced the way that I like talk

and interact with people more than any other game.

Glados is like a computer

Like she’s an AI

In a machine

In like a video game.

Not in the real life

In a gideo –

Video game spinoff

And it has like totally influenced the way I talk to people

Whenever I talk to random people

Like I can tell if they’ve ever had Portal in their life.

And I’m like, it’s a shame

Cause I just wasted a kick-ass Portal reference on you.

Portal.

Porta 2, man.

And in my relationships

I’m like

I’m sure that . . .

That . . .

Let’s see what . . .

What is it?

(Pause)

MARIA

“I’m sure we’ve both said things that you are going to regret.”

I’ve used that.

Glados says that.

I’ve used that in my relationships.

And . . .

And, I’m like you know what?

You had a chance for us to end this argument on good terms.

But since you didn’t get that Portal 2 Trailer reference

It’s over for you.

It’s on.

For Science.

BETH

Well, I mean –

MARIA

You Bastard.

BETH

I think that the cool thing was that –

MARIA

That’s it.

Portal’s good.

BETH

The cool thing was –

MARIA

Portal’s awesome

Portal’s beyond good.

BETH

It was clever,

you know, I feel like –

MARIA

It was so clever –

BETH

So many games aren’t clever.

Like they’re just like,

Oh, you’re in a war. Shoot things

SCOTT

This was –

Oh, you’re trapped by a psychotic computer

BETH

Yeah.

You’re trapped by a psychotic lesbian robot

SCOTT

Can you escape?

BETH

That is like flinging things at you and you can –

MARIA

Promising you cake –

BETH

Promising you cake.

MARIA

And it was a puzzle game.

It was like –

BETH

Yeah, puzzles –

MARIA

It was a totally like new way –

SCOTT

They made you –

They made you invest

MARIA

of thinking of puzzle games –

SCOTT

on the emotional level by showing you that other people had died –

MARIA

Yeah –

BETH

Yeah –

MARIA

It’s brilliant

SCOTT

Trying to escape this.

MARIA

Yeah.

No.

It’s amazing.

And then there are parts even in the song

Where it’s like

“And these points of data make a beautiful line

and we’re out of beta, we’re releasing on time”

Isn’t that the dorkiest thing ever?

(Still Alive begins to play)

SCOTT

It is.

MARIA

And, I think I use that to screen potential mates.

SCOTT

It’s not a bad screen.

MARIA

It’s not. It’s a really good screen.

Please end it with that song.

(BLACKOUT)

THE END


*Ending note.  The actress who played Maria played Portal for research and then became obsessed with it.  SUCCESS.

Team Audio Wants To Buy You Nice Things

Original Author: Ariel Gross

It wasn’t that long ago that I was talking to Jason Scott, Volition’s studio design director hero, about how bummed I was that so many of my colleagues from other disciplines weren’t actively listening to the game. He was bummed, too. We were just a couple of guys sitting around, tears in our eyes, chins quivering, being bummed.

I had recently hooked Jason up with a little Behringer mixer and some spare M-Audio BX5a speakers. He immediately transformed into the Maxell guy. The one sitting in the chair. Google it. He felt my pain. He had been experiencing the sound in our games in a way that transcended his previous Labtec lifestyle, and he yearned for others to share in that experience.

So, we decided to buy all the designers headphones. Nothing too fancy, just some reliable, closed-ear Sennheiser headphones. There are a lot of designers at Volition, so it wasn’t going to be cheap no matter which way we sliced it. It turned out that it was easy to justify, though. How?

Story time! This is a dramatization, this did not really happen, but it could. It totally could.

It’s down to the eleventh hour. Only two months before submission. An overworked system design hero is hunched over his computer, the outline of his spine practically ripping through the back of his shirt. A bare light bulb dangles over his head, the hot, oppressive light illuminating the beads of sweat on his scalp. A cigarette dangles loosely from his lips as his fingers punch his keyboard to tweak the handling of a motorcycle for the fiftieth time that day. CLAKKETY-CLAK CLICK CLICKETY CLACK. He threads his hands between his glasses and his eyes and grinds more sweat into his corneas. He is numb to the sting. He’s done. It’s time to test. He runs the game, hops on the motorcycle and drives. He drives and drives, far away from this place. He is happy. He checks in his work and falls asleep in his chair, snoring loudly for three hours before he has to wake up again.

Next day, it’s time for a multi-discipline group review of vehicles! Yay! Even the producer is there! Team Audio bounces on their tails into the conference room. One audio hero is particularly excited to hear his new motorcycle audio in action. He had spent a good five hours last week making sure that all the loops were smooth and that each gear sounded more aggressive than the last. He was proud of it. The game is loaded up. The motorcycle is mounted. And then BARRFFFFFF. It sounds awful! It doesn’t sound anything like it did last week. Producer mad! PRODUCER MAD!!! RUN FOR YOUR LIVES. Producer chases audio designer around the building with a chainsaw to the theme from Benny Hill.

So, what happened? I’ll tell you what happened. Vehicle designer changed the handling of the motorcycle but didn’t listen to hear how the handling totally botched the audio, and then he checked it in.

Now, to be fair, audio hero screwed up, too, so to any design heroes reading this, I’m not trying to pick on you. A smart audio hero knows better than to spend five hours tweaking vehicle engine audio when the handling isn’t finished. That’s why I chose this dramatization. Besides, the only thing that’s even remotely realistic in this dramatization is the behavior of the producer. I’m kidding! (I’m not kidding).

So, we bought all the designers headphones. And we didn’t just buy headphones and throw them at the designers’ desks and swagger off, either. I sent numerous messages to the entire design team offering my personal assistance in hooking things up however they wanted. Want to be able to switch between listening to the game and listening to your PC with one convenient swap of a cable without crawling under your desk? I can do that for you. Want to be able to listen to Hey Ash, Watcha Playin’ on your PC and listen to the game at the same time? I gotcha covered. Want to listen to your PC, PS3, 360, PSP, and iPad at the same time? Okay, that’s annoying. Not doing it… Oh, alright, I’ll hook you up.

I’m not going to lie. It’s not like every single designer is listening to the game at all times. That would be amazing, but it would probably drive them insane, especially since audio tends to be in this weird, ramshackle state until about three days after release to manufacturing. And just buying headphones for designers doesn’t replace relentless communication and real rapport. But it helped. It really did. Designers were coming to us with audio issues before the group playtests, and we were able to fix those issues before the producer had even finished marinating his garotte in botulinum toxin.

All we had to do was describe a handful of these scenarios while groveling obsequiously at the feet of our finance hero and boom, headphones for all.

So, to all the Team Audios out there, if you find yourself in a situation where nobody is listening to the game, take some time to make your case to your buddies in studio management and finance. Ask to earmark a little bit of money for some listening pleasure for your colleagues. If you can’t afford it, at the very least you can spend some time informing and educating your colleagues from the other disciplines about how their changes can affect your work. Work with them to coordinate your changes in a way that makes sense. Invite them into your world. Because in the end, it could mean saving a life. I’m looking at you, producers. Wait, who, me? No, no, I wasn’t looking at you. I was, uhm, I was admiring your coffee cup. <nervous whistle>

AltDevConf Programming – Wolfgang Engel, Igor Lobanchikov, and Tim Martin

Original Author: Colin Barré-Brisebois

Allow me to introduce you to Wolfgang Engel, Igor Lobanchikov, and Tim Martin, from the Programming Track. Their talk: “Dynamic Global Illumination”. Wolfgang and Igor will be presenting this one. What will it be about? From Wolfgang:

_____________________________________________________

Dynamic Global Illumination with a large number of light sources.

We have implemented a GI system based on Light Propagation Volumes that supports characters and can adjust quality levels dynamically. We will go through all the steps necessary to implement a system like this:

1. Cube Reflective Shadow maps
2. Light Propagation Volume
2.1 Injection
2.2 Propagation
3. Indirect Occlusion
4. Illuminating the Scene with Deferred Lights

This approach extends the article from Anton Kaplanyan, Wolfgang Engel, Carsten Dachsbacher, “Diffuse Global Illumination with Temporally Coherent Light Propagation Volumes”, GPU Pro 2, AK Peters 2011.
_____________________________________________________

Wolfgang Engel is the CTO/CEO & Co-Founder of Confetti Special Effects Inc., a think-tank for advanced real-time graphics research for the video game and movie industry. Previously he worked for more than four years in Rockstar’s core technology group as the lead graphics programmer. His game credits can be found at http://www.mobygames.com/developer/sheet/view/developerId,158706/. He is the editor of the ShaderX and GPU Pro books, the author of several other books and speaks on graphics programming on conferences world-wide. He is a MVP DirectX since July 2006 and active in several advisory boards in the industry. He also teaches at UCSD the class “GPU Programming”. You can find him on twitter at @wolfgangengel.

Igor Lobanchikov is the General Manager of Confetti Special Effects Inc., Minsk office, a think-tank for advanced real-time graphics research for the video game and movie industry. Previously he worked as the lead graphics programmer at GSC Game World (S.T.A.L.K.E.R. series), CTO at Steel Monkeys. His game credits can be found at http://www.mobygames.com/developer/sheet/view/developerId,176474/. He was a speaker on graphics programming at GDC 2009 and at Intel sessions GDC 2011.

Confetti’s website is www.conffx.com

The Novelty vs Familiarity Paradox

Original Author: Julien Delavennat

Hi everyone n_n

This post is the continuation of my last one: A functional definition of Beauty

Today on the menu:

  • Beauty is identified in novel things which resemble familiar things, and not in familiar things: we know the things we know aren’t perfect. We don’t know how perfect this new awesome thing might be. Beauty is the unrealistic size of this possibility space, which is only reduced after we have taken the time to analyze this new thing and find its limits.
  • Beauty is fantasizing and imagining how awesome this new thing is going to be.
  • Beauty is fantasizing about how much more fun we’re going to have with this new thing that has been really awesome up to now.
  • You have to promise a lot, keep your promises, KEEP promising stuff, KEEP delivering, up to the end.
  • Since beauty is mostly identified in new stuff that resembles familiar stuff, you can’t just fork out the same stuff over and over, you have to make up something sufficiently familiar but sufficiently new. As far as I know, this has been confirmed by psychologists and other relevant people.

In my last post, I described how beauty is strongly linked to familiarity and the comfort  zone of the audience, and concluded by saying that people only identify stuff to be possibly awesome if it fits their existing knowledge of what awesomeness is, which is based on the things they already know, i.e. what they’re familiar with.

Now readers pointed out something I had missed. I had in fact wrongly assumed that it meant that we considered familiar things to be beautiful. I basically confused the comfort zone and the set of things that are familiar to us, when in fact things probably look more like this :

So what about things that are familiar to us which we don’t like then ?

This is where it gets interesting.

You see, one other thing I didn’t take into account, was things getting expelled from the comfort zone. You know, sometimes you like a thing, and a couple days later… meh.

I think we can safely identify two phases: identifying potential, and analyzing value.

Simply put, you see a thing X which looks promising, and you’re really excited about it. Then when you actually spend some time with it, you realize it’s not as great as you thought it was going to be.

Why were you excited about X in the first place then ? Because you only identified potential from the surface.

Why did you stop liking it if it was supposed to be nice ? Because you learned more about X by spending time with it, and you discovered it had flaws and limits. You basically came back down to earth.

Example: ephemeral art. It works because we just won’t know how much more awesome it could have been, and because we didn’t have time to analyze how much less  awesome it  would actually have been, which is the point really, to wonder about possibilities.

Why is that, then ? Well, it only seems logical to me that we would always want to find better things for ourselves: we compare new stuff to old stuff, and try to identify possible benefits of replacing the old by the new. Well, the “replacing” part isn’t really important, the “finding awesome new stuff” however is where the magic happens.

I’ll go ahead and claim that beauty, is perceived at the moment we start analyzing something on a surface level, and it looks reaaaaally awesome and promising: the positive possibility space of X is immense and full of awesome possibilities if all we have seen from X up to now is perfection. It takes time to discover the flaws and limits of things.

The most important part is how unrealistically large the potential of X is perceived to be, based on how much of X has matched our criteria of what perfection is up to now.

People only identify stuff to be possibly awesome if it fits their existing knowledge of what awesomeness is. Now like I said last time, the important part is familiarizing people with things iteratively.

Hopefully coming up with incrementally new stuff isn’t necessarily too hard. Creating 100% new things is practically impossible, and not technically a good idea anyway. Like atoms and molecules for new chemicals/materials, good pre-existing ideas is what makes up new good ideas.

Want to make your game not boring ? You have to use this psychological property to your advantage. Unless I’m mistaken, I think Mike Birkhead named that Asymmetry in a recent post. You can think of this as diversity vs variation. Well, pacing isn’t really what I want to talk about right now, I’ll come back to this in a later post. Still, as far as I know, this “new is bigger” effect is what good diversity is based on – note: I’ll talk about a diversity vs consistency paradox in a later post too.

If you can promise stuff and deliver, that’s not enough, you have to keep promising stuff, and keep delivering. One example I know of this is the Death Note anime. It’s just  massively solid for a really long time. I honestly had trouble watching it a second time without pausing every five minutes because my brain was melting from how awesome it is. More precisely, it’s a police investigation story with a twist. The main characters all have their motives, and the story is almost plothole-free. What drives the story is the  investigation, the leads, hints and opportunities followed by both sides. They plan  everything several moves ahead so the story is consistently surprising: expectations, promises, and the situation are re-evaluated all the time.

I’m getting a bit off-track aren’t I ? What does writing an intricate and solid storyline have to do with beauty you may ask. As a matter of fact, I am getting off-track with beauty. I’m more talking about awesomeness in a more general fashion here. But what it does tell us, is that beauty really kinda stops at the “This new object matches my criteria for  awesomeness” thing. But in an iterative way. And this iterative way is the useful part.

So, What problems are left ?

What people actually want: what the criteria are.

Apart from that, most of what awesome works do, is promise things, and give them to the

audience. I’ve talked about that in my first two posts about Interweaving and Exploitation of Perimeter.

I know I don’t have much credibility compared to professionals, but I do what I can, I’ll get

there eventually.

Anyway, thanks for reading, have a nice week-end n_n

Computing in Schools – Lets Not Rush Things

Original Author: Lee Winder

There has been a significant amount of press in the UK about the quality of computer related education at Key Stage 3 and 4 (Secondary School level with pupils ages 11-16 years old) and to a much lesser extent Key Stage 5 (college or 6th form students aged 17-18 years old).

As someone who used to teach ICT at these level I have first hand experience of the kind of topics, software and skills taught to children in classes across the UK, and agree 100% that, as a subject, ICT should be kicked to the kerb and approached from a completely different angle.

And we’re certainly heading in the right direction.

The moves in the right direction. Change is coming and it’s change for the better.

But we must be careful not to rush these changes and to make sure the structure and content is right, that suitable facilities are available and we have the right people in place before we start this process otherwise we’ll be back to square one within a couple of years.

 

 

You Can’t Teach What You Don’t Know

The largest problem facing the introduction of a new, highly scientific and difficult subject is getting the right people in place to teach. And the most important word in that sentence is ‘right’.

Sure we can use existing ICT teachers but it’s clear that the skills required to teach ICT are not the same skills required to teach a Computing GCSE. Also, don’t get me started on the number of ICT teachers who don’t actually know how to use a computer…

We can draft in science and maths teachers to teach elements of the course others are unable to but those teachers already have working place directives in place limiting how many hours they can teach and those hours will already be more than accounted for.

If we really want to create a next generation of developers is passionate and knowledgeable educators pushing that passion onto the open minds in front of them. Sure, anyone can learn enough to teach a subject, but it wont be exciting, it won’t be boundary defining and it won’t make those pupils crave more. Sure, some teachers will really take to this, will develop that passion along with their students, but the majority won’t and as a result the subject could easily be seen as stale, boring and dull.

So the ideal solution is to hire for the shortfall but with approximately 3,900 state run secondary schools in the UK and with many schools having the need for more than one or two teachers per subject that’s a big recruitment drive.

 

 

Custom Content Is Risky But Rewarding

One of the most interesting aspects of this push towards a more computing focused subject is the idea of having a more flexible curriculum. Now this could mean a myriad of things though I’m taking it to mean schools being given the ability to cherry pick the elements they want to teach and to ignore elements they don’t.

This is extremely useful especially with a lack of specialist teachers and it also tackles one of the main criticisms of the National Curriculum, that it creates boilerplate content and restricts creativity and freedom in the classroom.

So by allowing schools to be flexible with what they teach we allow our teachers to experiment and push the boundaries of our children’s imaginations, if they have the knowledge to do that.

But it also opens up the possibility of a (and I hate myself for using this awful and overused phrase) postcode lottery where some schools are teaching more valuable skills than others. It complicates the act of awarding consistent and meaningful grades across the country and it could lead to stagnation as some schools resist pressure to improve as technology moves on.

Though you could make that argument for the education system as a whole due to the varying levels of skills between teachers of all subjects in all schools.

 

 

We’re A Fickle Bunch

With the issues highlighted above there is every chance that if we rush headlong into these changes we risk the first years being less than stellar as people find their feet, new teachers are recruited and less talented teachers are let go.

And this one worries me the most.

With every change of Government, or in many cases with every change in Education Secretary, schools are given newer mandates, newer targets and newer goals. And it’s always in response to a perceived failure by the last Government/Secretary.

If the introduction of a Computer focused subject is seen as a failure in any way then the next Education Secretary will trip over themselves to ‘fix’ the situation. Not by removing the subject but by constantly tweaking and ‘refocusing’, leading to a course that drives schools (and good teachers) away from the subject and turns it into something resembling what we already have.

 

 

ICT Isn’t All Bad

ICT isn’t just Word and Excel. There’s some really interesting content in there that shouldn’t just be discarded out of hand.

I’ve taught lessons in web design and planning using both graphical editors (Dreamweaver at the time) and text editors. We used some rudimentary programming tools in the early years (getting frogs safely across the road by managing traffic light systems) and video editing tools in later years. All of these were exciting, interesting and (usually) generated some pretty interesting results!

I’m confident that these elements will not be lost no matter what comes next, but we must be careful not to discard what we have and what actually works for want of a ‘better’ system.

 

 

Word Processing Skills Are Important

Something we need to acknowledge is that (this might nark some people) word processing and spreadsheet skills, and the ability to use MS products, are important skills that pupils need to have. Whether we like it or not the majority of the world uses MS Office and while this might change in the future having the ability to use these tools improves a child’s employability, their work rate at school and their computer literacy in general.

But the removal of these ‘skills’ from a specific subject is nothing but good news. By teaching these skills as part of other subjects will lead them to be seen as more natural tools that can be used in a wide range of situations rather than just in their ICT lesson.

But we need to make sure that time is available in all subjects to do this and acknowledge that it’ll take a whole school approach to achieve, something that will vary greatly on a school by school basis.

 

 

I’m certainly excited about how these changes will alter how our children see and use computers on a daily basis and how that can only improve the industry in general. But there are significant challenges that must be faced before we can move forward, confidently, and create a true next generation of developers.


Building a memory system – Part 1: Fundamentals

Original Author: Stefan Reinalter

Today, I want to start a series on how to build your own memory system to be used in your game or engine. The series will cover how to handle allocations with vastly different lifetimes using specialized allocators, how to handle alignment restrictions, how to implement debugging features like memory tracking and tagging, and more. Before we can start, we need to delve into the inner workings of new, new[], delete and delete[] today – you may be surprised about some of the subleties involved.

In order to keep things simpler and only concentrate on the crucial elements, we don’t deal with per-class new/delete, and we don’t want to mess with exceptions either, as they are rarely used in run-time game code.

new operator / operator new

The first thing to understand is that there is a difference between the new operator and operator new. Let’s look at a very simple statement involving the keyword new:

T* object = new T;

This is the simplest form of the new operator, probably used in many, many places in your code. What does it really do behind the scenes?

  1. First, a call to operator new (note the difference!) is made to request storage for a single T.
  2. Second, the constructor for T is called which constructs the new instance of T at the memory address returned by the previous call to operator new.

If T is of fundamental type (e.g. int, float, etc.), or does not have a constructor, no constructor will be called. The above statement will call the simplest form of operator new:

void* operator new(size_t bytes);

Notice the size_t argument – the compiler will automatically insert code for calling operator new with the correct size for a given type, which is sizeof(T) in our case. Because operators behave like ordinary functions, they can be called manually, and can have different overloads as well. Those overloads can also be invoked by using different versions of the new operator, with the compiler generating code for calling the corresponding version of operator new. In fact, there’s another standard version of the new operator, with so called placement-syntax:

void* memoryAddress = (void*)0x100;
 
  T* object = new (memoryAddress) T; // placement-syntax, known as placement new

This can be used to construct instances of classes at a certain place in memory, which in essence is the only way of calling constructors “directly”, because no memory allocation is involved here – the above calls a different overload of operator new, which is the following:

void* operator new(size_t bytes, void* ptr);

Even though this form of operator new takes size_t as the first argument, it does not allocate any memory, and just returns the pointer given in the second argument. That’s why our example simply invokes the constructor T::T() at address 0×100.

The placement-syntax of the new operator is very powerful, because it allows us to invoke different overloads of operator new with an unlimited number of custom arguments. The only rule is that the first argument to every operator new must always be of type size_t, which will automatically be passed to it by the compiler.

Again, let’s look at an example illustrating the above:

void* operator new(size_t bytes, const char* file, int line)
 
  {
 
    // allocate bytes
 
  }
 
   
 
  // calls operator new(sizeof(T), __FILE__, __LINE__) to allocate memory
 
  T* object = new (__FILE__, __LINE__) T;

Leaving differences between global operator new and class operator new out of the equation, every use of the placement form of the new operator boils down to the following internally:

// calls operator new(sizeof(T), a, b, c, d) to allocate memory
 
  T* object = new (a, b, c, d) T;

Which is semantically equivalent to:

T* object = new (operator new(sizeof(T), a, b, c, d)) T;

The magic of calling operator new is simply done by the compiler. Furthermore, remember that every overload of operator new can be called directly like ordinary functions, and we can do whatever we want with the different overloads. For example, we can even use templates if we want to:

template <class ALLOCATOR>
 
  void* operator new(size_t bytes, ALLOCATOR& allocator, const char* file, int line)
 
  {
 
    return allocator.Allocate(bytes);
 
  }

This comes in handy later when we’re about to use different allocators, and want to provide additional arguments like e.g. alignment boundaries. The placement-syntax allows us to conveniently allocate memory with e.g. the following single-line statement:

T* object = new (allocator, alignment, __FILE__, __LINE__) T;

delete operator / operator delete

This is probably no big surprise, but again, it is crucial to understand that there is a difference between the delete operator and operator delete. Calling the delete operator on a previously new‘ed instance will first call the destructor, and then operator delete. Apart from the reverse order of operations, there’s another difference between new and delete: Regardless of which form of new we used to create the instance, the same version of operator delete will always be called (which is rather unfortunate when trying to implement advanced memory system techniques in later parts of the series):

// calls operator new(sizeof(T), a, b, c, d)
 
  // calls T::T()
 
  T* object = new (a, b, c, d) T;
 
   
 
  // calls T::~T()
 
  // calls operator delete(void*)
 
  delete object;

The only time the corresponding operator delete is called by the compiler is when an exception is thrown inside operator new, so the memory can correctly be freed before the exception is propagated to the calling site. This is also the reason why every overload of operator new must always have a corresponding version of operator delete, even if it’s never called. But let’s not digress, we don’t want to deal with exceptions further.

Like operator new, operator delete can also be called directly (like an ordinary function):

template <class ALLOCATOR>
 
  void operator delete(void* ptr, ALLOCATOR& allocator, const char* file, int line)
 
  {
 
    allocator.Free(ptr);
 
  }
 
   
 
  // call operator delete directly
 
  operator delete(object, allocator, __FILE__, __LINE__);

However, do not forget that the destructor is called by the delete operator, not operator delete. Hence, in the above example, the destructor needs to be called manually:

// call the destructor
 
  object->~T();
 
   
 
  // call operator delete directly
 
  operator delete(object, allocator, __FILE__, __LINE__);

If instances are created wih the simple placement-form of new, the destructor must always be called manually. Using delete on such an instance would invoke undefined behaviour (because the memory was never allocated with a call to new). Keep this in mind whenever you use placement new!

Having thoroughly discussed new/delete, let us take a look at their array siblings, new[] and delete[].

new[] / delete[]

Even though you have probably used it a thousand times already, you may not realize that in something so fundamental such as new[] and delete[], there’s already compiler magic involved. The reason for this is that the C++ standard just mandates what new[] and delete[] should do, but not how. Let us take a closer look, again starting with a simple example:

int* i = new int [3];

Similar to the new operator, the above allocates storage for three ints by calling operator new[] (requesting memory), and since int is an integral type, there are no constructors to call. Similar to operator new, we can overload operator new[] and use placement-syntax as well:

// our own version of operator new[]
 
  void* operator new[](size_t bytes, const char* file, int line);
 
   
 
  // calls the above operator new[]
 
  int* i = new (__FILE__, __LINE__) int [3];

delete[] and operator delete[] behave similar to delete and operator delete – we can call operator delete[] directly if we wish, but must make sure to call the destructors manually (in reverse order). Nothing too fancy, but what happens with non-POD types?

struct Test
 
  {
 
    Test(void)
 
    {
 
      // do something
 
    }
 
   
 
    ~Test(void)
 
    {
 
      // do something
 
    }
 
   
 
    int a;
 
  };
 
   
 
  Test* objects = new (__FILE__, __LINE__) Test [3];

Even though sizeof(Test) == 4 (MSVC 2010, Windows 32-bit platform), our version of operator new[] will get called with an argument of 16 bytes, instead of 12 bytes. Why? Think about how the array needs to be deleted:

delete[] objects;

The compiler must somehow know how many instances of type Test are to be deleted – otherwise it can’t call the instances’ destructors. So what almost every compiler does upon a call to new[] is the following:

  • For N instances of type T, request an allocation for sizeof(T)*N + X ‘extra’ bytes from operator new[].
  • Store N somewhere in the first X bytes.
  • Construct N instances using placement new, starting at ptr + X.
  • Return ptr + X to the user.

Most of the time – if you don’t specify a particular alignment for a class using __attribute__((aligned)) (GCC) – the amount of extra bytes requested will be 4, but that depends on both your class’ alignment restrictions and the compiler. For example, if you specify Test to be 16-byte aligned using __declspec(align(16)), MSVC 2010 will request a total of 64 bytes in the example above.

As an example, let us use the definition of class Test from above: If your overload of operator new[] returns the memory address 0×100,  Test* objects will point to 0×104, because of the extra 4 bytes requested by the implementation! The memory layout of the 16 bytes would then be:

0x100: 03 00 00 00 -> number of instances stored by the compiler-generated code
 
  0x104: ?? ?? ?? ?? -> objects[0], Test* objects
 
  0x108: ?? ?? ?? ?? -> objects[1]
 
  0x10c: ?? ?? ?? ?? -> objects[2]

When delete[] is used later on, the compiler inserts code which reads the number of instances N by going back 4 bytes from the given pointer, and calls the destructors in reverse order – if the type to be deleted is non-POD. Otherwise, there’s no 4 byte overhead added because no destructors need to be called (like in the new int[3] example above). If you ever wondered what the vector deleting destructor() in MSVC is for, there is your answer. Unfortunately, this compiler-defined behaviour causes problems when using our own overloads for operator new[] and operator delete[].

As an example for using custom overloads, we might want to pass alignment restrictions to operator new[], and return correctly aligned memory (e.g. on a 16-byte boundary). However, the compiler-implicit offset that is added to whatever we return will definitely screw with our alignment. Additionally, when we want to call operator delete[] directly, we somehow need to figure out how many destructors to call (if any).

Which we can’t.

The reason is that we can never be sure whether the compiler inserted some extra bytes (4, 8, or possibly more) in the allocation or not. This is totally compiler-dependent. It might work, but it could also horribly break with some user-defined types. And other compilers could do it differently altogether.

This is also the reason why using delete on instances allocated with new[] invokes undefined behaviour, and vice versa. The compiler-generated code simply tries to access memory which doesn’t belong to it (using delete[] for allocations via new), or not all instances of an array are correctly destructed (using delete for allocations via new[]). This can have zero consequences (if the types don’t have a destructor), or crash your code (if the types have a destructor).

However, with the knowledge of what happens behind the scenes with calls to new, new[], delete and delete[], we can build our own allocation functions which correctly handle simple and array allocations for all types, can use our custom allocators, provide additional information like file name and line number, and more. The next post in this series will show how.

In the meantime, in case you want to read more about global operator new and class operator new (which we didn’t discuss here), here are recommended links:

new (C++)
delete (C++)

Thanks to Michael Tedder, Paul Laska and Bruce Dawson for the feedback!