Game engine technical details?

Development directions, tasks, and features being actively implemented or pursued by the development team.
Post Reply
DangerousDave
Star Pilot
Star Pilot
Posts: 7
Joined: Tue May 27, 2008 2:43 pm

Game engine technical details?

Post by DangerousDave »

Hey,

I've been trying to find some details on how the game works a bit more 'under the hood', but really can't find much.

Specifically (for now):
  • :arrow: How the economy currently works.
    :arrow: The level of persistency in the universe - are individual ships simulated at all out-of-system?
    :arrow: The use of level-of-detail - how are battles between ships represented at large distances or out-of-system? How many LOD levels are there? (I'm certain there's a more technically accurate word than LOD, but fail to remember...?).
    :arrow: NPC (flight) AI - purely reactive? path following? how intelligent is high level decision making?
I will check out the source code as soon as possible, but no doubt it's gonna take a while to sift through! So, if anyone can give an overview, or even better point me to a wiki page or forum thread with this sort of stuff, I would be most grateful...


I'd like to help out the project in any small way I can. I am a fair C++ coder with experience of some techniques involved in this project (some OpenGL/DirectX, multi-agent AI, rigid body and fluid dynamics simulations). But, as I'm sure the developers must have heard a million times, I really can't spare the time to commit - a mistake I've made before, ultimately letting people down.

But if I can contribute some more technical ideas, documentation, testing, etc, that can be done on the fly without too much commitment, I will do.

Cheers.
safemode
Developer
Developer
Posts: 2150
Joined: Mon Apr 23, 2007 1:17 am
Location: Pennsylvania
Contact:

Post by safemode »

The wiki is catching up, but definitely not complete.

Some of the stuff you mentioned is controlled by python, thus kind of off topic. Things like economy, is a mixture. It's controlled by python, but we provide no real C++ mechanisms to change much of how it's done currently in python.

Basically, i think it has initial values, and trading modifies it on an individual level.


Depending on how you set your config via vssetup, we simulate anywhere from the current system to 4 or more (i forget) systems completely. All other systems get "simulated" on a flight group roll of the die basis. I'm not totally sure about how the mechanism goes for those systems.

As far as i know, we have 2 LOD's but a varying level of simulation priority. The far Lod like i previously described, and maybe someone can chime in with a better description. The other is the near, for the current and other systems falling into the config. Simulation time is given based on proximity to user and the target of the user. Further away, you get less sim time.

NPC flight is reactive right now. If reactive is a good word for random craziness :) I'm going to be fixing that with some path flying mixed in via the ray collider.
Ed Sweetman endorses this message.
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Re: Game engine technical details?

Post by ace123 »

DangerousDave wrote:Hey,

I've been trying to find some details on how the game works a bit more 'under the hood', but really can't find much.

Specifically (for now):
  • :arrow: How the economy currently works.
This is written in python and is part of the dynamic universe system (I believe all of the dynamic-ness is done in "trading.py" but for the most part the economy is a few small numbers added onto some defaults for each base type--really isn't very interesting the way it is done right now.
  • :arrow: The level of persistency in the universe - are individual ships simulated at all out-of-system?
    :arrow: The use of level-of-detail - how are battles between ships represented at large distances or out-of-system? How many LOD levels are there? (I'm certain there's a more technically accurate word than LOD, but fail to remember...?).
    :arrow: NPC (flight) AI - purely reactive? path following? how intelligent is high level decision making?
As safemode said, there are multiple levels of simulation.

Highest level: Dynamic Universe. This operates solely based on knowledge in the savegame about all flightgroups in the universe, and information in milky_way.xml about all systems in the universe and an overview of what planets exist in each one.

System level: Ships exist in space and each one runs an AI script, as well as has a target. The AI acts on a reactive level (though not as well as it can, and ships will often have head-on collisions). However, the ships's target and flightgroup directive act as a goal (e.g. I'm going to fly to this base and dock)

The current system as well as the last (1-3) systems you have been in are simulated at any given time.
In addition, there is a priority given to each ship, that is the number of frames between each simulation. For example, The player is 1, the player's target is very low, and planets are 64 or 128 or something high.
I will check out the source code as soon as possible, but no doubt it's gonna take a while to sift through! So, if anyone can give an overview, or even better point me to a wiki page or forum thread with this sort of stuff, I would be most grateful...
I can't give you a general overview page if that's what you are asking for... I'm sure there is some information around but you have to hunt for it. It might be easier if you have some specific projects in mind that you want to start out with.

File organization is somewhat straightforward. First, most files have a something_generic.cpp, something.cpp and something_server.cpp
The _generic is usually a base class or common functions. The subclass will be without _generic and will have client-specific code. _server will usually have stubs for graphics functions.

I don't know if this is what you are looking for, but here goes...
Python code is in data/modules and data/bases.
In C++, there is one instance of Universe (universe_generic.h)
each Universe has multiple Cockpits, though in recent times there is no split screen so clients only have one Cockpit (gfx/cockpit_generic.h).
Each Universe also has multiple running StarSystems (star_system_generic.h).
Each StarSystem has many Units (cmd/unit_generic.h) which is subclassed by Planet, Missile, Nebula, and others. However, Unit is the class that is used for fighter ships.
Each Unit has an AI class (Order, CommunicatingAI, and other subclasses), which is in its "aistate".

