Friday, December 4, 2015

I Take That Back

Correction: the textbox now supports click-and-drag highlighting as well as cutting/copying/pasting with the clipboard.  So far, the multi-line textbox has been a separate class from the single-line textbox, but I created an option to make it single-line, so I think I will completely replace the single-line textbox with this one.  I think it's as far as I will take it.  It has all the most important features now.  Should make writing scripts much more convenient.  Now all I need to do is attach a scrollbar to the textbox in the script editor.

Now that I think of it, it would be nice to be able to scroll through the text with the scrollwheel.  Should be easy to implement.

Anyway, sorry for all the UI talk.  Seems irrelevant to Sever, but this is a dev blog and I'm developing the UI right now. Thanks for reading even though it's a bit boring right now.

clevceo

Thursday, December 3, 2015

Multi-line Textbox

I know I said in my last post that I wouldn't add any more to the multi-line textbox, but it was nagging at me, so I did it anyway.  You can now highlight text, and you can hold down a key for it to repeat.  Both of these changes will be extremely convenient when writing scripts.  However, it does not yet support click-and-drag highlighting.  Just shift-click or shift-arrow-key.  But that alone will be extremely handy.  Anyway, thanks for reading!

clevceo

Tuesday, December 1, 2015

Multi-line Textbox, Scripting

I just finished adding multiple-line functionality to my TextBox class.  Unfortunately, it's still a pretty simple control.  You can't highlight anything, and you can't hold buttons down to repeat them.  For example, if you want to delete a large section of text, you can't select the whole thing and delete it or even press and hold backspace.  You have to repeatedly press backspace over and over until it's gone.

It can be a bit of a pain, but I think I'll leave it be until I feel I really need it.  If you read my early posts on this blog when I first started Sever, you'll notice that I was easily sidetracked with things like this.  I spent way more time than I should have on the user interface and input code.  Given, they were handy, but they were much more than I needed and the extra time spent on them could have been spent making progress on Sever.  Hence the fact that I never finished it.  The main reason why I'm actually making progress this time around is because I'm not allowing myself to get sidetracked.

Anyway, that's why I'm not going to add on to the multi-line textbox until I decide that I really need to.  I probably will at some point, but at the moment, I want to keep moving.  It does what I need it to do.  It allows me to write scripts directly into the editor, which is extremely convenient.  From here, I'll be able to move much faster.

I want to start adding scripting to more than just hotspots.  One on the list is a script that runs at the beginning of a level.  This will be extremely handy if the level won't be the same every time it is loaded.  Parts of it can be randomized, or it can change based on the player's choices in previous levels, etc.

I also want to add the ability to script the AI.  There will be levels where the AI is not really intelligent.  It will do one specific thing that can be easily scripted.  Also, the scripts could be used merely as a state-machine to switch between AI modes (of course, I'll need to build those modes first).

Anyway, I'm excited to move forward with this.  I feel like everything is finally beginning to come together.  It's really close to the point where I can start building real, playable levels.  Of course, I won't be building an actual campaign for another while.  I'll be experimenting with different level ideas until I have an extensive list of levels that I can compile into a campaign.  And I'm sure I'll be tweaking the gameplay as I go.  But the main thing is that I'll finally be able to move beyond the game engine to the game itself.  I've started over on Sever so many times, and I've never reached this point.  I'm excited.  I only hope that the game is fun in the end.

Thanks for reading, please comment!

clevceo

Wednesday, November 25, 2015

Scripting

Just had to post a screenshot of my first successfully executed script within the game:

The script was 'showMessage("It worked!");'.  Not very exciting, but it felt pretty good to see it work.
This was executed by building a node over a hotspot.  The scripting language I'm using is Lua via NLua, which wraps around Lua to make it more accessible to .NET.  There is currently only one method within Sever available to Lua: showMessage(string message).  But that's just fine.  The hardest part is behind me.  The next feature I might add to the scripting is the ability to switch to another map.

This is my first experience with scripting, so we'll see how it goes.  Hopefully I don't botch it.

Something tedious ahead of me that I'm not really looking forward to is building upon my current TextBox class to make it support multiple lines.  I have a script editor window with a big textbox, but you can only stay on one line (that's a lot of wasted space).  But I'm not sure if I'll do that now or wait until I have a script that needs it.  We'll see.  In the meantime, I might just add a way to run a script from a file.  That might hold me over.

Anyway, just wanted to share my victory.  Thanks for reading!

clevceo

Hotspots

I added hotspots to the game.  A hotspot is a special point on the map that you can build a node on top of.  Different hotspots will do different things when built upon.  For example, one hotspot might advance the player to the next level while another might simply allow the user to build a node type that can't be built anywhere else.

