Skip to content

Commit

Permalink
V1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
domhnallmorr committed Jan 25, 2025
1 parent cde779f commit e961481
Show file tree
Hide file tree
Showing 106 changed files with 695 additions and 619 deletions.
38 changes: 15 additions & 23 deletions Roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,41 +13,34 @@ The bottom of this page includes a high level overview of additions for V2. Belo

## UI Improvements

- Add country flags
- Need page for each track (overtaking difficulty, engine sensitivity and any other track details)
- <span style="background-color: #115407">Add country flags</span>
- Need page for each track (overtaking difficulty and any other track details)
- Improve Email page
- Improve team selection page
- Add engine page


## Off Track Features

### Finance

- Add projections for year
- Race costs should vary by distance from Europe
- <span style="background-color: #115407">Race costs should vary by distance from Europe</span>
- Crash damage costs
- Track profit/loss
- Car development costs

### Car

- Car should be split into engine and chassis
- Track should have an attribute on how sensitive performance is to engine performance
- Add engine class
power
hard code engine suppliers for each team
random change each season
- Add car development to increase car speed

### Sponsors

- Add title sponsors
Dependent on commercial manager
- Have "other sponsorship" attribute

### Drivers

- Add consistency attribute
feed into laptime calculation
- Track driver statistics
- <span style="background-color: #115407">Add consistency attribute</span>

### Contract Negotiations

Expand All @@ -57,28 +50,27 @@ The bottom of this page includes a high level overview of additions for V2. Belo

- Add team principal as staff member to AI teams
- Replace real driver names with fake names
- Add winner column to calendar page
- Add track lengths
- <span style="background-color: #115407">Add winner column to calendar page</span>
- <span style="background-color: #115407">Add track lengths</span>

## On Track

- Add overtake difficulty attribute to tracks
- Add random driver crashes
- Improve AI pit strategies
- Proper base laptime for each track
- <span style="background-color: #115407">Proper base laptime for each track</span>

## Refactoring

- Add a custom widget for datatables
- <span style="background-color: #115407">Add a custom widget for datatables</span>
- Reduce use of dictioaries to improve type hinting
- Improve use of enums
- Review and improve grand_prix_model
- Improve use of randomisers
- Improve load_roster function


# V2 Overview