Also, most functions in unit_generic are exported to Python, and everything inside of faction_util.h, universe_util.h and cmd/unit_util.h are exported to Python, and so you can also use the same functions in C++ code.
I'd like to help out the project in any small way I can. I am a fair C++ coder with experience of some techniques involved in this project (some OpenGL/DirectX, multi-agent AI, rigid body and fluid dynamics simulations). But, as I'm sure the developers must have heard a million times, I really can't spare the time to commit - a mistake I've made before, ultimately letting people down.

But if I can contribute some more technical ideas, documentation, testing, etc, that can be done on the fly without too much commitment, I will do.

Cheers.
I don't want to let you down, maybe it has something to do with the organization of the project, but in general it is not easy to do something 'on the fly'... but feel free to post on the forum and we can help you along.

Also, the Wiki is in constant need of updating... a lot of stuff in there is 0.4.3-era out of date, or altogether nonexistent.
pyramid
Expert Mercenary
Expert Mercenary
Posts: 988
Joined: Thu Jun 15, 2006 1:02 am
Location: Somewhere in the vastness of space
Contact:

Re: Game engine technical details?

Post by pyramid »

I strongly encourage the documentation of the engine workings on a wiki Development: page. Probably a new one needs to be created (Development:Engine). This would be a good reference for current changes and also help tremendously in redesign of some of the things we want to improve over the next versions.
DangerousDave
Star Pilot
Star Pilot
Posts: 7
Joined: Tue May 27, 2008 2:43 pm

Re: Game engine technical details?

Post by DangerousDave »

@safemode and ace123: Thanks a lot, very interesting stuff!

I wonder, if it's not too much trouble, if you could expand on the Dynamic Universe level of detail:

When you say fight groups, do you mean each wing of ships is grouped into a single object and exists with a position, direction, and runs an AI script, but has no physicality. Then is resolved into fully simulated ships when the player enters the system?

Or do you mean something much more high-level, where each system contains a number of flight-groups with their stats just stored, not using any CPU time, and ships are resolved into a random position running a (semi-)random AI routine when the player enters the system?


pyramid wrote:I strongly encourage the documentation of the engine workings on a wiki Development: page. Probably a new one needs to be created (Development:Engine). This would be a good reference for current changes and also help tremendously in redesign of some of the things we want to improve over the next versions.
Quite obviously I second that fully! Once I have chance to start familiarising myself with the code I could perhaps contribute to the wiki at least? Or would you rather keep technical wiki articles reserved for the core developers to update?


Again thanks for humouring me on all this. As sad as it may sound, this is rivetting stuff for me!
pyramid
Expert Mercenary
Expert Mercenary
Posts: 988
Joined: Thu Jun 15, 2006 1:02 am
Location: Somewhere in the vastness of space
Contact:

Re: Game engine technical details?

Post by pyramid »

DangerousDave wrote:Or would you rather keep technical wiki articles reserved for the core developers to update?
Not by any means ;) Please go ahead and write down the things you are learning. In this way we can make sure that what gets written down is also understandable to (code) newcomers.
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Post by loki1950 »

When you say fight groups, do you mean each wing of ships is grouped into a single object and exists with a position, direction, and runs an AI script, but has no physicality. Then is resolved into fully simulated ships when the player enters the system?
Yep but add a few wrinkles such as battles off-stage between those flight groups and systems changing allegiance as a result of those battles.There a couple levels of simulation.

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

Yes, flightgroups are pretty much just strings in a save file, for example (if you split it up by string):
FG:Bucknell|26 47 Sol/Haven 0 Shizu.civvie 26 26 Shenzong 6 6 Shizong 15 15

Upon entering a system, the python scripts will loop through each ship, for example the Shizu.civvie, and it will actually just call the VS.launch function 26 times.

So from the engine's perspective, it doesn't care about ships outside of your system.

The confusion might come from the fact that there is a Flightgroup class in C++ as well--and those 26 shizu's will all point to the same flightgroup there as well. Indeed, that means that they will also respond to Flightgroup directives together, so they will probably move as a group.
DangerousDave
Star Pilot
Star Pilot
Posts: 7
Joined: Tue May 27, 2008 2:43 pm

Post by DangerousDave »

OK, following on from the lower-priority method. I assume this means that when a time-slice is given to a low priority ship, the timestep you integrate over is increased to compensate for the lower update rate?

If this is the case, then how can battles between two ships work, since it would mean the ships 'jumping' all over the place, not being able to line up with one-another, and even if they did, the bullet I would assume would be simulated on a low-priority as well, so would likely 'jump through' the target?
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Post by loki1950 »

The battles in simulation don't use the ship's guns they are just dice rolls ala RPGs simpler that way :wink: no need for collision detection.

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
DangerousDave
Star Pilot
Star Pilot
Posts: 7
Joined: Tue May 27, 2008 2:43 pm

Post by DangerousDave »

OK, cheers for that. More questions :wink:

At what point does dice-roll simulation give way to full-blown rigid body simulation?

How accurate is the outcome of dice roll battles compared to fully simulated battles?
Post Reply