It actually took a long time to integrate hotspots into the game.  There were so many little places that I needed to touch in the code.  But the hard part is over.  Building onto them won't be too hard.  I want be able to add scripts to them as well as adding a few nonscripted options, such as allowing a special node type to be built on top of them.

At some point, I would like to have regions in the map that trigger scripts when the player enters them, but that will have to come later.  For now, hotspots will be my go-to script triggers.

Not a very exciting post to read, but it was exciting for me to write it.  Hotspots will give me much more to work with when designing levels.

Thanks for reading!

clevceo

Monday, November 23, 2015

AI, Puzzles, Design

I rewrote the AI over the past couple days.  Instead of running blindly into obstacles before trying to go around, it now avoids them from the beginning.  Also, it retracts useless nodes when the system density is low.  It still needs polish, but it's much more effective and looks less stupid than it did before.

The method I used is actually different than what I was planning on using before.  I had an idea for a while that I felt pretty sure about.  But a few nights ago, it clicked in my mind that it would be extremely inefficient.  Fortunately, I quickly thought of a new way that would be much easier to implement and more efficient.  It works pretty well.

After it's polished up a bit, the next step is to build the hunting state and the state machine that controls the transitions between states.  At that point, the AI will be able to function normally and appear intelligent.

However, I'm undecided whether I'll keep focusing on the AI right now or put it off for later.  After I got the new AI working, I started thinking of level ideas.  Oddly enough, none of them involved the AI.  I thought first of some puzzles.  Yeah, I know, how are there puzzles in a strategy game?  Well, this strategy game is different and the mechanics actually mesh pretty well with puzzles.  Here are some screens of a puzzle I made (excuse the placeholder graphics, they're terrible):


At first glance, this looks like a simple maze.  However, there is only one way through.

One of the mechanics of this game is that the farther away you build the node, the bigger it gets.  You'll notice the wide dark circle around the dark green node.  If the new node was built within that circle, the node would be smaller.  Outside of it, it's large, like the white circle.  It doesn't fit.


Once again, it's stretching too far.


This is the only way through.

This would be one of the earlier, easier puzzles.  Later levels would be much more difficult.  I plan to create more puzzles like this to accompany the AI fighting levels.  I know that puzzles and combat are very different and may feel awkward squeezed into the same game.  If people don't like it, then so be it.  But I want to explore these mechanics to their fullest and I think there's a lot of potential here.

I'm thinking my next step in the development will be integrating some simple scripting, at least enough to allow transitioning to new maps.  That way, I can start stringing them together.  I want to start giving the game a skeleton structure.  Once I begin making a real level that requires more development of the AI, then I'll probably come back to it.

The combat will come in later levels.  I want it to be clear that the combat isn't the point of the game.  Instead, it's only another application of the core mechanics.

I have a few more mechanics up my sleeve that expand upon the core idea and make things more interesting.

It's interesting to look back at my early posts on this blog and see how far Sever has come.  A long time ago, I was dreaming about fog of war and AI and had no idea how I would implement them.  In fact, many times I gave up hope that I would ever be able to do it.  And now here they are.  Now my only worry is about the actual game design.  I'm past the technical part.  I know I can do that.  Now on to something I have no experience with at all.

I've never designed a game.  Okay, I've made my own variant of minesweeper, and I think it's pretty fun (I'm probably the only one), but that was a pretty simple game to design, to be honest.  This game will be much bigger (though relatively small compared to mainstream games).

I am trying to design it by Jonathan Blow's philosophy.  I want the mechanics to inspire the levels and not the other way around.  Anything that isn't true to them will be cut from the game.  Of course, Sever would never compare to Braid, but it doesn't need to.  This project is more for my own experience.  And it's been a good experience so far.

Anyway, enough of my ramblings.  Thanks for reading!

clevceo

Wednesday, November 18, 2015

Back, Not Sure For How Long

I got a new laptop, installed VS 2015, and installed the new version of MonoGame, so I thought it might be fun to transfer Sever over to the new setup.  I did so, ran into a few of the errors I'd been having before I gave up last time, and instead of giving up again, I found myself digging into it and fixing them.  After a few hours, I'd progressed from fixing a few bugs to actually getting the fog of war working properly, which was something that had burnt me out last time around.

The fog of war was already displaying correctly, but invisible objects were still being drawn behind the fog.  For the player, this didn't make much of a difference.  However, the AI didn't know which objects were behind the fog, so it saw everything.  Now it knows.  It sounds easy, but it was quite the task.

From here, I will either working on AI pathing or begin work on scripting.  Both are elephants in the room that need to be completed before much progress can be made.

If you can tell, I think I could easily dive back into the development if I wanted to.  However, I'm so busy these days that I'm not sure how long it will last before it's on the backburner again.  Anyway, I'm going to give it a go and see what happens.

Thanks for reading!

clevceo