Archive for the ‘Coding’ Category

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.

Advertisements

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.

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.

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.

Inventory Swapping working

February 29, 2012

Super screenshot deluxe:

There’s still lots of adjusting to do and rebuilding of sections, but I have a very basic item swapping interface partially working now. The way I have it set up is that you can use it in realtime, or pause the game to do what you wanted. Here I moved a few items to the a chest, and I’m about to move the forge.

  • The > < indicates the item you have for use – so you can defend yourself in realtime as you go through your box.
  • The [ ] marks where you are in inventory, and the * * shows what you want to swap with.

I have it set for you to quickly exit out of any inventory you entered by hitting the right shoulder button again while still selecting the object with your cursor.

You can inspect or swap with inventories of any Creature right now – including the Monsters. I’ll remove this later, but then add it back in as a steal ability for theives. There will be a time limit for viewing/swapping that will be rolled based on your stats and the monster’s stats. Some monsters won’t let you even peek, though. ┐(  ̄ー ̄)┌

Not complete is the item dropping and stack splitting. I’m tired, so I might not get to it tonight.

After I finish this, I’m going to move right into the item creation interface.

Moving in the right direction

February 29, 2012

Two screenshots this post, here’s the first:

Points of note:

  • Gamepad input tips in upper right
  • Certain things can be “used”; in the above screenshot the NPC is shown to be useable
  • Monsters can no longer pick up collectables, they’re shown pushing the ones above
  • Once an inventory is full, no new items can be added, and you will push items around like the monsters do

Second screenshot:

Notes of point:

  • 3 new useable blocks: Workbench, Chest, and Forge
  • Inventory “empty” slots

I want to recode a bunch of the code to make use of a new Item::OnUse() function. I’ll also be adding some Creature::OnUse() and Chest::OnUse() overrides, and then I’ll build the item swapping interface. Then I’ll add the Forge::OnUse() and Player::OnUse() and build the item crafting interface.

Added a little content

February 28, 2012

It ain’t much, but it points at one of the things I’m working on next.

I added Tree ‘blocks’ and Wood items. Chopping down trees with a pickaxe is a little odd, but I’ll leave that for now.

Also, I made the stone walls look more.. wall-like. They stand out from the natural rock better now. I’ve been trying not to get too fancy with the graphics, but I think it’s a good change.

I’m gonna try to get that creature info stuff outta there tomorrow.

Fixing Bugs

February 28, 2012

Screenshot!

As you can see, I increased the base size of the entities. The collectables were too hard to see, and the new size of everything is acceptable.

I fixed quite a few bugs today. Among them was the Door Bug (seen above). With this bug, I originally had it so that when you opened a door, the ClosedDoor object would create an OpenDoor object and kill itself, and the reverse for closing an OpenDoor object. (I know it was a terribad idea, shut up.) When an entity dies, by default it drops all of its inventory. All blocks contain one item of themselves, so that when you break them down, you can pick them up again.

When you opened a door, it would drop a door collectable. Alot of the time, the collectable would be inside the door, so the door would stay open, but if you had two doors next to each other, one might drop a door collectable into the other, which would then drop a door item of its own… and if those two pushed each other out of one of the open doors, the door would close and create another door item.

I froze the game one time, screwing around with the bug – it had created a big pile of like 10+ door drops and got stuck in some infinite loop somehow. It was sooo crazy. Notice that one of the monsters chasing me in the screenshot above has picked up 16 doors. Yeeeeaahhh.

I cleared some other crappy bugs not worth mentioning, as well. One bug I haven’t bothered with yet is shown below:

I placed the Town Crystal, upgraded an NPC, and was going to pick it back up… but when I broke down the Crystal, the NPC was touching it and picked it up on me! While I’m not pleased that they can, I’ll leave that alone for now.

Let me direct your attention to my inventory: Notice how there are 3 stacks of stone wall items? In code I’m actually giving the player 200 of them in one shot. The code will only add it in stack-max format. I’m happy at how well it works, even if it’s a simple thing. Sometimes it’s the little things that count.

I also realised recently that I needed a file with the current bugs written in it, and I need to write the bugs in there as soon as I find them, or 1) I won’t remember the bug later, and 2) I won’t be able to find the bugs I need to fix as easily. It seemed like a good idea, and it turns out it’s helping me quite a bit.

I have enough of the irritating bugs out of the way now that I can move onto the thing I want to do next: parties!

Collectables now In and Collectable

February 27, 2012

I’m tired so I’ll try to not go on too much in this post.

The little circles are the collectables. They’re just a small version of the thing that they represent. The copper sword is a yellow circle with a sword symbol in it. The copper sword collectable is a small yellow circle with a sword symbol in it.

I broke some of the rocks with my pickaxe and picked up the collectables they turned into. You can see that I’ve got some different kinds of ores, and some stone. I have an extra heal spell because when the NPCs die, they drop their inventory. I picked up a heal spell by mistake.

You’ll notice that some items are stackable and some are not. The heal spell did not stack with the other when I picked it up, but the ores did. Right now all stackable items have a maximum stack size of 99, but it’s easy to change the max for any new items I might add.

You might not have noticed that the creature I’m viewing, a monster, has picked up a stone and a dead NPC’s sword and spell. Just as the player and NPCs can pick up collectables, so too can monsters. I don’t plan on letting all monsters pick stuff up, but it shows that I can easily make thief foes that grab stuff on the ground and run away with them.

There are various glitches I have to work out before I move on to the next step… but I need sleep now.