Pre-Order the Game!

Desura Digital Distribution

Thursday, August 30, 2012

Design Document

With the impending event of the source code becoming open source, I've started work on the design document for the game.  I will be as detailed as possible, so hopefully this will answer most of your questions on how a feature should be added.

If you spot a potential issue or improvement, feel free to let me know!  If the document is not clear enough, go ahead and ask questions.  The goal is that you can help me complete this game.

So far, I only have two pages (I just started today).  But I foresee it going up to 50 or so pages easily. There'll be a lot of details to cover.  I think in a way, it will help me avoid feature creep if I establish the boundaries in the design doc :)

Here's the link to the document:

Beyond Beyaan Design Document

Tuesday, August 28, 2012

Slight revision to economy system

While working on the UI for planet screen, I noticed that there are a lot of managing for a planet.  First, there's the regions that you develop, as well as buildings for it and specials for them.  Second, there's sliders, one for each region type.

I'm also working on the underlying data structure for the economy system, and I'm having issues with having both regions and sliders.  There are three types of outputs:  Outputs that are generated automatically by population (similar to MoO 1/2's BC, each population creates BC automatically, regardless of what output they are in), outputs generated by population (you assign them to do this output via slider), and outputs generated by regions.  I've been trying to brainstorm on how to handle this in the code.  Then I realized something.

It's too much micromanagement for marginal benefits.  Which would be easier, telling your planet to develop 3 farming regions then forgetting about it.  Or telling your planet to develop those 3, then when they're developed, assign a segment of population to that output?  What's the difference?  The ability to "overproduce" that's already punished by inefficiency?  The ability to assign to different outputs for a slightly increased output of a type?  Those are insignificant in the grand scheme where you have 100+ planets.

So I'm going to rip out the sliders idea from the regional system.  There won't be sliders, and the outputs will be calculated automatically based on the available resources and the population size.  Let's say that you have a planet with 6 regions, and 3 are farming, 3 are undeveloped.  It can hold 60 Humans, but have only 30 humans.  Therefore, it is operating at 50% efficiency (30/60) across all regions.  So each farming region outputs only 50% of its optimal output, and the undeveloped regions are outputting nothing.  In order to get the most out of a planet, it need to be fully developed (all regions developed), and fully populated.  That is a simple concept that players will understand.

Also, if it happens that a planet have more population than it can support (120/60), then it will use the inefficiency formula across all the regions.  This can occur if a disaster strikes causing the planet to degrade to another type, or you landed more people than it can support.  Population growth will then go negative.

So the "Population Allocation System" is now just regional systems similar to MoO 3, but in that population aren't restricted to a region.  I still plan on "Output Allocation System" where there's sliders, but there won't be regions (similar to MoO 1) later after the basic game's done.

This should be a lot less micromanaging, and you can assign regions from planet list screen as well.  Each region can have improvements and buildings to improve its output.

Tuesday, August 21, 2012

Preview of the new planet screen

To show you all that I'm still working on the game, here's a preview of what the planet screen looks like.  This is when you have a system selected, then select a planet:


Let me explain what each region is.  Starting with the left side:  In top is the name of the planet, you can rename it by clicking on the textbox, if you own the planet.  Under that is the display of the planet and its description (this same planet art will be used in space combat FYI)

Second from bottom is the planet's specials which will be displayed as icons.  The plan is when you hover over a special, a tooltip will pop up explaining what the special is.

Bottom is the consumption and production list.  It will display what your planet are consuming and producing.

Now on right side.  The top area is list of regions, I plan on adding more details to it such as how much it can produce per unit of population, as well as how much it consumes.

Under the regions is the planet's current project.  It could be terraforming, building a building, or building a region.

Finally the bottom area will be for sliders.  There will be a slider for each region type.  So if you have 3 mining, it will only have 1 slider for mining, and the production will be averaged between the 3 mines.

The bottom four areas that are blank right now are not implemented yet.  I'm still working on the resource system, then when that's done, I will add sliders and productions/consumptions.  Then specials and flesh out the region list.  At this point, the economy should be working, but other UI (planet list, project list, etc) won't be done, so you can't build anything yet.

Over the past week, I realized that you can create a pretty complicated economy system with this implementation.  Let's say you want to imitate production in real life.  You research "Laser Cannon", but when it's researched, you get two technologies: Laser Cannon and Laser Cannon Production Region.  Then you need to build a region for producing laser cannons, and you design a ship with Laser Cannon.  It would require that you build laser cannons before you build the ship.  And the laser cannons will have their resources that they will consume (crystals, alloys, gasses, etc).  Then you research a new beam weapon, so you replace the region to produce the new beam weapon, along with its resource requirements, and so forth.

However, in default gameplay, I will keep things simple and just have ships require raw materials and labor.

Thursday, August 16, 2012

Consumption code done!

The algorithm for calculating the amount of consumption for each planet is done!  It's about 100 lines of code, and this is just for getting how much a planet can consume if the resources are available.  This economy system is turning out to be more complicated than I thought, but I've broken it down into parts, and I believe that when it's all done, it will be very powerful and flexible.  This is the steps involved in processing a turn for economy:

1. Subtract resources consumed by population (food, etc).  If insufficient resources, then they starve.

2. Calculate the maintenance costs from all ships and buildings

3. Subtract the maintenance costs from available resources

4. If insufficient resources for maintenance, then disable buildings that require that resource, if that is still not enough, place the active squadrons that is idling adjacent to friendly system into reserves (different maintenance costs between active and reserve), if that still is not sufficient, scrap buildings that used that resource in its development, and add the recycled resources, if that is still not sufficient, scrap the ships in reserve that yields that resource, if that is still not enough, scrap the equipment from active squadrons that are not adjacent to friendly systems that yields that resource.  At this point, there won't be any buildings or ships with equipment that consume that resource, so the economy is now stabilized.

5. Calculate the optimal consumption from all planets that are not blockaded. - This step is mostly done, don't have check for blockade yet.  It was a bit tricky handling multiple races with different region space usage and sliders for each region type, but I think this was the hardest step.

6. Compare the total consumption to available resources, and assign percentage to the resources that are not sufficient to cover the consumption.  For example, if your empire needs 20 Ores, but only have 10 Ores, then set the Ores to be 50% for all of your empire's consumption.

7. Finally produce outputs, using the penalty.  For each region that consumes one or more resource, check to see if any have a penalty (i.e. 50%), and take the lowest percentage, both consumption and output are multiplied by that penalty.  So Industry that consumes 10 Ores and generates 10 Industry will now only generate 5 industry, and consumes 5 ores.  If a bioorganic factory have 75% penalty in Ores, and 50% penalty in food, it will produce and consume with 50% penalty.  The outputs are then added to the empire's resources for next turn, it is not used in current turn's consumption.

8. Any remaining resources that are not consumed this turn (and is from current turn, not the new resources just generated) are then added to the empire and planet projects.  For example, Research Points are not consumed in step 7, so you have 100 research points and 25 radioactives left, it is then assigned to the Empire Projects where research are done.  Let's say that you have two research projects in Projects, first one costs 50 research points and second costs 75 research points, but also 50 radioactives.  It assigns the resources to the first project, which then deducts 50 RP, completing the project.  Then it assigns the remaining resources to the next project, which uses up all of research points and radioactives, leaving it with 25 RP and 25 radioactives to complete the project.  Another example is if first costs 200 RP, and second costs 100 RP and 50 radioactives, and you have 100 RP and 25 radioactives, the first project consumes all of the RP, leaving 100 RP before completion, and the second project consumes the 25 radioactives, leaving 25 before completion, but didn't get any RP, so it still have 100 RP before completion.

This is a cascading system, and you can change the order of projects at any time to prioritize one above others if needed.  Same will be of system and planet development.  System development builds ships and other system-wide structures, while planet development builds buildings and terraforms.

9. Any remaining resources will be finally stored or converted if it is not storable for next turn.

Whew!  The hardest step is done, with calculations for optimal consumption.  I can now copy the algorithm for step 7.  The rest of the steps are easy to do, except for 8 which will change the research system.  Then I will implement the UI for regions in planets.  At this point, I will finally upload the source code.

Thursday, August 9, 2012

Resources and Consumption

Here's an update on the resource system:

As you may know, I've added resources in a XML file, so players can create their own resources, whether or not it's preservable (food can't be stored since they only last a year for example, so excess are converted into some money).  Also regions are defined in XML file, so players can create different regions, what restrictions they have (for example, Radioactive Mining regions are restricted to only the planets that have Radioactives special), and what resources they consume or produce.

While this may seem a simple system, I realized that the math behind this is very complicated.  Each planet can have different regions, and different races.  Planet specials and race bonuses may affect the output/consumption.  The more you produce something from a planet, the more that region need to consume.  Resources are interchangeable between planets, so if one planet is a mining powerhouse, it can supply other planets with ores/minerals.

The problem is now this:  How do the game know how much you're producing, and how much you're consuming?  Let's say that there's three regions defined:

Mining - Produces Raw Minerals
Refining - Produces Alloys, Consumes Raw Minerals
Industry - Produces "Production", Consumes Alloys

To correctly calculate the output and consumption in the same turn, it must loop through every planet, checking its output and consumption.  So first loop will discover that Mining produces Raw Minerals, but since there's no raw minerals beforehand, Refining wouldn't be producing anything, and same for Industry.  Then on second loop, it will say "we now have Raw Minerals, which regions use it?" and go through the same process again.  Now Refining produces Alloys.  Third loop will finally determine that Industry can produce Production.

Now, what happens if the player changes slider so that the mining no longer produces Raw Minerals?  It'd have to go through the loops again.  Due to the regions/resources being able to be defined by the player, it could become a complicated economy system with 5 or so iterations before the goods are usable by projects.  Some region may consume two or more resources (for example, bioorganic factory consumes Ores and Food), some region may produce two or more resources (Radioactive Mining will produce radioactives and ores).  Not to consider racial/regional/planet bonuses that affects the whole thing as well.  How many loops do the game need to perform?  How do it know when to stop?

So the system that worked in MoO 2/3 can't work here because in MoO 2/3, the resources are pre-defined (MoO 2 has command points for ships, and BC, MoO 3 has only Mining and Industry, a simple system).  So I'm proposing a different system that will make things easier under the hood, and makes things interesting for the player:  Turn-Based Processing.

What is Turn-Based Processing?  Let's use the above example of Mining, Refining, and Industry.  First turn, you don't have any Raw Minerals, nor Alloys.  So Refining and Industry won't be producing anything.  However, Mining will produce 10 Raw Minerals this turn.  You then hit end turn, and proceed to second turn.  Now you have 10 Raw Minerals, and the game tells the regions that "we have 10 Raw Minerals, tell me what you're making".  It will report that the Refining can produce 10 Alloys, and consumes 10 Raw Minerals, and Mining will produce 10 Raw Minerals.  You hit end turn, the game consumes all the resources by regions, then produces the goods from regions.  You're now on third turn.  You now have 10 Raw Minerals (from mining last turn), and 10 Alloys.  The Industry region now finally can produce "Production" because you now have Alloys.

One interesting side effect from this is that if your mining planet was attacked and destroyed, you won't feel the effects until a few turns later due to the chain of production.

If the resources are not preservable, they last only one turn, long enough to be consumed.  They usually have another resource that they change into (for example, each unit of food left over will be converted to half a BC) on end of second turn.

Monday, August 6, 2012

The Harsh Reality and The Important Decision

I'm sure that many of you are aware of the "MoO II Curse", but for those that don't, let me explain.  Many people loved MoO II, and started on their game project in an attempt to create the next MoO II.  However, they usually fail for a reason or other.

Why am I bringing this up?  I think I've reached the point where I need outside help in completing this game. My newborn baby is still in NICU (she's doing well, just need to learn how to suck milk then she can go home!), our washer just broke down, and my free time is dwindling.  It's getting harder and harder for me to devote time to this project, and I DO NOT want to see this fail like countless other projects.

So I'm planning on making Beyond Beyaan to be open-source, where people can download the game's code and compile it themselves.  They just need a couple of free downloads, the Microsoft Visual Studio 2010 Express and SlimDX June 2010 Development SDK, and be familiar with C# and HLSL (shader) languages.  However, the art assets won't be included, so you'll need to buy the game to get the assets.  And the general population will have read-only access, if they want to help, they must make a "svn patch" that contains the code changes, and send it to me.  I will then review the changes, and if it passes review, I will then apply it.  I will include appropriate credit to contributors in the code.  Over time, the policy may change, such as giving write access to trusted contributors.

The reasons why I'm doing this are:

First, I don't have as much time as I used to, so if you have time and talents to help out, it makes the development time shorter!

Second, my friend's server on which my code control has been residing has failed, and he's not going to set it up again.  So now I have no source control, all the changes are now on my one machine.  So I will set it up on google's source control (their requirements are that it be open source)

Third, in order to obtain outside help, they will need to be able to look at the game's code and add their contributions.  It would be hard to restrict access to source code if I have anonymous internet people helping me out, it just takes one to pass around login credentials.

Fourth, there are so many MoO 2 clones that failed, and I don't want this to be another one of those.  By providing this source code, they can contribute to this, and finally make one that's finished.

Fifth, there's another open source 4X project, the FreeOrion.  However, the problem is that the combat is not turn based, it's not very similar to MoO 1/2.  Beyond Beyaan is the closest clone that I can see.  If you think I'm wrong, feel free to show me the game that's closer.  I would be ecstatic if there's another game that's like MoO 1/2, but so far I'm disappointed.  So I'm opening up the possibility of having a MoO 1/2 remakes/expansions using Beyond Beyaan as the base.

I plan on making a list of tasks that need to be done to make this game feature-complete, then those who want to contribute can pick one of those tasks and complete it.  When a person contributes sufficiently that I can trust him/her, I can give him/her write access so he/she can contribute to the game directly.  I will continue to work on the game, but I'm now at the point where I want it done so I can move on with other parts of my life.

My plea is now this:  If you're working on your own MoO 1/2 clone, please consider putting it on hold and contribute to this project so that we all can finally get that MoO 2 game we want.  The goal for Beyond Beyaan is to be able to support different features, so people can turn on/off features, so they can re-create any of the old classic 4X games.  Maybe you can even re-create your game with Beyond Beyaan!

For those who may be upset about this, please consider the advantages:

1. The code is now accessible to everybody, so they can create their own 4X game, using this as a starting base (with the limitation that the game be not commercially used meaning the game is free for everyone)

2. People may think of new features, and contribute to Beyond Beyaan, making it more capable and flexible.  Such as multiplayer and AI, both of which I'm not experienced in.  Also, I'm incapable of programming or debugging sounds since I'm deaf.

3. Beyond Beyaan may be completed in a shorter time frame than if I'm to work on it alone.  I've started work on this on Dec 2009, so it's almost 3 years since then, and I estimate that if everything goes smoothly, about a year before I finish the basics (UI, combat, etc), then another couple of years of polishing and balancing.  With the new baby, I cannot promise even that.

If you feel ripped off for financially supporting the game, I hope that this may make you feel better:
I've received $256 in donations before Desura was set up, and $213.48 from Desura sales, totalling $469.48.  This is before Paypal's deductions on both of those (Desura pays through Paypal).  However, Desura will not pay me until I've reached at least $500 for each payment.  So the amount in Desura is in limbo for now.  While that may sound like a decent amount of money, it is nowhere near the amount I have spent on the art.  I added up all the art payments, and the total was $1,436.  I don't regret the payments, I wanted to show you that I've invested a lot into this game, and I want to see it succeed.

Again, the art and data assets won't be available unless you buy the game, you can't run the game without those.  And if I actually start turning a profit, I will add more races and artwork to the game.  So all the money earned from this game will go back into it (unless a fluke happens where it becomes the next minecraft and I make insane profits :) )

