New Level Preview

January 2nd, 2009

This is something I’ve been hacking on during my xmas/ny break. It might see the light of day eventually!

Text Formats Are Just Easier

December 28th, 2008

Something I learned long ago is that text formats are just plain easier to work with. As a result, everything in ToeTag travels around as much as possible as chunks of text. It’s easy to decode and it’s easy to debug. Not sure what’s on the clipboard? Paste it into a text editor and look at it. Couldn’t be simpler!

I just added cut/copy/paste to WADEd today and, of course, it’s shuffling the textures around in text format. This is easier for Quake textures since a) they tend to be small and b) they use palettes. Palettes mean I can pass around palette indices (a byte) rather than full blown RGB values (3 integers). Sure you could do some fancy bit magic there and crush that RGB value into a single integer but it still wouldn’t easier to read than an index into a palette - so nyah!

As a quick demo, here’s a pic of a small texture selected in WADEd:

picture-12

And here’s how that same texture looks when I hit CMD+C to put it on the clipboard:

#TEXTURE#16 16 SLIPSIDE 1 1 1 97 97 98 98 98 98 98 98 97 97 1 1 1 1 96 99 100 101 102 102 102 102 102 102 101 100 99 96 1 1 98 100 249 250 251 251 251 251 251 251 250 249 100 98 1 1 97 99 248 249 250 251 251 251 251 250 249 248 99 97 1 1 1 97 98 100 101 102 102 102 102 101 100 98 97 1 1 1 1 96 96 97 98 98 99 99 98 98 97 96 96 1 1 1 1 97 98 99 100 101 101 101 101 100 99 98 97 1 1 1 97 99 248 249 250 251 251 251 251 250 249 248 99 97 1 1 97 99 248 249 249 250 251 251 250 249 249 248 99 97 1 1 1 97 98 99 100 101 101 101 101 100 99 98 97 1 1 1 1 96 96 96 97 97 98 98 97 97 96 96 96 1 1 1 1 97 97 98 98 98 99 99 99 98 98 97 97 1 1 1 96 98 76 248 248 248 249 249 248 248 248 76 98 96 1 1 96 97 76 76 76 248 248 248 248 76 76 76 97 96 1 1 1 97 97 97 98 98 98 98 98 98 97 97 97 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

See what I mean? If something wasn’t working properly, I’d be able to decipher this a lot quicker than I would any kind of binary format.

And now you can easily copy/paste textures around from WAD to WAD!

Interior Pointers For The Lose

December 19th, 2008

Remember the post I made awhile back, talking about how I needed to turn off optimizations for two pieces of code and I didn’t understand why? Of course you do, it was here, remember? Well, I was listening to the latest episode of Late Night Cocoa wherein they were talking about garbage collection. The guest, Andre Pang, made a comment about how crashes with code that uses C pointers into NSData objects were fairly common. Ding ding ding!

See, the problem is this. I have code this like at the top of my problem functions:

NSData* theData = [some data blob];
byte* myPointer = [theData bytes];

The problem here is that I then use “myPointer” for the remainder of the function as I read from the data blob. As far as the runtime is concerned, I’m done with “theData” since I never talk about it again throughout the entire function. It doesn’t care about my C pointer, it only sees that I’m no longer talking about “theData“. So it marks it as collectable and the GC comes along at some random point and removes my data from underneath my feet.

The solution is to add a line of code to the end of the function that looks like this:

[theData self];

This is a do-nothing line of code but it DOES force the runtime not to mark the object as collectable since it’s going to be talked about again at the end of the function. This fixes my random crashes! I was able to remove the stupid pragma statements and now everything hums along as it should.

Amazing what you can learn from a humble podcast! Thanks, Late Night Cocoa!

PAKEd Lurches To Life

December 17th, 2008

I’ve got it reading in the table of contents now and loading each file chunk into memory. See?

safariscreensnapz0011

That gray area to the right is going to, hopefully, be a preview pane with some nice features like viewing models and being able to select skins, overviews of BSP files, etc. This might turn out to be way too much work but it’s worth a shot anyway! Plus it’ll give me a chance to work with multiple view classes occupying the same screen space.

Oh yeah, ignore the toolbar. That’s a left over from when I copied the WADEd project to make the PAKEd project!

Stipple Slip

December 16th, 2008

