Tag Archives: progress

The Quest For Dual Wielding

We have wanted some form of dual wielding since the inception of Crea. The motivation behind this was simple. First and foremost, we wanted the player to be able to use multiple items without changing their active item on the toolbar. We also wanted the toolbar to provide access to more items. We knew what we wanted but how do we get there?

When I think dual wielding I think left click for one item and right click for the other. I think this is how most games do it. There are games that have single click to use both weapons but we need to provide means to individually use the items. This creates some new questions though. Item interaction was right click but what is it now? How do we display which items are assigned to the toolbar?

We considered splitting the toolbar and having 1-5 be for left click and 6-0 be left click. Something else we tried was having items on the toolbar be left or right click. We tried having 20 items on the toolbar. There are many other paths we fumbled down. We commonly ran into two problems. The first was adding dual wielding with only 10 items on the toolbar seemed to add more complexity than it was worth. The other problem was if we wanted 20 items, two items per number, then how do we display the items efficiently? Every way we tried left at least one of us unsatisfied.

We ventured down several paths but none of them felt right. For awhile we even dropped dual wielding, but since we really wanted it we picked it back up. I had pigeonholed myself into thinking we needed dual wielding to happen with both left and right click. I stepped back from that and quickly stumbled upon a working solution.

toolbar

Current toolbar showing what both the primary and secondary looks like.

Instead of having a single toolbar the player has two toolbar, which we call the “primary” and “secondary”. The primary toolbar is active by default and to get access to the secondary toolbar simply hold down the shift key. There are 10 items on each toolbar with each item assigned to a number key. There is only one number slot active at a time. There is also only one active toolbar at a time. Since only one toolbar is active at a time the solution to our display problem was obvious. We would only display one toolbar at a time. Left click always uses the active item on the active toolbar.

Time for an example! Lets say “3″ is your active item on the primary toolbar. Left click and you use this item. Hold down shift key and now you see your active secondary toolbar. Left click again and you will use the “3″ item on your secondary toolbar.

It took awhile to get there but it was a worthwhile journey. The controls feel right and I think are intuitive. I am looking forward to getting some feedback about this feature from the testers.

Feature – Character Progression

Overview

Close to the start of the Kickstarter, I wrote a post on character progression. This was a great thumbnail sketch of what character progression will look like. I have taken the time to flesh things out and clean some things up that I found troublesome with the initial sketch. Now character progression can be broken into two distinct parts – character level and talents.

The character level is strictly used for combat related things. It is used to represent your character’s strength and consequently is utilized in various combat algorithms such as the damage algorithm or for determining the monster levels. Upon leveling your character will gain stats. Also equipment will typically have a character level requirement.

Characters have talents that represent the character’s proficiency in a field. Currently we have four talents planned; Arms, Magic, Gather, and Craft. By performing actions related to the talent your character will occasionally gain TP (Talent Points). For example by crafting items or learning new recipes you may gain TP for your Craft talent or hitting a monster with magic may yield TP for the Magic talent.

After accumulating enough TP your character’s talent will level up. With enough TP you can spend it on purchasing and upgrading skills. Leveling up a talent grants access to new skills and skill upgrades. There will be a mixture of active and passive skills. Active skills are skills that can be added to the toolbar and used as an action such as a magic spell. Passive skills are always affecting the player such as “Defense Up”.

Early version of Talent window

Modding

As usual, nearly all aspects of talents can be modified ranging from modifying an existing skill to creating an entirely new talent. Talents are tied to body types (covered in this post) meaning different races can have different talents.

As far as the actual modding goes, here is what the adding the talents to a character body looks like.

body.talents = Talents()
body.talents.talents.append(armsTalent)
body.talents.talents.append(craftTalent)
body.talents.talents.append(gatherTalent)
body.talents.talents.append(magicTalent)

A Talent is simple and is only composed of a name, a “points to next level” list, and a list of skills.

armsTalent = Talent("arms", [100] * 20)

Skills are a little bit more complex. First of all, skills can passive and/or active. A passive skill is always in effect while an active skill must be used. It is possible to have a skill with both elements. Passive skills need to provide two callback functions – “enable” and “disable”.  Active skills need to provide the callback function “use”. All skills should provide a “description” callback function.

def enableStatUp(stat, level, user):
    user.stats.get(stat).adjust(5 * level)

def disableStatUp(stat, level, user):
    user.stats.get(stat).adjust(-5 * level)

def descriptionStatUp(stat, level):
    return "Increases a character's {} by {}.".format(stat, 5 * level)