If people contribute artwork to be used freely, it will be included in the open source.  I plan on adding the current assets once I recoup all the investments made, as a way to help expand the 4X userbase, and make the game available to everyone.

-----------------------------------------------------------------------

The plan is that when I'm done with regions implementation (economy system up and running, the sliders working in planet UI, etc) I will upload the new version to Desura.  Then I will upload the source code to Google's source control.  I will then create a list of tasks that needs to be done to make the game feature complete, both as a reference for myself, and for others who wish to contribute.  Then I will resume work on the game as usual, but hopefully with contributions to speed the development up.  I will post the instructions on setting the development environment up, complete with links to all downloads you may need.

I know this is a drastic change in how things are done, but I believe that this will benefit many more people than if I remained with the status quo.

Wednesday, August 1, 2012

Population/Region issues resolved!

This will be the last "brainstorming" post, since I think I've resolved all the issues.  The good news is, racial population limit on different planet types can be implemented!  Here's how it will work:

Instead of having each region be managed individually, all of the same regions are lumped together in one slider for each race.  So if you have two mining and one research regions on a planet, there will be only one mining slider and one research slider for each race.

But what about population limit?  Let's say that for Zero People in Arctic type, they have 15 limit per region, and humans have 5.  Each region have "10" space, and the space is equally divided between the two races, and there are 4 regions on the Arctic planet.  So there will be 30 zero people and 10 humans on the planet.

