Building out the level editor

The level editor's functions

I've put some more work into fleshing out the level editor. Namely, I've added options to begin adding windows, wall objects (posters, clocks, basically anything that can go on a wall that I want the player to be able to interact with), wall/floor decals (visual things that don't have interaction applied to them like blood splatter, bullet holes, cracks, dirt, etc) and most importantly, a settings menu. The reason why the settings of specific objects is important is because this ability to retrieve an object's settings, and modify them is critical to being able to create proper saved levels. This way, when I save a level, I can save each individual object's state (damage, open status, placement, anything else I want to add) instead of just its location in the game world.

Settings Implementation

If you look at the prior doors video, you will see that when I selected doors as the object to manipulate, a graphical interface of a couple buttons popped up. While this worked fine, it had a major problem in that every door only had the same options available and those options were only toggleable (sp?) on and off rather than any numerical settings. The way I got around this is for every object in the game to be able to have an Interface applied to it that allows the retrieval of a list of settings and also for that same list of settings to be modified and then applied to the object. So when I select doors, the door appropriate settings become available for modification. I can also go so far as to giving different types of doors, different additional options. For instance, if a door is a sliding door instead of a swing open type door, the bulk of the options pertaining to which way a door will swing when opened will be moot so they just won't exist for the sliding door. This type of personalized list of settings can be placed onto any object in the game as long as I decide to apply the Interface to that object.

The importance of settings to the saving/loading of levels

I've been trying to wrap my head around how I was going to save not just the layout and positions of the objects in the game, but also the current health, open or closed, locked or unlocked, position and all that other important information as well and implementing the settings is sort of a two birds with one stone deal. Now when I get around to saving the levels and loading them up, I can just retrieve the settings from each individual object and save that information. When loading up a level, it can then implement the status of every object as it places them into the game world. Yay!

Search Function

Another new little bit that I felt was important to the level editor is the ability to search through the available options. I'm going to assume that later on, I'll have a ton of assets and it'd be painful to have to manually scroll through everything to find what I want. So, I went ahead and implemented a search feature. In the future, I plan to further break down the search results to specific types of the searched item or maybe even display a list of results to choose from rather than just regulating the ones that you can scroll to in the editor. This may seem pretty easy (and if you know what you're doing, it is) but it was a pretty big ordeal for me.

Text Input

