Giter Site home page Giter Site logo

pymerchant's Introduction

pymerchant - working title

Hanseatic league merchant trading game, written in Python, inspired by old school games like Vermeer, Patrician, 1860, and Port Royale

Requirements

Python 3.11 Packages: Rich

This project was built in part with a third party library Rich. "Rich is a Python library for rich text and beautiful formatting in the terminal."

See the documentation here and review the repo here: Repository: https://github.com/Textualize/rich Documentation: https://rich.readthedocs.io/en/stable/index.html

Rich supports both windows and mac/unix systems and supports the classic windows CMD prompt but it has feature support for the new Windows Terminal and it is recommended for better support.

Install

To get the pepare your system to run Pymerchant, using PyPi or your preferred package manager in your terminal or shell enviroment run the command:

'pip install Rich'

To run the game itself, in your preferred terminal enviroment, run the pymerchant.py app by calling

python pymerchant.py

Background

As of July 2023, The game is still in active development and I am currently working on a feature roadmap. It is the product of a summer semester COSC1336 Intro to Fundamentals of Computer Programming course at Austin Community College. I have spent roughly 40 days thinking about, designing, and developing the game to where it is today. In retrospect, I would approach it a little more differently than I did when I started as I went through multiple refactors and design changes.

Toward the end I purchased "Design Patterns: Elements of Reusable Object Oriented Software" by the Gang of Four "Refactoring: Improving the Design of Existing Code Second Edition" in a fleeting attempt to try to decouple classes and functions and increase cohension but at a loss to pace of development. I tried to strike a balance in delivering a MVP with the knowledge I had and at the same time still think through the problems that I had created for myself in my approach.

In the end, I've learned more in this project about Python and software design than I have in any other setting and intend to continue working on the project, albeit with a pause now to really refactor and change my design and approach. There were many problems that took multiple days of intense focus and thinking. In the last weeks, I have found myself able to almost effortlessly see a problem and immediately can envision a solution to and begin building immediately. I'm hoping with some more reading and programming that this will come even more naturally than it is now.

One thing of note is that commenting and documentation that is missing from functions are from the latest work where pressed for time I am submitting without and will document and reformat later at a github repo yet to be released.

Gameplay

You are merchant of the Hanse, in the 12th century in Northern Europe. You travel with your cog across the seas from one hanseatic city to another trading goods that were historically traded in these times. You start in the city of Lubeck, the capital city of the Hanseatic league. With 1000 gold (historically denarius) you set out to buy low and sell high traveling from city to city.

Currently the game features a command-line interface and has some features such as a in-game clock that advances with time, table representation inventory management, hand routed distances in nautical miles between cities, active loading bars that run in command line and dynamic per item pricing in each city.

Roadmap

Currently the game has been designed from outset to describe advanced and dynamic pricing models for trade goods using regions, cities, distances, and market events that affect supply and demand! Goods are inputs to other goods as well and as such, their pricing will affect and build up the prices of those composite goods. In addition to the market event shocks that describe real world supply and demand shocks, there is in place a framework to describe travel modifiers that will slow or prevent your ships from traveling to certain cities when ports are frozen over, or a blockade occurs and the consequences of pirate activity on the seas.

In addition, because of the date time system that is currently implemented, market events, which will be displayed to the user through interactions with towns people, can be created, dispatched, and set for destruction or add different effects on a time scale that the user can take advantage of.

Closing

In the end this is as much of a labor of love born out of my love of old economic trading games and my background in Finance as it is a learning opportunity. In the time that I have been studying programming in the last few years, nothing comes close to this project in helping develop my understanding and improving my fluency in reading and interpretting code.

Contribute

If you have comments or would like to contribute to this project please email me at [email protected]

License

MIT License

Copyright (c) 2023 Michael Golden

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

pymerchant's People

Contributors

michaelagolden avatar

Stargazers

 avatar

Watchers

 avatar

pymerchant's Issues

Inventory and Stats Module

Player inventory is very basic as of now. Need to build a robust system for managing players inventory that allows for tracking of stats and cost basis for items as you buy and sell goods. Once we have figured out how we would track the items costs accurately, stats for the player will not be difficult to implement.

Add Save Game Function

Good feature to record game state and have the ability to reload to that state. Something planed in the future

Create Update loop

Currently there is no good way of tracking gameplay and the date or time.

World Update mechanism will act update every 'tick' of the game engine. Any updates that are to take place that are not the direct result of a player interaction, will be handled here.

  1. Inventory and Pricing Mechanisms - will update all cities pricing and inventory every turn
  2. Global clock, stats tracking and logging when not directly caused by player
  3. Pricing hints - sets pricing hints, will set hints and take action when the pricing or inventory effect takes place

Create Trade Module - (currently only market and game exist)

Need to build out a proper trade module, problem is right now we have the game module working as both the view controller and the trade logic.

Interactions between player and markets need to be moved to own module which includes:

Includes

  • Buying Goods
  • Selling Goods
  • Updating Qty for Market
  • Building trade logs

Does not include

  • printing statements, formatting any outputs

Build Trade Module

Trade Module is needed and is the most important aspect of the game. It hinges on a trade goods list, and functioning markets and cities.

The trade module needs to handle user buy/sell actions, adding/removing inventory and gold from user during purchases, and removing gold from city at same time.

Trade cycle should update economy at end of each day in theory, but for now we just need something working that the player can interact with.

Build View Model

Current view model is entangled with the game update loop. Once these are disentangled, focus will need to be on a good view and update model.

Assign city trade goods

Not all towns will have the same type of markets. Individual markets will differ, as will their pricing models because of this. Each town will need to draw from some arbitrary number of possible market types. Likely 10-15 different market types to be defined.

To start, I just need a list of goods that can be bought at a market;

NOTE: all items can be sold at markets, but not all will be available for purchase.

Create Travel Module

Traveling is currently handled via a game loop with a menu interaction, need to refactor into module to support newly set clustering of city distances.

Since travel is now available from every city directly to every other city and the distances matter, we need a way to calculate time to travel based on number of factors such as player inventory, ship upgrades, and some degree of chance.

Brainstorm City Interactions

Once city tiers have been established, additional city behavior needs to be added

This could be in the form of trade negotiations with local businessmen; increasing production via subsidy, encouraging infrastructure growth, upgrading buildings or investing in improvements etc.

I imagine buildings like tavern, church, town hall, etc that you can interact with to influence or have interactions with town

I also imagine that given a market type, any building that is called for or manufactures something, would be accessible for upgrades to the building, thereby influencing the demand or supply of a good.

Add Market News Functionality

Market news causes shifts in supply demand curves across the regions, these news updates will automatically propagate to towns and users where supply/demand would reflect in pricing

Define Trade Goods

I need a list of all of the goods available for trade in the game. This is key to determine initially the theme of the game.

Total list of available goods should be at least 20, no more than 30

Create City Tier definitions

Each city needs to have a level from 1-5, which will define the level of supply or demand for a given good as defined by their market type

Tier 1's will be lowest tier, like deserted towns and impoverished communities with no workable land or means
Tier 5's would be the equivalent of major metropolitan cities like a new york or london, High pops filled with supply and demand

Refactor

As I've learned more about python and better ways to approach problem, I realize that I need to change some of my approach. Therefore, I've set out to rebuild the the classes in one file for the time being and work with something that is more "object oriented" or data structured I suppose.

My critique before was that my classes and methods had poor cohesion and had a high degree of coupling. In this refactor I am looking to rethink the approach I originally took and focus designing the structure of the program at the start so that the project takes less time to complete.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.