Archive for March, 2012

Sprite Builder Preview Update

March 29, 2012

I was going to go to bed, but I still had the project open so I made some Quick Changes:

What I did:

– Added a direction circle, divided by the ranges. The purple slice is the currently seleced range.
– Zoomed the sprite sheet and simulated the selection box for the frame.
– Added buttons for the States and Frames lists.
– Added file menu.

What I forgot:

– Need buttons for loading/reloading of the sprite sheet.

In short, nothing to see here, please keep moving.


Still Alive

March 29, 2012

It’s been two and a half weeks since my last post, and I spent alot of that time recovering from a flu I caught. While that stopped me in my tracks, it also gave me time to think about what I had been working on and what I want to accomplish right now.

The main thing is that my Framework proved to be overengineered. I was trying to wrap Everything into classes that you would inherit from and use – it was ugly and I had alot of trouble coming up with a decent way to render Everything. I was trying to do too much.

Framework Restart

Instead I decided to put all of that aside and start building a Framework that would only deal with things I’ve seen before, until I have One Of Everything I’ve Already Done.

Over the last couple of days I built a few Sprite classes with varying functions: Animation, Multidirectional, and States. While I haven’t added any of the error-checking, when you use them correctly, they work as I expect them to. Although I’m using the Sprite classes in 2D right now, the transition to 3D will involve only a wrapping interface class.

I shouldn’t ever have to build another Sprite class for XNA again. Yay!

Before I move on to a reusable Tilemap class, I’m building a Sprite Builder application so that you can create sprites in a more visual way, rather than having to punch all of the numbers manually into a file. Here’s what my first version looks like:

There are some things I want to change, but as it is right now it will do everything I want it to. I’ll start adding the code so that it can actually do things rather than just LOOK like it can do things. I’ll likely post a zip/rar somewhere once I have it working and documented enough.

Once I have some tools built, I’ll get back to Ano Sekai. Look forward to it!

Nothing new to show

March 12, 2012

I’ve been plugging at back-end code a bit, every other day,  for the last little while. I haven’t managed to get rid of this cold/flu virus so it makes it hard to do anything for a decent amount of time.

Right now I’ve taken another step back and I’m rebuilding my rebuild. I could post screens of Yet Another Tilemap And Sprite Demo but you don’t really want to see that. I was pretty much hacking everything together as quickly as possible before, with no regard to future use of the code. I quickly coded myself into a corner and then I horribly broke my code when I tried to expand on it.

Now I’m building the game as 2 projects: A game Framework that supports all of the things I need for it to, and The Game Itself which uses the Framework and helps me to build it. The framework automates common tasks like entity-blockmap collisions, and only requires you to extend them by supplying them with custom data and AI/gamepad processing.

Like many things, the Road To Better Coding is filled with many obstacles, and making mistakes is really the only way I know how to code better. I’m also a stubborn mule, refusing to encumber myself with complicated patterns and practices I think I have no use for. I’ll get there. Just you wait.

Comparisons with other Games

March 6, 2012

As I work on the latest code, I’m listening to Warcraft II music and idly thinking about games Ano Sekai has been compared with so far, I’m realising there’s enough in common with Warcraft III that it’s worth a mention. Some random thoughts:


This is the one I get the most. Sure, there’s a block world. Yep, there’s building. I’ve got an inventory screen and crafting in as well. Wouldn’t you beleive it, there’s a day/night cycle too. So far you really can’t tell it from Minecraft. It may be that it will still look like Minecraft in the end as well!

All I can say to this is that while there may be some digging, it isn’t the focus of most of the game. Survival mode was what got me excited about Minecraft, and it was very severely lacking there. My focus is to make Minecraft what I wanted it to be, and then a little more.

Dwarf Fortress

Since much of the focus of the game is on the NPCs, I can see how one would make the connection to DF. You will certainly be giving orders to your NPCs to build and harvest. I’m not going to be going quite as in depth as DF has, though. Maybe a better comparison would be Dungeon Keeper?

Tower Defense

This one is stretching it for me. Yes, you’ll be putting time into protecting an area from roaming monsters. In my game the towers move, though. I think I’ve played at most 2 tower defense games, so I’m not really qualified to say much more about it than this.

Warcraft III

I picked III specifically because of the heroes. I think that you could come pretty close to what I’m doing if you said I was making a MC/WC3 crossover. In WC you set up a thriving base and head out with a Hero to discover and conquer the rest of the map.