I read a tutorial the other day on OpenGL and it mentioned line stippling. I didn’t know OpenGL could do that but apparently it can! I’ve since added it to a few places in LevelEd and I love how it looks! Here’s a pic of a selected trigger that uses stippled lines to indicate which entities it is targeted at:

picture-1

Speaking of LevelEd, I think the fallout from the recent code re-factoring has finally started to subside. The editor broke in many and varied ways that I didn’t notice until I actually tried to build something in it. Yargh!

I’m just about ready to get going, in earnest, on PAKEd. I want to get the table of contents displaying in an NSOutlineView over the next few days. Wish me luck!

Optimization Woes And Worries

December 13th, 2008

I can’t figure out if I’m screwing up in some terrible way or if the compiler really is at fault here. I have 2 spots in my code, both related to loading files, that will not work in Release mode - only in Debug. In Release, they both randomly crash with some sort of s_zone error (memory related, I believe). I can fix this by wrapping the offending areas of code in pragma statements, like this:

#pragma optimization_level 0

...offending code here...

#pragma optimization_level reset

This allows me to turn off optimizations on just the section of code that is crashing and this does seem to fix it. However, I’m not 100% convinced that my code isn’t at fault in some way. It’s hard to stomach the idea that the compiler is doing something wrong - however, I’ll be damned if I can see why or what in my code is causing the issue.

Ahh well…

Code Complete

December 11th, 2008

Well, obviously NOT, but we’re getting there. The code base is about as generalized as I can make it right now. There are a few other things that I can, and will, break out over time but enough has been done now that I can continue on with the rest of the ToeTag editing suite.

Next up: PAKEd. This will be an easy to use PAK editor with full drag’n'drop functionality and file previews. Should be fun to work on!

I can’t go too quickly though. WADEd still has a bunch of features that need implementing and there is always more to do with LevelEd. I think the realistic truth is that this suite will never be fully finished. Ever. But as long as it always evolves in a positive direction it should be fun to work on and use.

Crackdown Is Fucking Crack

December 9th, 2008

OK, I admit it. I have a Crackdown problem.

My old CD got scratched up too badly so I bought a discounted copy off of Amazon to replace it. When the new game arrived, I popped it into the 360 to verify it would work, downloaded the DLC content I had bought before my last red ring episode and fired it up.

And now I’m playing through it again, god damn it.

I can’t stop myself. Crackdown is gaming crack for me. It’s so easy to throw it in and lose a few hours puttering around, blowing stuff up, and trying to level my agent. I love it and I don’t say that very often about games.

My wife doesn’t fully understand.

“What are you doing?”
“What do you mean?”
“Is that GTA4?”
“No, it’s Crackdown.”
“Didn’t you already play that?”
“Yeah.”
“Oh. Why are you blowing up the regular people?”
“I’m trying to level my guy in explosives. They’re getting in the way but that’s not my problem.”

I’ll probably end up playing through it all again and then again in a few months and then … it’s a vicious cycle.

What I found out is that any boss who is outside and exposed to the sky is dead meat these days. The DLC pack they released with the homing rockets/grenades is a boss killer.

1. Target the boss from 10 or 12 blocks away.
2. Pump grenades into them until they die.

LOVE IT.

WADEd Imports From BSP Files

December 8th, 2008

I mentioned in an earlier post that I was going to get WADEd to import textures from BSP files. I finally got around to trying that feature this morning. The shot below shows what it looks like after you import DM1.BSP. Success! Now you can import other WADs, individual textures, or BSP files to create your new WAD files.

This will be awesome for those times when you download a level and want to use the texture set in there but you don’t know where to get the WAD that the original author used.

Reducing Interface Clutter

December 3rd, 2008

I was adding a feature to WADEd this morning when I had a pang of guilt and had to rethink what I was doing.

See, WADEd already supports the importing of textures. So I was adding another menu option called “Import WADs…” which would let you append the contents of an existing WAD to the one you already have loaded. But then it occured to me: instead of adding another menu option, why not make the existing menu option smarter?

So that’s what I did. There is now a single “Import…” option. If you select images to import, it will process them properly. If you select a WAD file, it opens it up and imports the textures inside. Smart and automatic! I like it.

After getting that working I realized that the same mechanism could be used for extracting textures from BSP files. If the user chooses to import a BSP file, crack it open and drag in the textures. I like it when stuff ‘just works’.