Project Octant 9: Data Structures

By Shamus Posted Thursday May 17, 2012

Filed under: Programming 50 comments

I’m still working on the project. The stuff I’m working on now is a little boring and would mostly be a re-hash of stuff I’ve discussed before. So rather than do that, let’s talk about data structures.

octant9_2.png

Remember the little red cube. We’ll see him again later.

When a programmer sits down to write some software, the question comes, “How will I represent this problem in code?” This is actually one of my favorite parts of the job. (Or hobby, in this case. Unless you’re hiring? Do you want to fund development of this project? It has no gameplay, no plan, no support, and it doesn’t even work yet. Let me know if you’re interested!) If I need to store a historically important date like August 24, 1971, then there’s a lot of ways I could do it. I could store it as a text string: “August 24, 1971”. But then it would be hard to do math on it. (Say, to calculate how long it’s been between then and now.) I could store it as a group of three integers: 8, 24, and 1971. I could store it as the number of seconds elapsed since January 1, 1970: 51,840,000. The latter is great for doing math (and is actually how most systems store time internally) but it means you have to do a messy conversion when you want to display the date to the end user. Because if you display a date as 51,840,000 then the end user will find you and burn your house down.

What method will be fast? What will take up the least memory? What will make for clear, readable code? These are questions that programmers love to ponder before coming up with the wrong answer and making a mess of things.

Which brings us back to the problem of storing large tables of data.

octant9_5.png

We look at this and see a table. But internally, computers don’t “do” tables. They’re not really into 2-dimensional kind of stuff. Computer memory is a long, long line of values. If you’ve got four gigabytes of RAM, then you’ve got four billion little memory addresses in a single row, and it’s up to the programmer to make sense out of them.

Continue reading ⟩⟩ “Project Octant 9: Data Structures”

 


 

Alan Wake EP14: Stabbed in the Brain

By Shamus Posted Wednesday May 16, 2012

Filed under: Spoiler Warning 95 comments


Link (YouTube)

The headache stabbed me in the brain. And then I wrote a novel. Sounds about right.

Let’s see: Goofy puzzles. Occasionally awkward dialog. A wall between story and gameplay. A seemingly boring jerk for a protagonist. Repetitive foes. Terrible lip sync. Checkpoint saves.

We’ve accused Alan Wake of all of these, and I don’t think we’re wrong. But I think all of those problems are even worse in Silent Hill 2, which I still regard as one of the more powerful games I’ve experienced. I’m still gnawing on this, and I can’t speak for the rest of the cast, but I suspect that if the game had connected with me on an emotional level (dread, sorrow, anger, whatever) then I wouldn’t be focusing on these problems.

 


 

Alan Wake 13: Is Your Refrigerator Flying?

By Shamus Posted Tuesday May 15, 2012

Filed under: Spoiler Warning 142 comments


Link (YouTube)

“As I approached the Spoiler Warning I saw it was covered in dark shadows. The shadows blocked out the light so I could only see darkness and shadows. It was terrifying. After gathering up some batteries and watching half an hour of crappy television, I approached the darkness and drew near to the edges of the dark shadows that blocked out the light, making things darker and spookier.”

 


 

Project Octant Part 8: The Time-Hole

By Shamus Posted Tuesday May 15, 2012

Filed under: Programming 138 comments

So let’s talk about data structures. I’ve mentioned way back at the start of the project that there are certain costs to using an octree. An octree will make interfacing with ALL blocks a hundred times faster but make dealing with a specific block several times slower. I’m curious how…

Hang on. My program has been behaving oddly recently. It’s like it will suddenly stop building new blocks and I’ll end up stuck on this island floating in empty space. I’ve got the program set to aim for 60fps, and if one thing starts eating too much CPU then the block-building gets choked off. Let’s see where these CPU cycles are going.

I add a little benchmarking loop. Right now there are just five systems running:

Continue reading ⟩⟩ “Project Octant Part 8: The Time-Hole”

 


 

Project Octant Part 7:Slopes

By Shamus Posted Monday May 14, 2012

Filed under: Programming 97 comments

Now that we have a world based entirely around the idea of cubes, you know what we need? Slopes. This is something that’s been on my mind for ages. I’ve run around the Minecraft landscape and wondered, “What would this look like if the cubes could slope to form beveled outlines?”

octant6_14.jpg

Slopes aren’t really a foreign idea to an octree-based world. Minecraft has steps, which are basically slopes for the purposes of blocking light (they don’t) and collision. I want to take this one further and make slopes a part of the natural landscape. Like a lot of the stuff with this project, I’m not sure how well this will work out.

The trick here will be that the software needs to be able to look at a landscape and figure out which blocks should be turned into ramps, which ones should be turned into corners, which ones should remain cubes, and which way the slopes should face.

First, I need to set some parameters:

Continue reading ⟩⟩ “Project Octant Part 7:Slopes”

 


 

Alan Wake EP12: Murder and Coffee Thermoses

By Josh Posted Saturday May 12, 2012

Filed under: Spoiler Warning 178 comments


Link (YouTube)

And the (very late) final episode of the week. Fortunately, it’s completely topical and we don’t spend fifteen minutes driving cars into trees.

 


 

Josh Plays Shogun 2 Part 19: Holding it Together

By Josh Posted Saturday May 12, 2012

Filed under: Spoiler Warning 45 comments

splash_shogun2_josh.png

Yes, it’s finally back! After gathering vital intelligence at PAX and fighting off the vile ninja minions of Rutskarn, Oda Nobunaga has finally returned to conquer Japan! Now let’s see, where were we? Oh yes, we fought some siege battles, had half of Japan declare war on us (including the largest and most powerful clan in the entire country, the sea-ruling Mori) and extended our domain to the doorstep of Kyoto and the ruling Ashikaga Shogunate.

shogun18-21.jpg

Oh yeah, and we converted to Christianity so we could crash our entire economy and insult every other clan on the island for the slim chance that we can build some European-style galleons to stop the inevitable Mori naval invasion before it happens.

If our own citizens don’t get us first.

Continue reading ⟩⟩ “Josh Plays Shogun 2 Part 19: Holding it Together”