🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Doors

Published September 05, 2015
Advertisement
In response to input by Servant of the Lord and Eck in my previous entry on bridges, I made a change to how the hexmap tracks object IDs. The result is a system that has not only allowed me to do bridges "properly" (ie, destroyable) but has also allowed me to create doors, something that I have been sorta wondering how I was going to pull off.

A closed door disallows movement:
7xh9Uvo.jpg

With the door open, Crusoe is free to move on through:
aWHUHPH.jpg

The door is implemented as 2 objects: a door frame and a door. The frame is stored in the newly-added AuxID field of the hexmap. The door object is stored in the normal ObjectID field. Both objects subscribe to the Use event. The doorframe stores the ID of its associated door object, so that when it receives a Use event it sends off an Activate event to its door object. The door object listens for Use and sends itself a Deactivate event.

The door object is animated to slide up and down upon activation/deactivation. It also removes itself from the ObjectID slot on deactivation, and re-adds itself upon activation, alternately exposing itself and its doorframe to targeting. The door object is combat-enabled, so it can be destroyed. The frame can be combat-enabled, but there is no point; I simply stash a handle to the door frame in the door object, and upon receipt of a Die event, the door will send a Die event to the door frame as well, removing both objects when killed.

It all works great, just as the change to bridges does. I do get the feeling that I am storing up some technical debt to be handled later, though, in the form of revamping enemy AI in order to take into account doors and bridges and their ability to be destroyed. It has repercussions for targeting (be careful how you target AoE spells, or your defenses or escape routes can be caught up in it), for pathing (do I risk going on the bridge if it leaves me vulnerable to being stranded?), and so forth. Still, the changes are very welcome, and thanks to Servant and Eck for getting my thought processes moving.
8 likes 2 comments

Comments

Eck

Happy to help sir. I'm really digging how polished the game is looking already. What technologies are you using to make this? Are you using premade assets for the hexagon map, the text log window, and the UI Buttons? If so, which ones are you using and do you recommend them?

September 09, 2015 02:18 PM
JTippetts
The engine I'm using is Urho3D, D3D11 build option, MinGW-w64 GCC compiler. All of the game-specific code is written in Lua, using Programmer's Notepad for the text editing. For the assets, I use Blender and the Gimp (for texture creation). All models and textures are created by myself. The UI icons and backgrounds are also modeled in Blender and rendered to texture atlases.
September 10, 2015 02:47 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement