I hope it will help you with starting.
This video is not explaining all the details but aims at showing first steps so:
- Maps
- Files necesary to have in mode
There is good tutorials detailing map making and files editing but if you need something more just ask i comments.
As promised code for simple python script with color generation:
import random
import colorsys
import json
import os
class ProvinceGenerator:
def __init__(self):
self.color_file = "used_colors.json"
self.load_used_colors()
self.province_id = 1
def load_used_colors(self):
if os.path.exists(self.color_file):
with open(self.color_file, 'r') as f:
self.used_colors = set(tuple(color) for color in json.load(f))
else:
self.used_colors = set()
def save_used_colors(self):
with open(self.color_file, 'w') as f:
json.dump(list(self.used_colors), f)
def generate_unique_color(self, is_sea):
while True:
if is_sea:
hue = random.uniform(0.5, 0.7) # Odcienie niebieskiego
else:
hue = random.uniform(0, 0.5) or random.uniform(0.7, 1) # Wszystko oprócz niebieskiego
saturation = random.uniform(0.5, 1)
value = random.uniform(0.7, 1) # Jasne kolory
r, g, b = [int(x * 255) for x in colorsys.hsv_to_rgb(hue, saturation, value)]
color = (r, g, b)
if color not in self.used_colors:
self.used_colors.add(color)
self.save_used_colors()
return color
def generate_provinces(self, count, is_sea, start_id):
result = []
for i in range(count):
r, g, b = self.generate_unique_color(is_sea)
province_type = "Sea" if is_sea else "Land"
result.append(f"{start_id + i};{r};{g};{b};{province_type}{start_id + i};x")
return result
def run(self):
while True:
command = input("Podaj komendę (np. '20 sea 5' lub '30 land 100') lub 'exit' aby zakończyć: ").lower()
if command == 'exit':
break
try:
parts = command.split()
if len(parts) != 3:
raise ValueError
count, province_type, start_id = parts
count = int(count)
start_id = int(start_id)
if province_type not in ['sea', 'land']:
raise ValueError
except ValueError:
print("Nieprawidłowa komenda. Spróbuj ponownie.")
continue
provinces = self.generate_provinces(count, province_type == 'sea', start_id)
print("\n".join(provinces))
print()
if __name__ == "__main__":
generator = ProvinceGenerator()
generator.run()
Тэги:
#EU4 #Tutorial #Overhaul #Total_Conversion #Europa_Universalis_4 #How_to_start