atkSkill = Skill(name="Attack Up", icon="mods/base/talent/arms/attack_up.png", costs=[100] * 5)
atkSkill.enable = partial("ATK", enableStatUp)
atkSkill.disable = partial("ATK", disableStatUp)
atkSkill.description = partial(descriptionStatUp, "Attack")
armsTalent.skills.append(atkSkill)

defSkill = Skill(name="Defense Up", icon="mods/base/talent/arms/defense_up.png", costs=[100] * 5)
defSkill.enable = partial("DEF", enableStatUp)
defSkill.disable = partial("DEF", disableStatUp)
defSkill.description = partial(descriptionStatUp, "Defense")
armsTalent.skills.append(defSkill)

The “enable” function is called when the skill is activated. This is when the player first get the skill or when the character is loaded. The sibling function, “disable” is used when the skill needs to be deactivated. This is typically when the character is being saved to disk but it also makes it possible to temporarily disable passive skills with monster abilities. The “description” function is called when we need to display the tooltip for the skill. Having it be a function makes it dynamic so it can be dependent on any variable – such as the level of the skill. The “use” function is not featured here but it is more or less the same as the previous functions. It is called when the skill is being used.

Creating skills and entirely new Talents is definitely some more advanced modding. However, with the complexity comes some awesome power and I am anxious to see what skills players come up with.

Functional Is Not Finished

Has anyone noticed how long Crea is taking? I know I have! Just a few months ago I was certain I would have Crea more or less finished by now and yet here we are still months away from a reasonable release date. “Why is this?” is something I have been asking myself recently. What is making things take so long?

I looked behind me to what I have been working on over the last few months and then ahead of me to what I will be working on and the answer became clear. There has been multiple factors that are causing these delays such as a feature taking longer to implement than expected or completely overlooking a feature when I made the release date estimates. However, without a doubt, the largest contributor is the mistake of confusing functional as finished.

When we launched Crea’s Kickstarter I truly tried to make pessimistic estimates on the release dates. I was secretly hopeful that the stars would align and Crea would come out even sooner. After all, I had the basic exploration working along with world generation, character creation, crafting, user interface, and many other things. That means I was done with these and only have to look forward to the remaining features, right? Note quite.

As it turns out, function is not finished. Many of these features only had the bare necessities implemented and were by no means ready for prime time. Take the world generation for example. Back in June it did create a randomly generated world but, as it turned out, it was very hard to build onto these generated worlds. Even more pressing, the generation would take 45 seconds for a small world and I was too scared to try a large world that is 8 times larger than the small. For some time I closed my eyes and marched on as if the problem would magically go away. It didn’t.

There are several other examples. The user interface was difficult to build onto and hardly moddable. The crafting was missing the concept of recipes the player would learn. The networking is too slow and probably needs to be moved from TCP to UDP, a major rewrite of the networking code. Add all of these up and you have a few months of added development.

This is not all bad news though. With every upgrade, Crea gets that much better. I want to ensure that Crea is representative of my best work. I do plan to release Crea before some minor features have been finished, but the features I do release with I want to be polished and ready to be built onto.

…So when is Crea coming out?

Tooltips and Japanese

Decided to work on tooltips and while I was at it I decided I would once again verify that Crea was indeed localization friendly.

Styling will likely change (such as font size). Also note that this was just a test. Crea has not been translated to Japanese.

Needless to say, I am quite excited about both of these. I was unsure of how to implement tooltips for a while now and decided to finally tackle it. Also I had not tested a foreign language on the new UI and so it was a pleasant surprise to just see everything work as expected.

And here is the English version for your viewing pleasures.

Mac Port Progress

Figured this was noteworthy – I got Crea running on mac now! It does have some graphical issues that I need to iron out but besides that things are running smoothly! And no, the toolbar is not having graphical issues – it looks bad (particularly the bag area) because I made it.

Anyways, this is huge news, mostly because it proves that what I have been developing is in fact portable. This also means that the linux port is not too far away, but it will still be awhile before I do get to the Linux port. Don’t worry though – Early Beta will have all 3 platforms!

Development Stride

The past month I have hit an amazing development stride on Crea. I am more focused than I have ever been and continue to make unbelievable progress. I am utterly obsessed. When Kelley takes me out on my daily walk I have a hard time not talking about Crea and an even harder time not thinking about it. If this is the price for raw productivity then I’ll take it!

