Pre-Order the Game!

Desura Digital Distribution

Friday, February 8, 2013

Sectors Design

There were quite a few questions about if Beyond Beyaan can support different modes of travel like Sword of the Stars and some other games, and I answered, "Of course!  It currently supports direct travel and starlanes, with more planned!"  But this has gotten me to think, how can I implement those alternate modes of travel?  How to support modding of travel methods without requiring people to dig into the game's code?  How to support artificial methods of travel that are built later on, such as Stargates, that is not originally part of the galaxy?

This got me thinking as well about the sectors that I'm currently implementing, with pirate bases, derelicts, planets, etc.  Then I think a brilliant idea struck me, why not combine those together?  Starlanes, wormholes, Stargates, etc will be actually sector objects that you can explore or build.

So now instead of "Sectors", they'll be "Sector Objects" that you need to explore upon arrival of a star system.  It can range from a starlane leading to another system, or a planet that you can colonize.  The reasoning behind this is that you can detect stuff, but you're not quite sure what they are until you get closer and get an indepth scan of the object.

This change will have ramifications in strategic layers.  In a game that uses starlanes, when you arrive at another system, you'll need to wait a few turns while your scout explores the system to find other starlanes leading out of the system before moving on.  So exploration will be a bit slower.  But it'll also be more interesting and becomes a vital part of the game.  You can turn on a configuration property to have all objects explored upon arrival to match the exploration from MoO 1/2 if you want that instead.

Since starlanes/wormholes/stargates are sector objects now, they can be "claimed" meaning that you abstractly place a buoy broadcasting your ownership of the said object, and to violate them can incur diplomatic penalties.  That way, you can stake out your empire borders without having to colonize everything.  There will be two levels of positive diplomatic relations: Non-aggression and alliance.  Non-aggression meaning that you agree to not use or attack any claimed objects by that empire.  Alliance meaning you agree to share methods of travel or allow their ships near sector objects (this includes sharing stargates).

You can define a sector object with different properties.  A planet will be a sector object that don't have travel properties.  A starlane will be a sector object with travel properties.  It'd be possible to mod it such that a starlane can have improvements built (such as slowing down of enemy ships or faster travel for friendly ships).  Each sector object will be defined in the data files, so instead of "Planets.xml" it'll be "SectorObjects.xml", and each object will have a list of properties, something like this:

AllowPopulation - Can this object be inhabitable?  Affects colonization checks.

LocalProjects - Affects whether projects are at this object level or at empire level for development purposes (such as derelict being empire-level requiring research to unlock the ancient technologies),

Slider - Each Slider item will define what it produces, and what it consumes (if any), and amount per unit of population or some other requirement.  Having no Slider items will not show any sliders for the object.

Improvement - Each improvement is a slot that you can build something in.  For example, in planets, this would be regions that you can build farms, industry, research, and other regions.  Starlanes would have at most one improvement that you can build.

IsGateway - Defines if this object is an transporation node, such as starlane or wormhole.  You could define a planet to be a gateway as well, but in Beyond Beyaan, planets won't be gateways.  This property also defines whether or not it's restricted to one other system or not.  If restricted to one other system, then the game will draw a line between this system and the other system in galaxy view (starlanes and wormholes).  If not restricted, no lines are drawn, but the pathfinding will check to ensure that destination system have a friendly same type of object (i.e. having a Stargate in both from and to systems).

Mini-Improvements - On planets, this would be buildings.  On trading outposts, this would be modules that you attach to the outpost, etc.  This is not visibly displayed in the normal view, but will be visible in detailed view of the object.

There may be some other properties that I will need to add.  But the general idea is that it'd allow for flexibility for people to create their own methods of transportation without digging in the code.  If you were to create a MoO 1 clone, you'd have all objects be planets, with no IsGateway set to true except for Stargate, which you'll need to build.  Each planet would have 5 slider items, and LocalProjects set to true.  Stargate wouldn't be restricted to one system, allowing pathfinding to use it to go to any friendly system with a stargate.

Tomorrow I will work on implementing sector objects, then hopefully next week I'll have time to rework the pathfinding algorithm to work with the new objects.  I will also need to rework the galaxy generation script so that scripts create everything needed, then the game just reads in the data passed by the script.  Currently the script just creates points on a grid, and the game handles the rest such as planet generation and such.

No comments:

Post a Comment