XNA does not inherently support keyboard input. It supports the chatpad (yay?) but unless I decide to pull into the game XBL stuff (which I don't want to), there's nothing built in for getting text. The first thing you'd think to do is to just check the keyboard state for every letter and determine if a key was up the previous update cycle, and is now down indicating that a key was pressed. Then you could figure out which key was pressed but the problem with that is that the game will only update 60 times a second and there's a chance that there might be slowdown causing keys to be missed. A bigger problem still is that what if there are multiple keys pressed during one update? Most people can type faster than 1 key per 1/60th a second. Maybe not consistently, but there are times when you're typing and the difference in time between two key presses is smaller than 16ms. I'm already rambling but long story short, I set up a text buffer that would catch every key and then log them in the right order. Shit wasn't easy, but nothing ever is until you learn how to do it.

Windows, Wall Objects and Decals

I've also added the above mentioned types to the editor for placement and settings. Windows is self explanatory but the other two may not be -_-;; Wall Objects are any objects that are placed upon a wall that can be interacted with by the player or other game entities. These are things like paintings, barricades, Shelving, etc. Decals (floor and wall) are art only things that can be placed in the game world. This would be things like bullet holes, scuffs, dirt, blood, whatever else. These things could also be implemented in a way so that the player could initiate an action on them such as cleaning something up or whatnot (and they also add visual obstructions such as if you were to paint a window black) but they are things that can not be picked up or used in any physical manner.

Modify an object already in the world

One of the last things I did was implement object modification. Before, whenever I wanted an object to have different options set, I would have to create that object and have it replace the existing one. Due to the way I've got the whole settings thing (above) implemented, now I can select an object and directly modify its state. Wooo! Of course, it wasn't a big hassle to copy an object's settings, then change what I want, then place it back into the world but this just feels nicer. With the added bonus of it changing on the fly in the game world so I can see what it's going to look like.

Back to Work

Anyway, just a quick update. I'm going to get back into it now. I've also been putting in some work on adding Vinny to that Megaman X GiantBomb thing from a while back but since I'm not doing a jam type thing like before, it's mostly super short sessions where I'll draw a sprite, implement an attack, brainstorm ideas. . . that kind of thing. I haven't dropped it, it's still coming eventually but since most of the work is bits and pieces, there isn't much to show. I did just implement an attack that I think ya'll will enjoy. . . maybe. . . maybe hate. I dunno. This is a boring wall of text for most, but hopefully some of you'll get a bit of enjoyment/insight from this madness.

Start the Conversation
1 Comments
Posted by Fobwashed

The level editor's functions

I've put some more work into fleshing out the level editor. Namely, I've added options to begin adding windows, wall objects (posters, clocks, basically anything that can go on a wall that I want the player to be able to interact with), wall/floor decals (visual things that don't have interaction applied to them like blood splatter, bullet holes, cracks, dirt, etc) and most importantly, a settings menu. The reason why the settings of specific objects is important is because this ability to retrieve an object's settings, and modify them is critical to being able to create proper saved levels. This way, when I save a level, I can save each individual object's state (damage, open status, placement, anything else I want to add) instead of just its location in the game world.

Settings Implementation

If you look at the prior doors video, you will see that when I selected doors as the object to manipulate, a graphical interface of a couple buttons popped up. While this worked fine, it had a major problem in that every door only had the same options available and those options were only toggleable (sp?) on and off rather than any numerical settings. The way I got around this is for every object in the game to be able to have an Interface applied to it that allows the retrieval of a list of settings and also for that same list of settings to be modified and then applied to the object. So when I select doors, the door appropriate settings become available for modification. I can also go so far as to giving different types of doors, different additional options. For instance, if a door is a sliding door instead of a swing open type door, the bulk of the options pertaining to which way a door will swing when opened will be moot so they just won't exist for the sliding door. This type of personalized list of settings can be placed onto any object in the game as long as I decide to apply the Interface to that object.

The importance of settings to the saving/loading of levels

I've been trying to wrap my head around how I was going to save not just the layout and positions of the objects in the game, but also the current health, open or closed, locked or unlocked, position and all that other important information as well and implementing the settings is sort of a two birds with one stone deal. Now when I get around to saving the levels and loading them up, I can just retrieve the settings from each individual object and save that information. When loading up a level, it can then implement the status of every object as it places them into the game world. Yay!

Search Function

Another new little bit that I felt was important to the level editor is the ability to search through the available options. I'm going to assume that later on, I'll have a ton of assets and it'd be painful to have to manually scroll through everything to find what I want. So, I went ahead and implemented a search feature. In the future, I plan to further break down the search results to specific types of the searched item or maybe even display a list of results to choose from rather than just regulating the ones that you can scroll to in the editor. This may seem pretty easy (and if you know what you're doing, it is) but it was a pretty big ordeal for me.

Text Input

XNA does not inherently support keyboard input. It supports the chatpad (yay?) but unless I decide to pull into the game XBL stuff (which I don't want to), there's nothing built in for getting text. The first thing you'd think to do is to just check the keyboard state for every letter and determine if a key was up the previous update cycle, and is now down indicating that a key was pressed. Then you could figure out which key was pressed but the problem with that is that the game will only update 60 times a second and there's a chance that there might be slowdown causing keys to be missed. A bigger problem still is that what if there are multiple keys pressed during one update? Most people can type faster than 1 key per 1/60th a second. Maybe not consistently, but there are times when you're typing and the difference in time between two key presses is smaller than 16ms. I'm already rambling but long story short, I set up a text buffer that would catch every key and then log them in the right order. Shit wasn't easy, but nothing ever is until you learn how to do it.

Windows, Wall Objects and Decals

I've also added the above mentioned types to the editor for placement and settings. Windows is self explanatory but the other two may not be -_-;; Wall Objects are any objects that are placed upon a wall that can be interacted with by the player or other game entities. These are things like paintings, barricades, Shelving, etc. Decals (floor and wall) are art only things that can be placed in the game world. This would be things like bullet holes, scuffs, dirt, blood, whatever else. These things could also be implemented in a way so that the player could initiate an action on them such as cleaning something up or whatnot (and they also add visual obstructions such as if you were to paint a window black) but they are things that can not be picked up or used in any physical manner.

Modify an object already in the world

One of the last things I did was implement object modification. Before, whenever I wanted an object to have different options set, I would have to create that object and have it replace the existing one. Due to the way I've got the whole settings thing (above) implemented, now I can select an object and directly modify its state. Wooo! Of course, it wasn't a big hassle to copy an object's settings, then change what I want, then place it back into the world but this just feels nicer. With the added bonus of it changing on the fly in the game world so I can see what it's going to look like.

Back to Work

Anyway, just a quick update. I'm going to get back into it now. I've also been putting in some work on adding Vinny to that Megaman X GiantBomb thing from a while back but since I'm not doing a jam type thing like before, it's mostly super short sessions where I'll draw a sprite, implement an attack, brainstorm ideas. . . that kind of thing. I haven't dropped it, it's still coming eventually but since most of the work is bits and pieces, there isn't much to show. I did just implement an attack that I think ya'll will enjoy. . . maybe. . . maybe hate. I dunno. This is a boring wall of text for most, but hopefully some of you'll get a bit of enjoyment/insight from this madness.