Tech Design

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderators: Committer, Committer

Post Reply
Message
Author
Almkaz
Space Floater
Posts: 31
Joined: Thu Sep 18, 2003 12:25 pm
Location: Ottawa, Canada

Tech Design

#1 Post by Almkaz » Wed Oct 22, 2003 5:24 pm

As part of flushing out the turn processing on the server, I am dealing with research and techs. Part of tzlaine's earlier post on things to complete for v0.1 is deciding on the Tech format.

Currently we have a TechLevel class which is very basic. One way to handle all the different Techs we need is to have a class for each, well, class of tech types. One for a tech that adds avail. building types, another that allows colonization of a given planet type, etc.

However, I will propose having just 2 classes - the TechLevel and TechManager classes that exist currently. I propose this for two reasons. For one, even the different types of tech levels can amount to a large number of classes. In addition we probably want to make the techs as data-driven as possible. By data-driven, I mean that the techs just manipulate variables for a given empire.

The data in the tech class will be used to manipulate game variables. These game variables will be for each empire and include things like lists for which building it can build ( same goes for ship types , variables for which planet type the empire can colonize, the empire's morale modifier, etc. The game mechanics will use this data instead of querying if an empire has X or Y tech. This makes adding/removing techs easier, maintaining the game logic code easier, and allows the empire's abilities to be changed by something other than tech ( like race ).

So, the techLevel class would contain all data needed to describe any type of tech advance and the tech manager would contain the logic for implementing all data. There will be no 'tech level type' per say, the tech manager would just look at the defined data and act accordingly.

The TechLevel class could thus have the following members ( I'm not current on all the Techs designed for FO, I'm using existing strat games for tech types - we can obviously add/remove data here as needed ).


- An array of requisite tech IDs: The TechManager class will use these to determine if a given tech can be researched. The IDs should be literal strings so that it's easier to maintain the tech database

- An array of 'leads to' techs. This is dynamically created at load time by the TechManager by, for a given tech, looping through and finding all that have it listed as a requisite. The techs can be stored as their internal numeric.

- An array of buildings made available: The array would be strings again, to reference whatever building database we come up with ( for v0.1 we don't need one ). When this Tech is researched, the buildings are added to the empire's list of available buildings

- An array of ship types made available: Probably same as above, for the buildings

- For each major stat/modifier - a % change (ex: morale modifier, research speed, galactic sensor range, etc )

- Much of the data for abilities are either on or off ( like can colonize X type of planet ). These can be done with bit flags. The tech ( as well as empire data ) will have bit flags indicating these boolean values


So, essentially techs are just a means of modifying the game state for the empire by supplying data as to what should be changed and how.

Does this sound like a logical way to go?

Andrew

jbarcz1
Creative Contributor
Posts: 226
Joined: Thu Jun 26, 2003 4:33 pm
Location: Baltimore, MD

#2 Post by jbarcz1 » Wed Oct 22, 2003 8:47 pm

In 0.1, we basically have 4 techs MARK2, BASE,MARK3,MARK4
They all have fixed research point requirements. And each is a prerequisite for the next (see the 0.1 design doc for the specifics). Since this is all we have, we can probably get away with using TechLevel and TechManager as it is now, with no real modifications (unless we want to externalize all the stats in a file, which we probably should).

Something to keep in mind. We have passed a tech tree design, that will be similar to Hearts of Iron. I've never played that game, but from what I gather it divides things into theoretical techs (that let you research applications), applied techs (that give concrete improvements), and refinements (which let you improve the stats for existing applications). The specifics really haven't been finalized yet, and will probably change over the course of our design. There remain some details to be worked out (how research will be calculated for example. We also have no idea what the effects of techs will be yet. Ship techs, for instance, wont be decided until combat is finalized, so we'll have to wait till at least 0.4 to know what data we need to store for each tech.

I predict that by the time we get to 0.3, the 0.1 tech tree will be sent to the scrap heap in favor of a new system involving different classes, though we might keep TechLevel as a base class (possibly renamed)). This is the reason why, when I designed the Tech system, I made the TechLevel class as general as I could possibly make it. Since we know there are going to be changes made, but dont know all the details, it's probably a good idea to keep TechLevel as vague as possible for a while until we know more about how the final tech tree will look.
Empire Team Lead

User avatar
tzlaine
Programming Lead Emeritus
Posts: 1092
Joined: Thu Jun 26, 2003 1:33 pm

#3 Post by tzlaine » Wed Oct 22, 2003 10:47 pm

This is a nit-pick, but then again I'm well known as a nomenclacture nazi ("No nomenclature for you!"), so here goes. Can we call TechLevel Tech instead? I find it confusing, and thought there was something more to TechLevels than merely being technologies, like maybe there were Techs that were going to be included in each TechLevel or something. Just plain "Tech" is clearer.

That aside, I think you guys are both right. Andrew is right in his approach to comprehensively defining all tech effects through simple parameterization. Josh is right that for v0.1 we should just stay with the four simple techs we have to have.

After techs are decided upon by designers, we should probably do a modified version of the simple, single tech class, and have three simple tech classes: TheoryTech, AppliedTech, and TechRefinement. TechRefinement might be declared as an embedded class within AppliedTech. The TechRefinements can be applied to modify AppliedTechs just as AppliedTechs are used to modify the owning empire's abilities in the game.

How does that sound?

jbarcz1
Creative Contributor
Posts: 226
Joined: Thu Jun 26, 2003 4:33 pm
Location: Baltimore, MD

#4 Post by jbarcz1 » Wed Oct 22, 2003 11:07 pm

Sounds good. And I agree with you about the naming thing. I called it 'TechLevel' because I'd assumed a system more akin to MOO1 and MOO3 where different research 'levels' granted you different devices and enhancements (these would have been seperate classes). For our system, TechLevel doesn't make much sense.

JB
Empire Team Lead

User avatar
Daveybaby
Small Juggernaut
Posts: 724
Joined: Mon Sep 01, 2003 11:07 am
Location: Hastings, UK

#5 Post by Daveybaby » Thu Oct 23, 2003 2:23 pm

As a part of the definition of each tech it should probably still be given a 'level' used as a base to work out how much effort is required to research it. Kinda like in Moo3 where cost = base * level ^ exponent (IIRC).

One of the good things about moo3 was that it was easy to mess around with tech speeds to your hearts content without messing up the relative tech 'difficulties' by just changing a few values, having to edit each individual tech. A good job really since they messed up the tech speeds on release. And then made it worse with the first patch :roll: :wink:

Almkaz
Space Floater
Posts: 31
Joined: Thu Sep 18, 2003 12:25 pm
Location: Ottawa, Canada

#6 Post by Almkaz » Sat Oct 25, 2003 12:04 pm

From what I can see, there are 2 ways we can add techs for v0.1

1) We can already complete reseach and add them ot the empire's list of techs. We could use this list in the build UI to add items to the build list if the tech exists

2) We could imlement a 'available build items' list for each empire which would contain build designs. The tech could then add the avail item to this list and the UI would use the list for build items and costs ( I've noticed the costs are hard-coded in the UI so this would help as well )

I guess the mian question is - is it important to get 0.1 done faster? Or should I do this little more effort but will be more close to the final design?

We're looking in great shape!

Andrew

jbarcz1
Creative Contributor
Posts: 226
Joined: Thu Jun 26, 2003 4:33 pm
Location: Baltimore, MD

#7 Post by jbarcz1 » Sat Oct 25, 2003 3:21 pm

I was under the impression that the UI would search the Empire's tech list to decide what to put into the build queue. We could make it so that only the ships a player has researched show up in the design list, and then use the design list to figure out what can be built. Problem with that is it doesn't take defense bases into account, so we'd have to fall back on searching the tech list to check for that (it would be overkill to add a 'CanBuildDefBase()') method.

I think it would be quicker, (though not necessarily better) to just check the Empire's tech list when populating the UI build list. Either approach would not be all that hard to implement though.

JB
Empire Team Lead

User avatar
tzlaine
Programming Lead Emeritus
Posts: 1092
Joined: Thu Jun 26, 2003 1:33 pm

#8 Post by tzlaine » Sat Oct 25, 2003 4:11 pm

Right now, I favor just doing it faster, to be honest. This particular area is going to be more-or-less tossed out when we do techs "for real", so I say we use option 1).

As for how to generate the build list in the final version, I put a comment in that part of the UI that indicates that the UI will query the specific planet where production takes place, to determine what can be built (different planets will have different build capabilities, like shipyards, probably). Of course this too may get chucked, since we may have system- or empire-wide building at some point.

Post Reply