FeudalSim Medieval World System
Overview
We've created a comprehensive medieval world system for FeudalSim, based on historically accurate data from 1455 Europe. This system includes:
- Map System - A node-based map with cities, towns, and connections
- Political Hierarchy - Empires, kingdoms, duchies, and counties
- Resource System - Raw materials, processed goods, and crafted items
- Economic Model - Market mechanics, production, and trade
Components Created
1. Data Models
- Political Entities
- Empire, Kingdom, Duchy, County models
- Title and TitleHistory for tracking rulers
- Political relationships and hierarchies
- Map Nodes
- Cities, towns, villages, castles, etc.
- Node connections (roads, paths, rivers)
- Travel routes and active travel tracking
- Economic System
- Resources with categories, weights, and values
- Production processes with inputs and outputs
- Buildings for resource processing
- Market listings and transactions
- Character System
- Character profiles and skills
- Inventory management
- Travel capability
2. Historical Data
- Accurate political landscape of 1455 Europe
- Ottoman Empire, Holy Roman Empire
- Major kingdoms like France, England, Castile
- Italian city-states, German principalities
- Resource production and economic activities of the era
- Medieval craft processes
- Raw material gathering
- Trade goods and luxury items
3. Utility Functions
- Economic Calculations
- Market price formulas based on supply and demand
- Production output based on skill and tools
- Item quality and deterioration
- Transportation costs and trade profits
- Travel Mechanics
- Path finding between nodes
- Travel time calculation
- Weather effects on travel
4. Setup Scripts
create-map-nodes.ts- Creates basic map nodes and connectionsimport-kingdoms.ts- Imports historical political entitiessetup-medieval-world.ts- Full setup of the medieval world system
Database Schema
The system is built on a PostgreSQL database with the following key tables:
map_nodes- Locations in the worldnode_connections- Paths between locationsEmpire,Kingdom,Duchy,County- Political hierarchyResource,ProductionProcess- Economic resources and craftingMarket,MarketListing- Trading systemCharacter,CharacterSkill,Inventory- Player dataWeather,ActiveTravel- Environmental and travel systems
How to Use
Setting Up the Medieval World
- Run full setup with a single command:
npm run setup:medieval-world
This will:
- Apply database migrations
- Create map nodes and connections
- Import political entities
- Link map nodes to political control
- View the data in Prisma Studio:
npm run prisma:studio
Integration Points
The medieval world system integrates with other game systems:
- Map UI
- Display nodes and connections on a world map
- Show political boundaries and control
- Character System
- Characters can travel between nodes
- Characters can hold titles in the political hierarchy
- Characters can gather resources and craft items
- Economic System
- Each node has a local market with supply/demand
- Players can trade, produce, and transport goods
- Prices fluctuate based on market conditions
- Governance System
- Political control affects taxation and laws
- Players can gain titles and rule territories
- Political actions affect regions and populations
Future Enhancements
The medieval world system can be expanded with:
- More Historical Detail
- Additional regions and political entities
- Historical events and figures
- Cultural and religious differences
- Enhanced Economic Simulation
- More detailed production chains
- Regional economic specialties
- Seasonal variations in production
- Dynamic World Events
- Wars and conflicts
- Natural disasters
- Political upheavals
- Trade disruptions
- AI-Driven NPCs
- NPC merchants and traders
- NPC political figures
- Dynamic response to player actions
Technical Architecture
The system follows a layered architecture:
- Data Layer - Prisma models and database schema
- Service Layer - Functions for system operations
- API Layer - Endpoints for client interaction
- UI Layer - Map rendering and interaction components
This design allows for separation of concerns and maintainability as the system grows.
Conclusion
The FeudalSim Medieval World System provides a solid foundation for a historically accurate medieval simulation. It combines geographical, political, and economic systems into a cohesive whole, ready for integration with game mechanics and user interfaces. The system is designed to be both realistic and engaging, offering players a deep and immersive medieval experience.