Compare commits

..

4 Commits

6 changed files with 32 additions and 34 deletions

View File

@@ -1,26 +1,12 @@
![Logo](https://i.imgur.com/c2k18E1.png)
[DCS World](https://www.digitalcombatsimulator.com/en/products/world/) single-player dynamic campaign.
[DCS World](https://www.digitalcombatsimulator.com/en/products/world/) single-player semi dynamic campaign.
Uses [pydcs](http://github.com/pydcs/dcs) for mission generation.
DCS Liberation uses [pydcs](http://github.com/pydcs/dcs) for mission generation
and [Mist](https://github.com/mrSkortch/MissionScriptingTools) for mission scripting
## Tutorials
* [Manual](https://github.com/shdwp/dcs_liberation/wiki/Manual)
## Resources
You should start with the manual, it covers everything you need to know before playing the campaign.
* [Getting Started](https://github.com/Khopa/dcs_liberation/wiki/Getting-started)
* [Strike objectives reference images](https://imgur.com/a/vCSHa9f)
If you can't find the strike objective you can see here how it's supposed to look.
* [Troubleshooting](https://github.com/shdwp/dcs_liberation/wiki/Troubleshooting)
You could also briefly check the troubleshooting page to get familiar with the known issues that you could probably fix by yourself.
* [Modding tutorial](https://github.com/shdwp/dcs_liberation/wiki/Modding-tutorial)
Modding tutorial will cover how to change default loadouts, configure which planes are present in the campaign (or add new altogether) and more. Check this out if you find that something is not going for your liking, there could be a tutorial for changing that. Although be aware that it would require changing source files and could easily result in non functioning application.
* [Development guide](https://github.com/shdwp/dcs_liberation/wiki/Development-guide)
If you want to contribute to the project, this will give you a brief overview and on how to actually run it from source files.
* [Tutorials](https://github.com/Khopa/dcs_liberation/wiki/Tutorial-01-:-UI)

View File

@@ -68,7 +68,7 @@ class NameGenerator:
def random_objective_name(self):
if len(self.ANIMALS) == 0:
random.choice(ALPHA_MILITARY).upper() + " #" + str(random.randint(0, 100))
return random.choice(ALPHA_MILITARY).upper() + "#" + str(random.randint(0, 100))
else:
animal = random.choice(self.ANIMALS)
self.ANIMALS.remove(animal)

View File

@@ -7,6 +7,7 @@ from dcs.task import CAP, CAS
import qt_ui.uiconstants as CONST
from game import db, Game
from gen import namegen
from theater import start_generator, persiangulf, nevada, caucasus, ConflictTheater, normandy
from userdata.logging import version_string
@@ -29,6 +30,7 @@ class NewGameWizard(QtWidgets.QWizard):
self.generatedGame = None
def accept(self):
blueFaction = [c for c in db.FACTIONS if db.FACTIONS[c]["side"] == "blue"][self.field("blueFaction")]
redFaction = [c for c in db.FACTIONS if db.FACTIONS[c]["side"] == "red"][self.field("redFaction")]
playerIsBlue = self.field("playerIsBlue")
@@ -40,7 +42,6 @@ class NewGameWizard(QtWidgets.QWizard):
isTerrainNormandy = self.field("isTerrainNormandy")
isTerrainEmirates = self.field("isTerrainEmirates")
timePeriod = db.TIME_PERIODS[list(db.TIME_PERIODS.keys())[self.field("timePeriod")]]
sams = self.field("sams")
midGame = self.field("midGame")
multiplier = self.field("multiplier")
@@ -64,27 +65,38 @@ class NewGameWizard(QtWidgets.QWizard):
else:
conflicttheater = caucasus.CaucasusTheater()
self.generatedGame = self.start_new_game(player_name, enemy_name, conflicttheater, sams, midGame, multiplier,
self.generatedGame = self.start_new_game(player_name, enemy_name, conflicttheater, midGame, multiplier,
timePeriod)
super(NewGameWizard, self).accept()
def start_new_game(self, player_name: str, enemy_name: str, conflicttheater: ConflictTheater, sams: bool,
def start_new_game(self, player_name: str, enemy_name: str, conflicttheater: ConflictTheater,
midgame: bool, multiplier: float, period: datetime):
if midgame:
for i in range(0, int(len(conflicttheater.controlpoints) / 2)):
conflicttheater.controlpoints[i].captured = True
start_generator.generate_inital_units(conflicttheater, enemy_name, sams, multiplier)
# Reset name generator
namegen.reset()
print("-- Starting New Game Generator")
print("Enemy name : " + enemy_name)
print("Player name : " + player_name)
print("Midgame : " + str(midgame))
start_generator.generate_inital_units(conflicttheater, enemy_name, True, multiplier)
print("-- Initial units generated")
game = Game(player_name=player_name,
enemy_name=enemy_name,
theater=conflicttheater,
start_date=period)
print("-- Game Object generated")
start_generator.generate_groundobjects(conflicttheater, game)
game.budget = int(game.budget * multiplier)
game.settings.multiplier = multiplier
game.settings.sams = sams
game.settings.sams = True
game.settings.version = version_string()
if midgame:
@@ -278,21 +290,16 @@ class MiscOptions(QtWidgets.QWizardPage):
self.setPixmap(QtWidgets.QWizard.LogoPixmap,
QtGui.QPixmap('./resources/ui/wizard/logo1.png'))
sams = QtWidgets.QCheckBox()
sams.setChecked(True)
midGame = QtWidgets.QCheckBox()
multiplier = QtWidgets.QSpinBox()
multiplier.setEnabled(False)
multiplier.setMinimum(1)
multiplier.setMaximum(5)
self.registerField('sams', sams)
self.registerField('midGame', midGame)
self.registerField('multiplier', multiplier)
layout = QtWidgets.QGridLayout()
#layout.addWidget(QtWidgets.QLabel("With SAM Systems :"), 0, 0)
#layout.addWidget(sams, 0, 1)
layout.addWidget(QtWidgets.QLabel("Start at mid game"), 1, 0)
layout.addWidget(midGame, 1, 1)
layout.addWidget(QtWidgets.QLabel("Ennemy forces multiplier [Disabled for Now]"), 2, 0)

View File

@@ -163,7 +163,7 @@ def find_location(on_ground, near, theater, min, max, others) -> typing.Optional
:return:
"""
point = None
for _ in range(1000):
for _ in range(300):
# Check if on land or sea
p = near.random_point_within(max, min)

View File

@@ -46,4 +46,4 @@ else:
logging.basicConfig(stream=log_stream, level=logging.INFO)
Tk.report_callback_exception = _handle_exception
logging.info("DCS Libration {}".format(_version_string))
logging.info("DCS Liberation {}".format(_version_string))

View File

@@ -46,7 +46,12 @@ def restore_game():
return None
with open(_save_file(), "rb") as f:
return pickle.load(f)
try:
save = pickle.load(f)
return save
except:
print("Invalid Save game")
return None
def save_game(game) -> bool: