Tank Attack update

Community Forums/Showcase/Tank Attack update

sswift(Posted 2003) [#1]
The last couple weeks, tweaking my shadow system and adding new features to it kept me from working on my tank game, but instead of working on the shadow system today I decided to try to finish up something on my tank game which was half done.

What I've just added is a tag system and a way to edit the tags in my level editor.

Tags are like generic bits of data. Place an object somewhere in the level, point it in a certain direction, and give it an id number, and you have a basic tag.

If you have an ID of 1, the game might interpret that to be a spawn location, and the orientation of the tag to be the direction which a player faces when they spawn there.

And ID of 2 might be something else entirely.

An ID alone though is no fun. So tags have additional slots for integer, float, and string data. Which of these slots a particular tag ID uses does not matter to the tag system. The game interprets the data. The tag system merely provides a way to make tags for a level visible or invisible, change their position and orientation, and save, and load them.

This is in many ways a better way of doing things than having a bunch of specific types deicated to a spefici type of level object. Instead of having one type for teleporters, one for player spawns, one for a nin interactive decorative item, an invisible one to define a path, you just have the generalized tag which can be anything. This makes creating the tag editor a lot simpler, and allows you to add a new tag without modifying any code other than the game systems which interpret what each tag does. And you can use the same functions to operate on all tags, so you can positon or rotate any one of them with a single function.

So that's what I've just gotten done. This means that with just a little bit more code I'll finally be able to choose and transmit real spawn locations to the other players in a network game instead of spawning everyone at the same point, and I'm not that far off from having weapon spawn locations.


Anthony Flack(Posted 2003) [#2]
My game does this too, at least at the editor/level loading stage - although my version is a little more hacked in (as usual!) Some of the tags spawn different types of objects - according to their associated data - and then delete themselves, when the level initialises. Other ones stick around and become the visible decals (the whole thing sprang from what was originally a decal placing editor)


*(Posted 2003) [#3]
Hunted does this too :) its much easier doing it that way with hundreds of entities I have a string for id so you can have a item called 'Elevator door switch' activate a door called 'Elevator door' :)


GNS(Posted 2003) [#4]
This sounds like a nice approach. I may change my level editor over to a tag based system. :D


sswift(Posted 2003) [#5]
"I have a string for id so you can have a item called 'Elevator door switch' activate a door called 'Elevator door' :)"

In my system what I might do is go:

Switch:
ID = 5 ; This is a press switch
Data_Int[0]=123 ; What this switch triggers

Door:
ID = 10
Data_Int[0]=123 ; This doors unique identifying number.


But on second thought... Perhaps it would be better if the ID numbers for each tag were unique, and there was a function parameter to define what they did instead. Or their function could just be the first integer data always.

The only problem with automatically choosing ID's for every tag is that I have to scan through all tags every time I add a tag so I can find a suitable available number, and I cannoy ever change the ID number of an existing tag without changing every reference to it which would be too complicated to bother with. But that's okay cause there's no compelling reason to change a tag's ID number.