Archive for November, 2007

Progress

Wednesday, November 28th, 2007

Decided to move on from the loading/saving issue and push ahead on editing features.  Once I can create levels from scratch and write them out to MAP files for compilation, I’ll be able to create test cases and custom maps easily.  This will lead to easier debugging in the future so that’s how I’m selling it to myself.

I added the ability to rotate brushes and entities this morning.  I’m trying to orient the editor towards having certain key modifiers always be related to something specific.  For example, the CMD key always allows you to add to your current selection (like it does in Finder).  The SHIFT key does things related to brush faces.  The CONTROL key is related to manipulation of entities/brushes (dragging and rotating them for example).  The OPTION key modifies whatever is going on (for example, when dragging, this key will allow you to drag vertically in the 3D view rather than just side to side).

 I also added some menu items for loading new WADs into the editor.  You have the choice to just load a new WAD and replace your currently loaded texture set or you can append a WAD which will add the new textures into the currently existing set.  I want to eventually have a save menu item which will let you write out your current texture set as a new WAD.  I can read WADs so writing them should be doable.

Dragging, copying, pasting, etc.

Monday, November 26th, 2007

Man, lots of stuff came together over the last little bit.

I have full dragging support in now for entities, brushes and brush faces. I need to figure out how to do edges and vertices next but the framework is in place. The drag code is nice too because it figures out which axis you want to drag on based on your mouse movement and the camera angle. So dragging to the right will pick the right most axis based on your camera view. It’s hard to explain but super intuitive when you’re using it!

Since selecting brush faces works now, I added clicking in the texture browser which naturally led to changing texture assignments on brushes and faces. That all works and is fully supported by the undo/redo system.

Everything, in fact, is fully supported by the undo/redo system. It’s fantastic! I love having it there and being able to add new features to it as they come online has been great. As soon as I get something new working, I immediately hook up the undo/redo support. You’ll thank me later!

Here’s something cool … you can cut, copy and paste pieces of your map between levels. So open up DM2, select some stuff that you want to borrow, hit CMD+C, flip back to your map in another window and hit CMD+V. Voila! Enjoy your borrowed goods. :) This is especially cool because it’s writing and reading to the clipboard in Quake MAP text format so once you copy something, you can paste it into a text editor and save it for later use if you want.

Once the clipboard stuff was working, it was pretty trivial to get duplication set up. Hitting the space bar will duplicate whatever you have selected and offset it slightly.

The editor also now writes out to MAP file format so you can save your work - kind of important, I know. The thing is I must be doing something wrong because currently I can’t load a map that I KNOW compiles, save it out, and compile it again successfully. I have a rounding bug somewhere but I’ll get to the bottom of it. That’s currently my top priority because, well, it’s pretty bad. Heh.

What was great in this process however was the cut/copy/paste functionality. The fact that it works is great but I love the fact that I was able to refactor the code base a few times over and now everything MAP related flows through a single pipeline. Loading a map, saving a map, copying and pasting, and duplication all use the same functions. As a programmer, that satisfies me greatly. :)

Core features march on

Saturday, November 24th, 2007

Yep, spent time on some of the more boring elements today.

I got undo/redo working which was something that was nagging at me. Undo/redo is the sort of feature you need to have implemented at the start of a project like this. I’ve been down this editor road before and I didn’t have a decent undo/redo feature because I didn’t plan ahead properly. Having it working NOW, when the editor barely does anything useful, is key. Now I can make it work flawlessly with any features added in the future!

I also added a few keyboard short cuts for changing the grid size.

Speaking of the grid, dragging of stuff is next up on the Big Board of Features…

Neat Wallpapers

Saturday, November 24th, 2007

I’ve been using these on my Mac for awhile now and figured that someone else out there might like them too! I found these on deviantArt one day while doing Quake searches. Heavily stylized with some brush outlining stuff. I like ‘em!

DM2 - Claustrophobopolis
DM3 - The Abandoned Base
DM4 - The Bad Place
DM6 - The Dark Zone

Grid Lines

Friday, November 23rd, 2007

Sure, not that exciting in the grand scheme of things but a 2D grid is important. And now it’s working…

orthogrid.jpg

Selections

Thursday, November 22nd, 2007

I’ve been messing around with selections lately. How they work, what they should look like, etc. Here’s a shot of what I have so far. Can you figure out which entities and brushes are selected?

selectionsa.jpg

I figure that should be clear enough. Heh.

Health & Ammo

Sunday, November 18th, 2007

Hey, that wasn’t THAT bad. I found the source MAP files that id used to generate the files for the ammo and health boxes in that big source drop that John Romero did awhile back. I imported those into my project, loaded the textures up manually, and used a subset of my MAP loading code to recreate them in the editor. You can now see pretty much everything in your level now. The level itself, monsters, ammo, health, torches. It’s all there!

I even added support for checking an entities spawn flags to determine which model to draw for it (so small vs large ammo, or normal vs rotted vs mega health).

bmodels_1.jpg

bmodels_2.jpg

bmodels_3.jpg

OK, I’m going to have to get back to doing some serious work like undo/redo and selections but this was a fun side journey!

EDIT: That second shot is kind of spooky. If you didn’t know better, you might say that was in the game itself (with lighting turned off, of course). Cool!

Models

Saturday, November 17th, 2007

No, not that kind.

I’ve been busy parsing the .PAK files that come with Quake and extracting the MDL files that live within. What a BITCH it was getting them parsed out correctly but I finally did it.

Grunt gang bang…
modelview_1.jpg

Oh shit…
modelview_2.jpg

This looks like a problem…
modelview_3.jpg

Grab the armor…
modelview_4.jpg

My next eye candy related quest will be to get stuff like ammo and health boxes showing up. Hmm….

Progress

Thursday, November 15th, 2007

Got my bug list down to zero today so I started working on the next large feature which is : selecting things!  Kind of important in a level editor.  I never fully understood the OpenGL selection system but it actually clicked this morning.  I see it clearly in my mind which is wonderful.  I hate working in the dark and under assumptions and just praying that these weird function calls I’m making will do the right thing.

I’m getting that quite a bit with this project.  Other light bulbs that have come on for me have been realizing why and how to put the camera transforms into the MODELVIEW matrix and how poly/plane clipping could be made to work.

So even if this project turns into nothing, I will have learned a lot of really great stuff!  Obviously I’m hoping that it doesn’t turn into nothing but sometimes life takes over.  You know.

Anyway, selection is almost working!  I have it doing the selection correctly wherever I click in the viewport.  I just need to retrieve the results now and figure out specifically who got clicked.  I’m going to get the selection stuff set up to where it’s fast and easy to use before I move on to other features.  It’s pretty important to get it right.

Quicky update

Wednesday, November 14th, 2007

Not that much to show today but I fixed a bunch of bugs. I read one time that if you have a bug you should stop all feature production and fix it right away. This gives you the best chance of having a solid application by the time you’re done. Plus, you don’t save all the bugs up for the end when the earlier bugs might now be hidden by other bugs and it gets really messy.

It’s hard not to work on cool stuff and hunt bugs but I’m going to try that on this app and see how it works out.

One visual thing I did today was get entities to use the same drawing routine as the brushes do so they can pick up the shading goodness. Here’s a quick look:

20071114_shading_thumb.png
::click for huge version::

I think the shading on the various faces (depending on their normal) really helps with depth perception and gives the level viewport a sense of solidity that you just don’t get from full bright textures.

I know other editors have done this in the past - I’m simply acknowledging that they were right. :)