I didn't get much done today. I pretty much was going all over town all day doing nothing really exciting.
The only real programming I did was involving the enemies in my 4E4 project. I was trying to get the enemy collision detection working, but I found that if I did it the same way I was doing the player collision, there would be so much slowdown , because the player to tile collision was inside a for loop, like the one below:
for(int x = 0; x < mapwidth; x ++){for(int y = 0; y < mapheight; y ++){double oldplayerx = player->getX();double oldplayery = player->getY();if(player->didCollide(tiles[x][y])){player->setX(oldplayerx);player->setY(oldplayery);}}}
if I had put a nested loop in there to test for every enemy, I would have that loop running over 100,000 times. So I decided to just convert the x and y positions of the entity into tile coordinates, and just check that tile. Turns out that is a bitch. I know it shouldn't have been, but I couldn't get it to convert right. I kept getting wrong coordinates. Anyways, after about an hour, I finally got the right formula, so now I only check for collisions about 200 times.
I came up with a flashlight technique today that should make the rest of the level still visible a little, but still really dark instead of black. It goes like this:
1. Render the Level
2. Enable the stencil buffer & draw the flashlight triangle into it
3. Draw a semi-transparent black quad everywhere that the stencil buffer is not drawn into.
This is the first time I have actually worked with the stencil buffer, and its actually a pretty fun to use and handy thing to use. It also will allow me to do some cool effects with the enemies in later levels, I'll make the flashlight beam red, and have enemies only show up if they are in it, so that even though the level is bright, an enemy could sneak up on you. I should have that finished before tomorrow's post, so you guys can get a screenshot, and ukdm can get a feeling of accomplishment that he helped my project be better.
I also finished the weapons class today, so expect some action going on in the next few screens. Now all I have to do is make a good particle emitter class, improve the enemy AI, incorporate the weapons and shot classes, and make the level editor worth using , and then I'm done with the hard stuff (damn thats a long list *sigh* ).
What I really have to get working is the Dogfight Online thing. Right now, you can't host games through a router or a firewall, so you have to be directly hooked into the wall to host a game, but when joining and playing a game, it doesn't matter. I'm going to have to ask around in the Multiplayer Networking forum on how to get around this.
Mark finally wrote up another Artist entry, and here it is.
[bullsh*t]
Hey, it's me again. I've actually worked since my last update. I have been drawing
airplanes for the multiplayer portion of Angels 20. So far I've drawn a MiG-25, a MiG-
21, a MiG-19, and an F-4, all of which look awesome, as you can see in the previous
journal update. They all belong to the 'Vietnam Era' of the multiplayer. For those that
don't know (all of you, pretty much), the multiplayer is going to be split up into a bunch
of eras ranging from World War I to present day and maybe beyond. Each era contains 8
airplanes, 4 for each side (which I think we may want to increase). The first three have
different attributes that they specialize in (like armor or speed) and the fourth will be a
special prototype unit for the gametype(s?) Steal the Prototype, which Sapo made up
'himself'. I think he explained what it was I an earlier journal entry but I'll lay it out
again: each side has a prototype and starts off on an opposite side of the map, to win you
must touch the enemy prototype(thus becoming it) and bring it all the way back to your
base to score. The prototype airplanes are basically a technological generation above all
the other airplanes and are all around better, as would be expected. There could be
several variations on this gametype, including ones with only one prototype where the
player with the most kills as the prototype wins (think juggernaut in Halo 2). Back to
artistry: The only other drawing that I've done is fixing the 128 partisan (the one on the
banner), because after drawing real airplanes from the side, the Partisan looked really
contrived, as well deviating from the huge one I drew. Thomas wanted me to draw a
Partisan in Tundra Camo, but after seeing how I needed to fix the Partisan's basic
structure I decided to do that before anything. I did just finish the Partisan Tundra, but I
may change it for the final version. I think it's going to be a couple days before I get
much of a start on the actual tundra tileset, depending on how many abandoned crack
addicted homeless babies of abused urban street hookers I need to save this weekend.
I've also done a lot of thinking about the multiplayer game dynamic (like if we need
radar, power ups, etc.), but that kind of thing I need to discuss with Sapo more than
babble about in an update.
The only other think I want to say is that Panzer General II is one the greatest games ever,
and if you've never heard of it, join the emaciated male genitalia club, because they
haven't either, you weenie.
[/bullsh*t]
To top off this most excellent journal entry, I present to you:
I really like the Tundra Partisan, and I cant wait till Mark puts the tundra tileset together.
Well, I'll talk to you guys later, its later here.
[EDIT] It's amazing what one can do when properly motivated, this took me about 2 minutes:
I'm so proud of myself.
[/EDIT]
I like the idea that you have for enemies showing up only when they are in your flashlight- Will bring a bit of tension [smile].
The collision detection, on my first tile engine, was quite similar. Total bitch to get an efficient form of collision detection without bringing the engine to its knees[smile]