During this stride I have tackled some major issues. One example, which I mentioned in my last blog post, I completely rewrote all of the user interface code. Since that post I have written all of the previously implemented game UI which includes the crafting, equipment, inventory and toolbar. While doing this I was sure to polish some features and move them much closer to “complete”. Such as I finally added the concept of learning item recipes to be able to craft them. Or I made it so that ctrl+click on equipment will automatically swap it with your currently equipped item.

Inventory close to being finished

Another major feat is that I rewrote the world generation. In an earlier post I talked about optimizing the world generation and how it was just too slow. I decided to completely get rid of the random noise and go with using stamps to build up a world. This was a HUGE success and generating a small world went from about 45~ seconds to now 3~ seconds. Even a humongous world, 16384×3072 tiles only takes about 15~ seconds to be generated. Not only is it much faster, but we also now have much more control over the shape of the world.

What the world generation output currently looks like

There are lots of other smaller changes that have been happening which are mostly cataloged in our project plan. On there you can also see some of the tasks I have coming up. The next two big ones are Dynamuse and Combat Refinement.

Dynamuse is a little application I’m putting together for Robot Science to be able to compose tracks that will be dynamically generated during gameplay based off of a few parameters such as the time of day and the intensity of the situation. The motivation behind this is to avoid extremely repetitive music that you inevitably mute.

Dynamuse Mockup – Be glad I’m not doing the UI

The Combat Refinement is a little more vague and I will likely do an entire post on the topic at some point. We have very basic combat implemented at the moment. You are able to swing a sword, very similar to Terraria’s long swords, and hit monsters. It is functional but not quite what we want. My goal for combat is to be a little more involved and skill based rather than “click-click-click-cli-cli-click”.

One of the biggest challenges with combat in a sandbox game is that the world can be reconstructed and, if we’re not careful, could easily mean some monsters are unable to even reach a player. So, some of the things we are looking at are: monster mobility, range attacks, multiple attack animations for a single type of weapon, skill and magic types. It is a lot but I have a good feeling we’ll be looking back at it before too long thankful that we took the time to refine things.

Oh and I’m still doing livestreams everyday. Feel free to drop in anytime!

Optimizing Systems

In software development there is this pitfall known as pre-optimization, which is the attempt to make code more efficient before it has even been proven to be a problem. I have been careful not to fall into this trap and I think I have done a reasonably good job at it.  So much so that this past week I noticed that the game was running under 60 fps. Next thing I knew I was waist deep in a code profiler, the debugger, and my paper notepad filled with ideas. In the end I came out victorious with three beasts slain at my feet and Kelley wearing a tightly corseted gown, gratefully clinging to my muscular arm.

The first of the three, the lighting system, was a tricky one. The lighting is made up of thousands of tiny squares called subtiles. Each square is 4×4 pixels which means there are 16 of them in a single tile. That means if the resolution is only 1280×1024 then there are 81920 subtiles. That’s a lot! I have some awesome algorithms to calculate the lighting at blazing speeds, but when it came to rendering them, I didn’t have much optimization I could make.

Profile of my lighting rendering code

After an arduous journey to the top of a mountain, I sat in meditation for 3 days until the solution was given to me in a vision. A great deal of the tiles are a solid value – either pure black or pure white. With this I made light represented by a solid tile and only broke it down into subtiles if the tile needed multiple values. After a day of rewriting a large portion of the lighting system to handle this concept, I was greeted with a constant 60fps, up from the lowly 40~fps. The first beast was slain and onto the next I galumphed!

The second beast was one I had been avoiding for awhile for no real reason – tile blending. Tile blending is a cool concept I came up with awhile back that helps smooth the transition from one tile type to another.

Each tile type has a priority. When a tile is drawn it checks its four direct neighbors and if it has a higher priority then it slightly draws over that neighbor. The problem with this is that I was comparing the tile priorities every frame, slowing down the fps rate.

Fortunately a profound solution was not required this time. I made the exchange of memory for cpu. Now every tile is caching if it has priority over each neighbor using a bitwised enum stored in a single byte. Since I only have a fraction of the world loaded at a time this is not such a bad thing. And on I went to the final beast.

The last of the beasts is the world generation. We’ve been building onto the world generation for awhile now (and it’s still in progress) and it started to get way too slow. It was taking nearly 2 minutes to generate just a small world. So I unsheathed my mighty brain powers and did what I do best – code!

