• entries
298
1135
• views
232214

More painstaking code'n

92 views

Layering

Doing proper layering in 2D games sucks. Period. It seems like sprites keep on getting mislayered with other sprites. Object shadows are now properly layered, but they eat up more CPU power now, since they are essentially just normal sprites with color (0,0,0,128). I'm going to have to play with my drawing order some more. Something like this would be ideal:

1) Ground (grass, snow, sand, whatever)
2) Tiles (paths, floors, walls, etc)
5) Sprites (players, bullets, trees, boxes, etc)
6) HUD stuff

Right now player names and healthbars render on the same layer as the player, so names/healthbars vanish under trees and boxes oftentimes. Very annoying. :P

Not null, but not valid either

I finally realized where a lot of the access violation errors I've been getting are coming from. I was under the impression -- for whatever reason -- that Delphi had a primitive-ish garbage collection system that would generally take care of nulling out pointers/objects for me. I was wrong. Thus all of my nice "if blah <> nil then" checks were in vain. Well, not all of them, but several. I can catch if they are null, but not if they point to data that is now invalid. Doh. This is catching a lot on respawn-point lists and outgoing exposives (mines, claymores, etc) lists. Some more fun there. Makes me want to use C# or Java something fierce.

Miscellaneous

And some more random bugs with (the newly added) team-chat, player joining (again!), mines/claymores detonating on dead players, and enigmatic bad packet headers.

I know I'm complaining, but I need to vent somehow. Who better than the readers of my journal? :P (Hehe, sorry, you guys know it's nothing personal :P)

Arctic Outpost: new map!

Our first fan-map has been created by DarkCampainger (yes, intentional mispelling): "Artic Outpost". It's a very attractive Free-For-All map with lots of tight corridors and rooms, as well as a nice open area for bigger brawls. Here's some random screens:

Awesome work, DC! [smile]

Perhaps your mispelling of "Campaigner" was intentional, but your mispelling of "Arctic Outpost" was not. [smile]

I've played this map and it's good fun!

I've also thrown together a few silly maps myself but I'll have to catch you online at some point to give you them :D

p.s. I like the names hiding under trees, you can do some real sneaky ambushes like that :D

What do you recommend is done with the layering issue?

@Samsonite: Hehe. He originally spelt it "Artic Outpost" originally, and it got stuck in my head after having to do a few renaming to the proper word. But now I'll edit it out and nobody has to know. [grin]

@Metorical: The names will still be hidden when you're under trees -- that's not layering, but rather another intentional hiding of the name/healthbar.

@Rob: I'll have to go through each player/sprite beforehand and draw the shadows before and objects/players are drawn. Right now I'm just sticking in the shadow drawing in the line beneath the current draw code in the sprite's Draw procedure. Something ugly like this:

procedure TMapObject.Draw; override;
var
oldCol: TOmegaColor;
begin
oldCol := Self.Color;
Self.SetColor( 0,0,0, 128 );
Inherited;  // Draws normally, but at shadow-colour
Self.SetColor( oldCol );
Inherited;  // Draws normally, at real colours
end;



Basically it was just laziness on my end, since putting it in there was so much easier than actually doing it properly. [grin] But luckily since us coders are renowned for our laziness, nobody should be too tiffed at me about it. :P

Create an account

Register a new account