- In season testing
- Car development
- Next years car development
- Engine/tyre customer/partner/works deals
Expand All @@ -91,14 +83,14 @@ The bottom of this page includes a high level overview of additions for V2. Belo
- Additonal details in races
Crashes
Mistakes
Punctures
Overtaking difficulty per track
broken front wing
- Add practice session
1st turn incidents
- Add timing screen page for on-track sessions
- Save previous season results/stats
- Improve existing code base
- Improve pit strategies
- Images of drivers/staff
- Pay off facility upgrades over time
- Split workforce into commercial, mechanics, design
- Basic contract negotiation for drivers/staff
- Track driver statistics
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Coming Soon
Binary file modified preview/preview2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified preview/preview4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified preview/preview6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/1998_Roster/roster.db
Binary file not shown.
3 changes: 2 additions & 1 deletion src/1998_Roster/tracks/Hockenheimring.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Country: Germany
Location: Hockenheim
Title: German Grand Prix
Laps: 45
Base Laptime: 84_000
Base Laptime: 97_000
Length: 6.823
3 changes: 2 additions & 1 deletion src/1998_Roster/tracks/Hungaroring.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Country: Hungary
Location: Budapest
Title: Hungarian Grand Prix
Laps: 77
Base Laptime: 84_000
Base Laptime: 73_000
Length: 3.972
3 changes: 2 additions & 1 deletion src/1998_Roster/tracks/Monza.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Country: Italy
Location: Monza
Title: Italian Grand Prix
Laps: 53
Base Laptime: 84_000
Base Laptime: 80_000
Length: 5.770
5 changes: 3 additions & 2 deletions src/1998_Roster/tracks/Nurburgring.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Name: Nurburgring
Country: Germany
Country: Luxembourg
Location: Nurburg
Title: Luxembourg Grand Prix
Laps: 67
Base Laptime: 84_000
Base Laptime: 74_000
Length: 4.556
3 changes: 2 additions & 1 deletion src/1998_Roster/tracks/Spa.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Country: Belgium
Location: Stavelot
Title: Belgian Grand Prix
Laps: 44
Base Laptime: 84_000
Base Laptime: 104_000
Length: 6.968
3 changes: 2 additions & 1 deletion src/1998_Roster/tracks/Suzuka.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Country: Japan
Location: Suzuka
Title: Japanese Grand Prix
Laps: 53
Base Laptime: 84_000
Base Laptime: 62_000
Length: 5.860
3 changes: 2 additions & 1 deletion src/1998_Roster/tracks/a1_ring.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Country: Austria
Location: Spielberg
Title: Austrian Grand Prix
Laps: 71
Base Laptime: 84_000
Base Laptime: 68_000
Length: 4.319
3 changes: 2 additions & 1 deletion src/1998_Roster/tracks/albert_park.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Country: Australia
Location: Melbourne
Title: Australian Grand Prix
Laps: 58
Base Laptime: 84_000
Base Laptime: 84_000
Length: 5.303
3 changes: 2 additions & 1 deletion src/1998_Roster/tracks/barcelona.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Country: Spain
Location: Barcelona
Title: Spanish Grand Prix
Laps: 66
Base Laptime: 84_000
Base Laptime: 75_000
Length: 4.728
3 changes: 2 additions & 1 deletion src/1998_Roster/tracks/buenos_aries.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Country: Argentina
Location: Buenos Aries
Title: Argentinian Grand Prix
Laps: 72
Base Laptime: 84_000
Base Laptime: 80_000
Length: 4.259
5 changes: 3 additions & 2 deletions src/1998_Roster/tracks/imola.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Name: Autodromo Enzo e Dino Ferrari
Country: Italy
Country: San Marino
Location: Imola
Title: San Marino Grand Prix
Laps: 62
Base Laptime: 84_000
Base Laptime: 81_000
Length: 4.933
3 changes: 2 additions & 1 deletion src/1998_Roster/tracks/interlagos.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Country: Brazil
Location: Sao Paulo
Title: Brazilian Grand Prix
Laps: 72
Base Laptime: 84_000
Base Laptime: 72_000
Length: 4.292
3 changes: 2 additions & 1 deletion src/1998_Roster/tracks/magny_cours.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Country: France
Location: Magny-Cours
Title: French Grand Prix
Laps: 72
Base Laptime: 84_000
Base Laptime: 70_000
Length: 4.250
3 changes: 2 additions & 1 deletion src/1998_Roster/tracks/monaco.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Country: Monaco
Location: Monte Carlo
Title: Monaco Grand Prix
Laps: 78
Base Laptime: 84_000
Base Laptime: 75_000
Length: 3.367
3 changes: 2 additions & 1 deletion src/1998_Roster/tracks/montreal.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ Country: Canada
Location: Montreal
Title: Canadian Grand Prix
Laps: 70
Base Laptime: 84_000
Base Laptime: 73_000
Length: 4.421
5 changes: 3 additions & 2 deletions src/1998_Roster/tracks/silverstone.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Name: Silverstone Circuit
Country: UK
Country: United Kingdom
Location: Silverstone
Title: British Grand Prix
Laps: 60
Base Laptime: 84_000
Base Laptime: 79_000
Length: 5.140
2 changes: 1 addition & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def main(page: ft.Page):

page.window.maximized = True

version = "1.0.0"
version = "1.1.0"
page.title = f"Pitwall {version}"

run_directory = os.path.dirname(os.path.join(os.path.abspath(__file__)))
Expand Down
53 changes: 9 additions & 44 deletions src/pw_controller/page_update_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from pw_model.pw_model_enums import StaffRoles
from pw_model.finance import finance_data
from pw_controller.page_update_typed_dicts import HomePageData
from pw_controller.staff_page.staff_page_data import get_staff_page_data

if TYPE_CHECKING:
from pw_controller.pw_controller import Controller
Expand Down Expand Up @@ -40,61 +41,25 @@ def refresh_ui(self, new_season: bool=False) -> None:
self.update_facilities_page()

def update_staff_page(self, new_season: bool=False) -> None:
team_model = self.model.get_team_model(self.model.player_team)

staff_values = [[team.name, team.number_of_staff] for team in self.model.teams]
staff_values.sort(key=lambda x: x[1], reverse=True) # sort, highest to lowest