I quickly found that this beast was no ordinary beast. It was a hydra and had three issues that I had to cut through. Before getting into the gory details, I’ll give a brief overview of how the world generation works. First the world terrain is created and everything is either dirt or sky. Then the “world” biome is placed down which is a pass over the entire world such as adding in other tile types such as silver and gold. After this all of the biomes are laid out and each performs its own actions to reshape its allotted area.

The first and remaining issue is that the first step, the terrain generation, takes about 98% of the processing time. The way I am generating the terrain, through the Accidental Noise Library (ANL), is just very slow. There are likely optimizations I can make, I just need to continue hacking.

Another issue that really started slowing things down was the way we were placing down all of the tiles during the world biome pass. I would randomly calculate an area to place the tiles in and then generate a circle with noise once again going through ANL. Doing this a few hundred times was just too much. I realized that I did not really need to generate a new circle with noise every time. No one would notice if we reused the same ones especially if we stretch and flip them. Thus the concept of “stamps” was born. Stamps can either be created from noise generation as before or from an image.

The final issue was with an unmentioned feature/tool – creating an image out of the generated world. I put this together so it would be easier for us to iterate on the world generation. But there was a problem with it… It was taking 30 seconds. It was still worth it but still – ouch! I quickly verified that the part I suspected was indeed the culprit. Reading through all of the tiles and converting them into a color to save to the image was taking 99% of the time. This was written in python so I moved just this part into C++. It went from 30 seconds to roughly 1 second. Victory was mine!

Alpha Map with sword and bed stamps

Needless to say, I’m covered in the bloody remains of ones and zeros.

Good Momentum

Typically I post updates much more often than I have recently. I’m not much of a writer to begin with and I wrote so much during the kickstarter that I think I burned myself out on it. I have also been really wanting to make some real progress on development – get some good momentum going.

I have been working nonstop since the kickstarter ended 10 days ago. I am almost done with the lighting system (the initial pass at least). Both equipment and proficiencies (leveling) are fully implemented. Now we just have to make the content!

So what is lighting looking like so far?

Sunlight with a lightsource (torch)

I’m currently finishing up the lighting. Optimizing it some and adding in colored lights. Right now I don’t have dynamic lights casting shadows. I really want shadows but they are not essential and right now I need to just focus on the core essentials.

Equipment is looking great. I want to do a future write-up all about equipment, but for now I will say that you can do nearly anything with it. This means not only will we be able to make awesome and unique equipment, but through the easy modding setup, so will everyone else! Here’s some visuals:

Programmer UI with no gear equipped

Programmer UI with chest plate equipped

Equipment dialog mockup

Right now there are no visuals to show for the proficiencies, because at this point its all logic. I will be posting the write-up on equipment soon. Be sure to subscribe to the blog to get updates when they happen.

Lately I have been doing impromptu coding livestreams. If you follow the Siege Games twitchtv account, you’ll be notified with an email whenever I start up a livestream.

Progress Overview

We have been working on Crea heads down for the last few months and have made great progress. Now we are beginning to share Crea with others and are getting some attention. Many new people are coming here and likely are wondering a few things such as “What is Crea?”, “What platforms will it be on?” or “When will it be released?” See the Crea, FAQ and Team pages for answers to these questions and more.

One thing these pages do not cover is our current progress on Crea. Here is a quick summary of what we have accomplished thus far and what features are coming up soon. Links are to the related blog posts.

Implemented:

Coming Soon:
  • Lighting
    • Not much to be said here. Lighting to add to the atmosphere and exploration.
  • Leveling
    • Unique proficiency leveling system where you gain experience according to your actions
  • Equipment
    • Equipment system that can have consistent stats or randomly assigned stats.
  • Monsters
    • Monsters are spawned from monster spawners that will spread if not destroyed.
  • NPCs
    • Start with basic NPC interactions such as dialog and item trading (for stores and the likes). More involved NPCs will come a little later – such as quests.
  • We have many more features we will implement but these are the highest priority features at the moment. If you want to see our timeline be sure to check out the project plan.

We will be continuing to update regularly. Be sure not to miss any and subscribe to the blog!

Kickstarter Coming Soon!

We are currently crafting an awesome Kickstarter campaign, but it is missing something! Momentum. We need to build some juicy momentum over the next week in order to launch with a BANG. This is where you come in.

First of all, go to kick.siegegames.com and sign up to receive word the moment our Kickstarter launches. Once you have signed up you can share your referral link with your friends. The more you share the more we’ll reciprocate the love.

Several updates will be coming over the next week as we prepare for our launch and even more once we launch. Exciting times are ahead!