TypeScript (and JavaScript) functions can only return one value, but that value can be an object. To return multiple values from a function, we can return those in an object.
There are two ways of returning an object from a TypeScript function:
Create an object in the function, set the property values and return it
Create an array inline in the return statement. (An array is an object.)
In this example the first element is a string, the second is a number.
function myFunction(): [string, number] {
return ['Monday', 1];
}
let [a, b] = myFunction();
Async functions
Async functions return promises, so we need to add it to the return type declaration.
async function myFunction(): Promise<[string, number]> {
return ['Monday', 1];
}
let [a, b] = await myFunction();
Use curly braces
We can use curly braces to enclose the return values, but don’t forget to surround the entire expression with parentheses.
function myFunction(): [string, number] {
return {'Monday', 1};
}
let ( {a, b} = myFunction() );
Async functions
When an async function returns multiple values in curly braces, we don’t need the parentheses around the entire call expression.
async function myFunction(): [string, number] {
return {'Monday', 1};
}
let {a, b} = await myFunction();
These are some of the important features of Cities: Skylines II (also known as Cities: Skylines 2) released on October 14, 2023. This post is a work in progress, check back for more details as my city grows.
There are some configuration settings which make game play more enjoyable. Select Options in the main menu
Autosave
Enable Autosave on the General tab
Using multiple monitors
When your computer has multiple monitors, and you want to use the second one during game play to search the web, you need to be able to move your mouse pointer out of the game area. To be able to easily move the mouse to the second monitor
On the Graphics tab set the Game cursor mode to Free.
Edge scrolling
Turn off Edge Scrolling on the Gameplay tab, so when we work close to the edge of the screen, it does not move the map.
Elevation dragging
Elevation dragging can cause unintended results, we can turn it off.
Unlimited money, Unlock all, Natural disasters
When we start a new map, we can enable and disable Unlimited money, Unlock all, and Natural disasters. To change these options later in the gameplay:
In the Main menu select LOAD GAME
Click the MAP OPTIONS button
Select or unselect Natural Disasters, Unlock All and Unlimited Money
Increase and Decrease elevation keyboard assignment
Many laptop computers do not have dedicated PgUp and PgDn buttons. To make elevation change easier reassign these functions to the arrow buttons.
During game time press the Esc key to open the pause menu
Select the OPTIONS button
To change the key assignment for the Decrease Elevation function, on the INPUT tab click the Page Down field
On your keyboard press the Down Arrow key
Repeat the process for the Increase Elevation function
Elevation dragging
If you are comfortable using elevation dragging, we can change the elevation of roads, tracks, pipes, and cables by dragging with the mouse.
On the Advanced tab of the Input panel check Elevation Dragging.
File locations
The save and Player.log files are located at “C:\Users\%username%\AppData\LocalLow\Colossal Order\Cities Skylines II”
Maps
Maps are five times larger, than the maps in Cities: Skylines I, scaling to 14.336 km x 14.336 km, divided into 441 map tiles.
The buildable area is higher.
Tiles can be picked up in a continuous fashion, or far from each other to create separated areas
Unlocking elements
In the new version of the game not the population size, but the infrastructure size unlocks new features. We can build a large city with roads, electric and water systems, and unlock new objects, like unique buildings.
Signature buildings
Industrial Signature Buildings are unlocked when a certain number of hub buildings are placed on the map.
These hubs don’t have to be operational, so we can unlock the signature buildings just by placing the hubs on the map.
Outside connections
Every map comes with at least an outside road connection. A new outside connection is automatically created, when network reaches the edge of the map:
Road
Train
Air traffic
Power
Water
Roads
Road types
There are many new road types
Alley
Parking spaces
Road tools
Snap to
Gridlines
Zone grid
Grid tool to create grid of roads
Upgradable roundabouts
Sound barriers
Parking lots
Road maintenance
If the roads are not maintained, citizens can suffer car crashes due to slippery roads.
Intersections
We can drop an intersection on an existing road and automatically make the connections.
Bridges
To build a realistic bridge with enough clearance for the traffic below,
Above a road
Set the elevation of the bridge to 7.5m to leave enough clearance for vehicles below,
Draw the ramp long enough to display at least 5 squares on the ramp.
Above train tracks
Set the elevation of the bridge to 10m for enough clearance for the train tracks below,
Draw the ramp long enough to display 6 squares on the ramp.
Above water ways
Set the bridge elevation to 40m for large ships to be able to pass under it.
Building and modifying roads
To change the direction of a one-way street
On the Roads tool select the Replace function,
Hover above the road segment, hold the left mouse button and drag the mouse in the direction of the traffic.
Traffic management
To remove traffic lights, select the traffic light icon and right-click the intersection.
To add a sign, select the sign and left-click the location
Terrain
When we select the terrain tool, the contour lines are displayed. The elevation difference between two thin lines is 1m, between two thick lines is 10m.
Key wall
Build the key wall
We can build a paved path with concrete sea wall and outlooks.
Set the elevation step to low and build a pedestrian street in the water on at least 2.5m elevation.
Build a pedestrian street where the outlook will be
Place a small roundabout in the intersection
If the game does not want to build the roundabout that close to the water
Temporarily level the dirt next to the intersection and place the roundabout.
Fine tune the key wall or any road
To precisely move the key wall use the Replace tool
Select the Replace road tool
Turn off Snapping for fine control
Hover above the road segment, move the mouse to move the road and left-click to place it to the new location.
There are many new electric power facilities and transmission line types.
Power transmission
Traditional high voltage towers
Low voltage lines for residential areas
Underground electric power lines
Electric power transformers
For long distance power transmission use transformer stations
Selling electric power
If you generate more power than used by the map, connect the electrical system to the outside connection and sell the generated excess electricity.
Electric power supply through roads
To supply the city with electricity through the city streets
Build a street close to the outside electricity connection
Place a transformer next to the street
Connect the high voltage power line outside connection to the transformer
Water
Now we can use ground water using ground water stations.
Select the Groundwater Pumping Station to display the ground water reserves
Build a street close to the reserve
Place a Ground Water Pumping Station above the reserve
Sewage
Until the sewage treatment facility becomes available discharge the waste water into a river flowing away from your city.
Select the Sewage Outlet. This will display the direction of the flowing water
Place the Sewage Outlet on the shore
Connect the outlet to the street
Pollution
Before placing any polluting services or industries, always check the ground water, and fertile land locations, wind and surface water current direction to make sure not to pollute sensitive areas.
Air, ground, and ground water pollution automatically clears after the pollution source is moved away. It takes a long time for the ground water pollution to disappear.
The surface water pollution only disappears, if the water currents can carry the pollution away. You can bury the surface water pollution with earth. The pollution will not be visible, but when you remove the earth, the pollution becomes visible again.
Trees
Trees grow very slowly. Plant them early in the city construction, so while the the population grows, the trees have enough time to grow too. When you place a sapling, a blue dotted line shows the final size of the tree when it fully develops. Overlapping trees clear each others, so don’t plant the trees too close to each other. To create a forest, plant the saplings, and let the game run for 12 hours for the trees to grow.
Brush tool
Use the brush tool to plant multiple trees and paint forests.
Roads with trees
There are roads types with trees on both, or only on one side of the road.
Zoning
New zoning options
6 residential zone types
Low income
Mixed commercial
Suburbs
Services
The available services are
Communications
Parks and recreation
Transportation
Emergency
Power
Welfare
Police
Fire
When placing service buildings, build parking spaces next to them for workers and visitors, and leave room around them for upgrades.
Elementary school
Children’s clinic
Extra capacity
Playground
High school
Extension wing
School library
Sports field
Health care
Extension wing
Ambulance depot
Fire house
Police station
Garage
Road can be built later
Some services can be placed without road connection, we can build the roads later:
Landfill
Upgrade the dump area for more capacity
Industries
Stone mine
To build a realistic stone mine we cannot build a road in the mine, but we can terraform the mine area build the road, and flow the mine area around and between the roads.
Leave room for the gravel road going in
Terraform a lower level terrace for the road and build the gravel road in the gap
Line up the edges with the road
Continue with a lower level road foundation
Build the second section of the road, but leave the area open to be able to bring the mine in between the roads.
Update the shape of the mine
Mine building in the mine
We can even place a mine building in the middle of the mine.
Terraform a flat area for the building a curved slope for the road, and place a Stone Mining industry at the bottom of the pit.
Build a gravel road on the slope
Clear some area in the middle of the mine next to the road
Place the mining area next to the gravel road
AI and simulation
We can follow citizens:
Select the person
Click the follow icon
Economy
Budget
Loans
Taxation
By adjusting the the taxation we may be able to encourage certain industries to invest more in the city, hire more people and produce more.
The art of taxation
If nobody is complaining about the tax rate, it is too low. Keep the overall happiness, so people move in.
Residential – 18%
Tax rates by zones and education levels
Residential
Uneducated
Poorly educated
Educated
Well educated
Highly educated
Commercial
Industrial
Office
Services
Production
The Materials section shows the surplus/deficit of each raw materials. To reduce import, start producing or mining raw materials.
Industries with higher production deficit build first:
Certain industries need larger areas to build, like textile factories, so make sure the industrial zones contain large sections too.
When we designate the specialized industry area, like farms, the arc of the angle shows which side we are defining:
To adjust the area use the Specialized Industry Area Tool
There a more specialized industries:
On any land
Livestock farming
On fertile land
Grain farming
Vegetable farming
Textile fiber farming
Forestry
Stone mining is important for the upkeep of people’s houses.
Coal mining
Ore mining
Oil drilling
Trading
We can trade through outside connections
Electricity,
Water and Sewage (build water and sewage pipes to the edge of the map),
Road maintenance,
Healthcare,
Garbage management,
Fire and rescue,
Police,
Education.
Progression
We can collect Expansion Points (XP) by
Building
city service buildings and their upgrades,
signature buildings and
roads,
Increasing the population and citizen happiness
When an XP threshold reached we progress to the next milestone and receive more funds. To see how many more Expansion Points are needed to reach the next milestone, hover above the Progression icon
Examples:
Roads
Small roundabout – 10 XP
Medium roundabout – 15 XP
Large roundabout – 20 XP
Very large roundabout – 25 XP
Signature buildings
Pop musician mansion – 250 XP, +2 well-being within 500m
We can unlock signature buildings by
Building 10 rock mines anywhere
There are 20 city milestones, each granting Expansion Permits to buy tiles, and Development Points to unlock advanced features and city services.
Tiny village
Small village
Large village
Grand village – 3,500 XP
Tiny town
Boom town
Busy town
Big town
Great town
Small city
Big city
Large city
Huge city
Grand city
Metropolis
Thriving metropolis
Flourishing metropolis
Expansive metropolis
Massive metropolis
Megapolis
Buildings can be upgraded
High school with football stadium and athletic field
Expansion Permits
Use the permits to purchase additional tiles
Development Points
Use the Development Points to unlock advanced services on the tech tree. Click the Progression icon to open the tech tree panel.
Education
Roads
Advanced road service let us add and remove traffic lights, road signs, crosswalks, sidewalks, grass, trees, street lights, sound barriers.
Game design
Colossal Order creates the PC and console version of the game, so all design decisions are made to maximize the experience on both versions.
import time
from locust import HttpUser, task, between
class QuickstartUser(HttpUser):
wait_time = between(1, 5)
@task(3)
def view_items(self):
# self.client.get(url + "/")
self.client.get("/")
@task
def hello_world(self):
# self.client.get(url + "/about")
self.client.get("/about")
def on_start(self):
a = 0 # Just a placeholder, as every def has to have at least one executable instruction
# No login is necessary for this site
# self.client.post("/login", json={"username":"foo", "password":"bar"})
Starting Locust
Open a terminal in the directory where the locustfile.py is located.
Specify the number of concurrent users and the span rate of the users. Enter the URL of the site to be tested. IMPORTANT: Make sure there is no slash at the end of the URL, otherwise the generated URL will contain double slashes!!!
Click the Start swarming button.
Changing the load test script
To make sure, Locust will execute the updated script
Stop the Locust process in the terminal with CTRL-C
Modify and save the locustfile.py file
Start the Locust process with locust -f locustfile.py
When we select stations to define a rail line, only one way travel is defined. The returning train always selects the shortest path. In this example Vienna West is in the station list, the return path is not defined, so the train will return through Vienna Ost, the shorter path.
To make sure the returning train follows the same route, specify the stations for the returning train too.
To increase profit (or reduce losses) you can make adjustments to your empire.
Keep a train lines profitable
Train completed last tour without freight
If the train frequently leaves a station without freight, set the minimum number of wagons to 4 for that station. The train will wait at the station until at least 4 wagons are loaded. Add a track to the station for the train to wait on, so other trans can also use the station.
If you set the other end of the line with the same restriction, it is possible, that the train will very rarely return to this station.
Click the triangle to select the line
Click the Edit Rail Line button
Hover above the station and click the Edit Station button
Set the preferred track, the minimum number of wagons to 4 and click the check mark.
Click the Confirm button
Train has been waiting for a free track for some time now
Assign the lines to the tracks of the station. By default trains select the shortest route using the same track of the station.
Select the station
Select the Routes using this station button
Select a line
Click the Edit Rail Line button
Hover above the panel of the station and click the Edit Station button
Select a track for the line
Keep the businesses profitable
Do not oversize the industry. If the level is too high for the demand, the higher operating costs will reduce or eliminate the profit. Slowly increase the level, because if the utilization falls below 60%, the business starts to lose money. This happens if the inflow of raw materials is not enough, or the business cannot sell the products. Make sure you run enough trains to supply the raw materials and ship the products to cities where there is demand for them. Farms do not lose money if the production is mostly continuous.
Error: MUI: The data grid component requires all rows to have a unique id property. Alternatively, you can use the getRowId prop to specify a custom id for each row. A row was provided without id in the rows prop:
The Material UI Data Grid needs to have a unique ID to identify the rows.
To specify the column with the unique numbers, use the getRowId property.