Let's say that the planet has two mining regions, and two others.  If I assign 100% of the zero people to mining, it's 30 people in the mining.  If I assign 100% of the humans to mining, it's 10 people in the mining.  However, what if I assign more than the regions can handle, say, 100% of both zero people and humans in the mining?  This is where I take the idea of MoO 3's diminishing return here.  For every unit of population up to the maximum capacity, they produce the full capacity.  Then for every unit of population up to twice the maximum capacity, they produce half capacity, then fourth capacity after that, then eighth after that, and so forth.

So if the planet have 1 mining region, and 3 undeveloped regions, and it is fully populated, then 25% of the people will produce full capacity (15 ores for 15 zero people), 25% will produce half capacity (7.5 for 15 zero people), 25% will produce fourth capacity (3.25 for 15 zero people) and finally 25% will produce eighth capacity (1.625 for 15 zero people), for total of 27.375 ores.  If you build a second mining region, it will drastically improve the output.  It will now have 50% of zero people producing full capacity (30 ores for 30 zero people, already surpassing the one mining region's capacity with full population), and the last 50% producing half capacity (15 ores for 30 zero people), for total of 45 ores, which is about the twice amount of output if you had only one mining region!  If 3 regions are mining, the total output will be 52.5.  If all 4 regions are mining, then the total output will be 60 ores.  The side effect is that there's also diminishing return on developing more regions to be of the same output, to encourage diversity!  Is it worth building that last mining region for 7.5 more ores, or to build a research region?

The game will handle spaces automatically, so you just assign your races to whatever output you want them to be in.  There won't be a hard limit to a output's capacity, so if you need extra food in an emergency, you can assign more people to food production, but it won't be as effective as actually building a farming region.

This will reduce the micromanagement a lot, and resolves the UI issues with different population limit!  You can still build improvements for different regions.  The output will be averaged between the regions with the same type of output.  If a region produces 2 ores per unit of population, and another only 1 ores, assigning 10 to mining will result in 15 ores ((10 * 2 + 10 * 1) / (2 regions)), so there's incentive to improve all of your regions!

This will be how the population allocation work.  The output allocation (like the one in MoO 1) will not apply diminishing returns.

Another note, the region development will be based on the population number, due to several reasons.  First, there won't be any sliders on an undeveloped planet (no developed regions), so how to allocate the "production" of the population?  Second, it makes sense that the more people you have, the faster a region will develop.  So the "cost" for a region will be the "manpower".  An example, if a mining region requires "50" manpower, and the planet has 10 people, it will take 5 turns to build that region (5*10).  Different regions may have different amount of manpower requirement (research will require a lot more manpower than a farming for example).  So even if you're a rich and powerful empire, you can't just "buy" a region, so the best way to do that is to transport people to that planet!

Last several notes, there won't be any regional specials, since it will clutter the UI and overwhelm the player, so there will be planetary specials only.

Each region type will be a technology, with the Mining, Research, Industry, Agriculture, and Commerce being the starting region types (level 0), and there will be different region types in the future to exploit different materials.  For example, if a planet has Radioactives, you can't mine those until you research Radioactive Mining/Purification region, then you'll have to sacrifice one or more regions to be devoted entirely to this output.  Then you can easily manage the planet output from the planet list screen.

Alright, I think this covers all of the region/planet economy design!  Once this concept is implemented, I will attempt to publish the new version on Desura!