Once the town is thriving, you’re going to form a raiding party and head out with them to take down marks. I’d like to set up enemy camps and fortresses for you to raid. Heck, if you were good enough, perhaps raiding an enemy camp at the start of the game could provide a great starting area!

That’s enough of a distraction for now. Back to work!

Infinitely sized worlds’ Design

March 6, 2012

Feeling good enough to do some design today!

The gist

As you saw in the video, the game world was limited to just what was on the screen, and anything that left that area would immediately be destroyed. That isn’t how things should be. Instead, the world should technically be able to go in all 4 directions infinitely. I still want to have worlds that wrap around, so I’ll take care of that as well.

One method I’ve seen to provide that “infinite” feel is to divide the world into loadable chunks. The idea behind this is fairly simple: For any chunk of the world that hasn’t yet been seen, it should be generated by the in-game chunk generator. For any chunk of the world that HAS been seen, load it from disk.

RAM limitations

If we had an infinite amount of ram, then we would be able to keep every chunk in a great big array. I’m developing and playing my game on what would be considered a low-end machine, and that means my resources are limited. I need to build around those limitations. I suspect that even the highest-end machines don’t have infinite ram either.

Since ram is limited, I have to consider a way that will use a limited amount of ram but still have it seem like the world is endless. In order to do this, I only want a certain number of chunks around the player to be active at any given time. When the player has moved in such a way as to make any chunks inactive (they’re out of the player’s view radius) then they are saved to disk and unloaded. At the same time, when the player should be able to see new chunks, they either have to be created (not yet seen the chunk) or loaded from disk (have seen and has already been saved).

When and how to create/load and unload

I’m going to divide the world into even-sized box shapes, each frame I can check to see if the player is in a different chunk than he was in the last frame. If so, we would move all chunks that are now outside of the new viewable area into a “cleanup chunks” list, and then add new empty chunks to a “new chunks” list.

Each frame afterward, we would save one chunk from the “cleanup chunks” list, and load or create one chunk in the “new chunks” list.

When the game is quit, all active chunks would be saved to file before we exit.

Dealing with wraparound

I like the idea of an infinite amount of play space, but it really isn’t needed. I have tried to go to The End Of The World in Minecraft, and I gave up long before I got close. There’s just no need to have that much space. I’m not going to be doing that.

An entire world will be a large rectangular map. Right now, I’m generating chaotically random worlds – there’s no rhyme or reason to the placement of anything, Anywhere Is Fine. I don’t have to deal with the placement of things yet, but I do have to deal with world wraparound. Since the world has a set size, chunks at X= 0 and 255 will share an edge, and objects will have to be able to see each other from one side to the other.

I plan on setting it up so that when the player reaches the new chunk, he will be suspended in space and the chunk under him will be replaced with the one that he’s moving into, and then he’ll be shoved back the entire width of the chunk. This will keep him in the 0..chunk_width play space – and he will never actually leave it. When he has “left” it, everything moves in such a way as to keep him within it. Chunks at the world’s edge are treated as a relatively positioned chunk, the same way as non-bordered chunks are. This saves me the trouble of having to deal with tricky math at the seams, since everything is positioned relative to the player rather than in absolute world coordinates.

Looking forward, I’m going to eventually be restricting placement of resources to a grid, and afterward I’ll be making the world into a 2d blockmap. Once these systems are in place, I’ll be once again looking at libnoise to generate ‘pretty’ worlds, and I’ll have to deal with world-edge seams. I’ll deal with that when I get there.

Wrapping up

It seems pretty straightforward now that I’ve written it all out. After a break, I’m gonna get started on the code.


March 5, 2012

I’ve been sick since the weekend, and it’s only getting worse.. Want to get back to the code asap, but I guess I have to get better first. Until next time..

Gamedev Video Diary 9

March 4, 2012

Since I see some of you are interested in seeing the game in action, I threw together a video right quick. As always, sorry about the rambling and whatever other suckiness is in there. Hell, sorry about the horribad game I’m showing off.

This is about all I can pull off in 2 weeks’ worth of time. I have many of the “One Of Everything”s in already. I want One Of All Of These in as well:

  • multiple chunks
  • making some materials harder to find
  • minimap with important things on it
  • proper inventory with icons rather than words
  • block damage
  • recovery bar from actions
  • weapons and armor with different atk/def scores
  • equipping said weapons and armor
  • party forming
  • placing blocks in a grid
  • blacksmith class
  • royalty class
  • bosses