#TODO player_requiring_technical_director works, but seems brittle, needs dedicated method
data = {
"driver1": team_model.driver1,
"driver1_age": team_model.driver1_model.age,
"driver1_country": team_model.driver1_model.country,
"driver1_speed": team_model.driver1_model.speed,
"driver1_contract_length": team_model.driver1_model.contract.contract_length,
"driver1_salary": team_model.driver1_model.contract.salary,
"driver1_retiring": team_model.driver1_model.retiring,
"player_requiring_driver1": self.model.staff_market.player_requiring_driver1,

"driver2": team_model.driver2,
"driver2_age": team_model.driver2_model.age,
"driver2_country": team_model.driver2_model.country,
"driver2_speed": team_model.driver2_model.speed,
"driver2_contract_length": team_model.driver2_model.contract.contract_length,
"driver2_salary": team_model.driver2_model.contract.salary,
"driver2_retiring": team_model.driver2_model.retiring,
"player_requiring_driver2": self.model.staff_market.player_requiring_driver2,

"commercial_manager": team_model.commercial_manager,
"commercial_manager_age": team_model.commercial_manager_model.age,
"commercial_manager_contract_length": team_model.commercial_manager_model.contract.contract_length,
"commercial_manager_skill": team_model.commercial_manager_model.skill,
"player_requiring_commercial_manager": self.model.staff_market.compile_teams_requiring_manager(StaffRoles.COMMERCIAL_MANAGER),

"technical_director": team_model.technical_director,
"technical_director_age": team_model.technical_director_model.age,
"technical_director_contract_length": team_model.technical_director_model.contract.contract_length,
"technical_director_skill": team_model.technical_director_model.skill,
"player_requiring_technical_director": self.model.staff_market.compile_teams_requiring_manager(StaffRoles.TECHNICAL_DIRECTOR),

"staff_values": staff_values,

}

self.view.staff_page.update_page(copy.deepcopy(data), new_season)
data = get_staff_page_data(self.model)
self.view.staff_page.update_page(data, new_season)

def update_standings_page(self) -> None:
drivers_standings_df = self.model.season.standings_manager.drivers_standings_df.copy(deep=True)
constructors_standings_df = self.model.season.standings_manager.constructors_standings_df.copy(deep=True)

self.view.standings_page.update_standings(drivers_standings_df, constructors_standings_df)
drivers_flags = [self.model.get_driver_model(d).country for d in drivers_standings_df["Driver"].values]
team_flags = [self.model.get_team_model(t).country for t in constructors_standings_df["Team"].values]
self.view.standings_page.update_standings(drivers_standings_df, constructors_standings_df, drivers_flags, team_flags)

def update_email_page(self) -> None:
emails = copy.deepcopy(self.model.inbox.emails)
self.view.email_page.update_page(emails)

def update_finance_page(self) -> None:
data: finance_data.FinanceData = {
"profit": copy.deepcopy(self.model.player_team_model.finance_model.season_profit),

"total_sponsorship": copy.deepcopy(self.model.player_team_model.finance_model.total_sponsorship),
"prize_money": copy.deepcopy(self.model.player_team_model.finance_model.prize_money),
"drivers_payments": copy.deepcopy(self.model.player_team_model.finance_model.drivers_payments),
Expand All @@ -104,7 +69,7 @@ def update_finance_page(self) -> None:
"drivers_salary": copy.deepcopy(self.model.player_team_model.finance_model.drivers_salary),
"technical_director_salary": copy.deepcopy(self.model.player_team_model.technical_director_model.contract.salary),
"commercial_manager_salary": copy.deepcopy(self.model.player_team_model.commercial_manager_model.contract.salary),
"race_costs": 8_000_000, # hard code this for now TODO, make it variable
"race_costs": self.model.player_team_model.finance_model.transport_costs_model.estimated_season_costs,
"car_costs": self.model.player_team_model.finance_model.car_cost,
"total_expenditure": copy.deepcopy(self.model.player_team_model.finance_model.total_expenditure), # hard code this for now TODO, make it variable

Expand Down
8 changes: 5 additions & 3 deletions src/pw_controller/pw_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

from flet import Page

from pw_controller import calander_page_controller, staff_hire_controller, facilities_controller
from pw_controller import calander_page_controller, facilities_controller
from pw_controller.staff_page import staff_hire_controller
from pw_model import pw_base_model
from pw_view import view
from pw_controller import race_controller, page_update_controller
Expand Down Expand Up @@ -88,7 +89,8 @@ def update_email_button(self) -> None:
def go_to_race_weekend(self) -> None:
self.race_controller = race_controller.RaceController(self)
data = {
"race_title": self.model.season.current_track_model.title
"race_title": self.model.season.current_track_model.title,
"country": self.model.season.current_track_model.country
}
self.view.go_to_race_weekend(data)

Expand All @@ -102,7 +104,7 @@ def return_to_main_window(self) -> None:
# self.view.main_window.update_advance_btn("advance")

def post_race_actions(self) -> None:
self.model.season.post_race_actions()
self.model.season.post_race_actions(self.race_controller.race_model.current_session.winner)
self.model.save_career()

self.page_update_controller.update_standings_page()
Expand Down
Loading

0 comments on commit e961481

Please sign in to comment.