Almost done Item Creation

March 2, 2012

I shot my screen:

What you see above is my glorious Item Creation Interface, as described in the previous post. Well, almost. I said I was going to make failing recipes show up in red, but the way I have the string output stuff set up, it took less time for me to just write the name covered with xxxx instead.

It gets the point across. “Hmmm, I wonder what this xxxxx is that I don’t have enough copper bars for? I better make a couple more of them then.” I mean the thing is made out of 10 of them, so it’s gonna be good, right?!

While you can move the cursor on the workbench/forge/whatever panel, you can’t actually create anything with the A button yet. I haven’t coded in that part. I’ll do it tomorrow, it shouldn’t take any time.

A follow-up screenie:

Here, the forge is being ‘used’, and it has a different list of things it can create. It isn’t very long yet, though. I’ll finish this stuff up tomorrow and start the player with next to no items!

I want to take the weekend off from coding/designing/posting, but who knows. I’m thinking about making a video, but I still don’t think I have enough to show off yet. Maybe I will anyways. Whatever.

Item creation Interface Design

March 1, 2012

Since I’m writing it all out anyways, I may as well write it out as a post.

First up, I know I don’t want to have to arrange items on a surface, like in Minecraft. Terraria’s item creation sets up a list of things you can make with what you have, and you scroll through that list and pick the one you want. That will work for now.

Let’s assume the following simple recipes:


  • Workbench: Wood (5)


  • Copper Bar: Copper Ore (5)


  • Workbench: Wood (5)
  • Chest: Wood (5)
  • Copper Sword: Copper Bar (5)
  • Copper Armor: Copper Bar (10)
  • Copper Shield: Copper Bar (2), Wood (2)

(Nevermind the shield recipe, I just wanted to have a recipe with multiple materials so I’ll have an example to use for when I actually code things. I also purposefully have workbench in two different lists to force me to deal with overlap. The hellstone forge in Terraria, for instance, can create all of the items that the normal forge can, along with more..)

Now let’s say you’ve got a couple of stacks of wood and copper ores. When you ‘use’ a forge or workbench, all recipes available via that object should appear in a 2nd pane next to your item list. (Let’s see if I can get html tables to work in wordpress:)


>copper sword<
wood (99)
wood (99)
copper ore (99)
copper ore (99)
copper bar (8)


Workbench: Wood (5)
[Chest: Wood (5)]
Copper Sword: Copper Bar (5)
Copper Armor: Copper Bar (10)
Copper Shield: Copper Bar (2), Wood (2)

(Meh, that doesn’t look all that great, but it serves its purpose)

The workbench shows all things you can make using it, and those that you don’t have materials enough for will appear in red. The selection cursor will be locked to the righthand pane while you’re in the item creation interface, since you don’t have any reason to be choosing your own items.

Here I have the shield selected, and when I press A, it will make one and place it in the next available {empty} slot or add to the first similar stack (unless there’s no room!).

The only tricky part is how I’m going to define the recipes, because I don’t want it to be a chore to add new recipe sets to objects. I’m going to need 3 recipe lists, and I have to deal with overlaps.

Hopefully my next post will be a screenshot of a fully working interface.

Inventory Interface Complete

March 1, 2012

I’m on Candid Camera?!:

Here I’ve dropped a bunch of items from inventory, moved some items into the chest, and split a stack of (99) into three. You can drop items from the other inventory too, in the case that it’s faster to steal that way. You actually need to move the cursor to an {empty} spot and select it in order to get the item into your inventory. It’s a little faster to pop things out and walk into them.

I’ve also added PlayerEntity::OnUse() so that you can move things around in your own inventory outside of the item swapping interface. You can’t move stuff while you’re not in the inventory interface because then you won’t be able to do anything while you’re looking at yourself. It is a little confusing having two cursors in your inventory, though. I might drop the > < one and use only the [ ] and screw it if you can’t do anything while you’re in there.

I lost a bunch of time to code cleanup today, since I’m not looking very far ahead of where I am at any given time. I’m not familiar with regular practices, so I can’t plan for them yet.

I’m probably going to code in 2D inventories soon. Obviously I won’t be using text-based inventories in the actual game, but it’s faster to get things in if I do it this way for now.

I’m done the stuff I wanted to do, so now I can start the item creation interface. I haven’t actually planned this part out yet, so I’ve got some designing to do. It won’t be like Minecraft, I can tell you that much. It might be like Terraria’s, just to get it in, but iunno yet.