Giter VIP home page Giter VIP logo

masendor's Introduction

Pygame Logo

alt text

Victores et Victos

Educational and historical battle simulation made with Pygame.

The development for this game is currently on hold. Minor updates and bugs fixed will still be done but expect no major progress for now. For any suggestions or bugs, feel free to report them in the Issues page.

Discord channel: github

For game update showcase video: github


Contribution to development

All helps, suggestions, and issue reports are appreciated.

If you would like to help the project, feel free to join discord for a chat, open issues, commit the codes and do pull requests, or send emails to [email protected].

Some non-specific suggestions and examples of helps, including but not limited to:

  • Programming: New features, improve current ones, code optimisation/improvement
  • Asset Creation: UI, troop, leader, effect art, sound effect, music
  • Historical stuffs: Battle information, writing, sources, correction, improvements
  • Quality Assurance: Code documentation, game balancing, bugs fix, feedbacks

Note: All the new and current untested development are done on "dev" branch. The main branch is for a somewhat stable version of the game.

The repository history was cleanup from update 0.7.1.9 for the preserved history see: https://github.com/remance/Masendor-backup


Index


How to run/compile

If you want to download the release version to test the game, go to Release tags and ** download** the zip file.

Run

To start testing the game run main.py via Python interpreter for the source code or main file directly for the release version.

System Requirements

MINIMUM:

OS: Windows 7 (Haven't tested on Windows XP or Vista but may work), Ubuntu and macOS need further testing

Memory: 2GB RAM

Processor: Need more testing

Graphics: Need more testing

Storage: Currently 200 MB but likely around 500 MB available space in finished version.

RECOMMEND:

OS: Windows 8, Ubuntu 22.04, macOS Monterey

Memory: 4GB RAM

Processor: Need more testing

Graphics: Need more testing

Storage: 1GB available space

Compile

To compile the source code into an executable program, recommend using pyinstaller and main.spec.

Check the requirements.txt file for dependency requirements if running with the python source code.
Also, the game is now optimised based on the pygame-ce 2.2.1 module and python 3.11. (may have to use cython later for a huge size battle)


Latest Update

alt text

Add new game art style and system that allow player to select available styles.


Key features so far

History is told by the victor, but sometimes the words of the loser do not fade away

14th October 1066 AD, Duke William of Normandy’s force arrived at Telham Hill early in the morning, while Harold Godwinson’s force was already positioned at Senlac Ridge. It is believed that Harold intent to ambush William's army at their camp and was surprised by William's arrival at Telham Hill.

14th October 1066 AD, King Harold Godwinson intercepted William the Bastard’s force at Senlac Ridge, Hastings. The rightful king of England refused to cover in a castle before the pretender and bravely marched his army to crush the enemy head-on.

Have you ever found it weird that most historical games follow only a specific version of the story? Even a single battle may have more than one side of the story.

For example, the Normans say they are the underdog in the Battle of Hastings, while the Saxons also say they are the underdog. Well in this game, all versions of the story are accepted and represented. Every preset historical map will have more than 1 source of information that dictates the story tone, army composition, size, even formation and possibly more.

Image showing information about the Battle of Hastings

Army is led by more than just a king

Troops in each army can be led by multiple leaders with chain of command and every historical battle will have all the named people that participated in the battle.

alt text

Extremely easy map creation

Map creator in most games requires a degree of learning to use effectively. In this game, you just need to use MS Paint or any drawing software (GIMP, Adobe Photoshop, etc.) to create a map.

Draw the image with the right colour set, and the game will convert them into a playable map. Most other map functions are also very easy to create and modify.

Video demonstration: https://www.youtube.com/watch?v=8Omm-o6Dy60

Encyclopedia and stuffs

This game's encyclopedia will have more information than just from the Wikipedia website as long as they can be found that is.

alt text

This function is going to be a headache to write and research. But hopefully, it will provide useful and interesting historical information to players.

Tools

Animation maker

Animation maker for the troop Vector-based animation in game. The tool is made with pygame and the code is compatible enough for other purposes with some modification.

alt text

Photo studio

Photo studio to make battle screen to your liking. Simply add subunit and effect data and the tool will render them.

alt text


Credit

Tool

Subunit sprite viewer by coppermouse (https://github.com/coppermouse)

Game Asset

Graphic Art:

  • Ryu Hill (Mystika Digital Media)

Sprite:

  • Prototype slash effect sprites by inogNate
  • Weapon sprite by jeet

Sound (Obtained and edited):

Translation

Ukrainian Translation:

  • JerryXd

Help with game coding and bugs fixed:


Future Plan

Ver 0.7 Future Visionary: custom unit and troop editor, march sound system, keybinding, loading screen, England Campaign

0.7 and 0.7.1: console stick, control key binding

0.7.2 and 0.7.3: Companion system

0.7.4 to 0.7.6: custom unit editor and march sound system

0.7.7: custom troop editor

0.7.8 and 0.7.9: specific Leader command, loading screen, Minor battle: 764 Irish abbey war

Ver 0.8 Authentic Attraction: In-game art, better-looking UI, add intro screen, Egypt Campaign

0.8 and 0.8.1: Rework ranged attack bullet system to include height calculation

0.8.2 and 0.8.3: Improve UI art

Ver 0.9 Gaze of New Life: AI and pathfinding (The most challenging step unless cut corner to the point of braindead AI), Ottoman Campaign, final code optimisation before full 1.0

Ver 1 Pax Paradisum: Release version, historical battle simulation game

Ver 1 - 1.5: More art, sound effects and in-game music (May need to use royalty-free music but will see) + Ingame Encyclopedia at main menu + more historical battles

Ver 1.1: Add dynamic terrain/feature change based on battle effect (damage) and weather

Ver 1.2: Urban map, Siege battle and siege equipment, Minor battle: Wolf of Paris

Ver 1.3: hidden stat, line of sight, raise flag/ light torch, ambush bonus

Ver 1.6: Commander mode, strategist and leader duel with dynamic result and event (Move from 0.2.7 as it is not the main priority in the early battle sample yet), transfer leader, Battle of Gaixia

Ver 1.7: Deception, False information, scout, espionage warfare, information, Minor battle: Siege of Orleans

Ver 1.8: Deployable Defence (Stakes, Barrier, Camp, Wagon), dynamic squad facing position and maybe "saved" formation that player can rotate in battle, swappable squad position

Ver 1.9:

Ver 2.0: Multiplayer battle

Ver 2.1: Begin working on another module setting

Unforeseeable future: forced march (Moved here from 0.2.7 as this feature won't have much used until the game map become much larger than just a single battlefield), Queue command


For those who have read this far, thank you for your interest in the game. To be honest, every single update begins with how do I even start with this.

I start developing this game with zero knowledge in video game development let alone how to use pygame. I start learning how to use pygame by tinkering with alien.py in the pygame examples folder and keep testing/changing it until it became what you can see right now (I keep most video updates on YouTube which show the progress of improvement almost from the start). All of the plans I list for the future are the same. I have no idea how to do it, the only thing I have is the picture of what I want to make it look like. Nevertheless, it is fun figuring stuff out and don't let the lack of knowledge stop you from making your own game :P.

masendor's People

Contributors

remance avatar twobob avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

masendor's Issues

Add default module system

Currently, the module reading function requires the selected module to have the same data structure as the default (historical) module. The game should have a function to selectively read the default module and then selectively replace data from the selected module if they existed.

For example, a fantasy module may have its own troop preset, but everything else is the same as the historical module. Then the game only needs to use troop preset from the fantasy module and use other data from the default module.

This should reduce data redundancy by a lot.

error

File "D:\Masendor-master\gamescript\gameunitstat.py", line 169, in init
for row in rd:
UnicodeDecodeError: 'gbk' codec can't decode byte 0x94 in position 47: illegal multibyte sequence

Issue

File "/Users/Emma/PycharmProjects/Madendor/Masendor-0.6.2.1/gamescript/gamelongscript.py", line 591, in csv_read
with open(main_dir + folderlist, encoding="utf-8", mode="r") as unitfile:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/Emma/PycharmProjects/Madendor/Masendor-0.6.2.1/gamescript/data/ruleset/historical/map//Users/Emma/PycharmProjects/Madendor/Masendor-0.6.2.1/gamescript/data/ruleset/historical/map/megiddo/info.csv'

Import Error

When I try and run the mainmenu.py script from the python IDLE, it throws an error saying:
Traceback (most recent call last):
File "C:\Users\legot\Documents\GitHub\Masendor\mainmenu.py", line 11, in
from RTS import maingame
ModuleNotFoundError: No module named 'RTS'

Am I running the game wrong, or is it an actual problem in the code?

playing through the browser

Can it be used in something in the cloud online for everyone?
like heroku provider which is partially free?

Then available through the browser

  • Implementation idea-

'Unsupported operand type(s)' Error

I'm trying to run the main.py script locally on my machine and I'm receiving this exception after running python3 main.py:
image

Python Version: 3.8.10
OS: Ubuntu (Mint Distro)

Mechanic Improvement

Feel free to posting improvement idea here. Also for when idea popup and I can't access the code.

  • Charge damage also use speed as factor.
  • Charge defense use troop size and maybe some sort of mass stat.
  • Increase shoot range if shooting downhill.

Map editor

Map editor tool to create new maps.

The first tool prototype can be a simple bitmap editor allowing the user to create the files required for a battle map:
base.png
feature.png
height.png
place_name.png

with the brush colours restricted to the RGB code matching each terrain type.

main.exe may not run for some computer

Seem like the main.exe generated with pyinstaller may not work for some people for an unknown reason. I am not certain what caused it or what can be fixed yet. From what I heard, the game may simply not open at all and only command prompt pop up for a second with no error messege.

issue in compiled binary

basically while loading game data you have to include the main_dir path to be able to run using the binary itself without downloading any game data with it as the game data is embedded in the binary BUT the data is stored in a temporary directory so configuration files should be made or accessed in the directory the user is running from on start of the binary wich is already happening

so whats wrong?

instead of just importing game data prepend the main_dir to the path of the data ur loading

Map editor issue

File "/Users/Emma/PycharmProjects/Madendor/Masendor-0.6.2.3 3/gamescript/gamelongscript.py", line 594, in csv_read
with open(main_dir + folderlist, encoding="utf-8", mode="r") as unitfile:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/Emma/PycharmProjects/Madendor/Masendor-0.6.2.3 3/data/ruleset/historical/map/custom//Users/Emma/PycharmProjects/Madendor/Masendor-0.6.2.3 3/data/ruleset/historical/map/custom/grassland/info.csv'

issue #2

File "/Users/Emma/PycharmProjects/Madendor/Masendor-0.6.2.3 3/gamescript/gamesubunit.py", line 1046, in update
self.melee_target = self.parentunit.attack_target.subunit_sprite[0]

Unit cluster and visibility is quite bad in a larger battle.

Based on the demo version, the unit sprite visibility is very bad especially in combat. When 2 army collides, it pretty much become almost impossible to distinguish enemy/allies troop.

Not quite sure how to fix it yet. But here are some potential solutions:

  1. Introduce unit collide check to prevent sprite merge (maybe for both enemy and friend). Tricky (and likely reduce game performance) but would help make combat better and more organised as well.
  2. Make enemy sprite always have higher layer. Not a good solution overall.
  3. Maybe instead of collision detection, make map array that allow only one unit per position.
  4. Reduce number of unit. Simple solution that also improve game performance. But should be a last resource.

Missing map presets?

I seem to be missing some historical map presets that are required before loading:

[Errno 2] No such file or directory: 'C:\\Users\\user\\Documents\\GitHub\\Masendor\\data\\module\\historical\\map\\preset\\norman\\varaville1\\0\\unit_pos.csv'
[Errno 2] No such file or directory: 'C:\\Users\\user\\Documents\\GitHub\\Masendor\\data\\module\\historical\\map\\preset\\norman\\mortemer\\0\\unit_pos.csv'
[Errno 2] No such file or directory: 'C:\\Users\\user\\Documents\\GitHub\\Masendor\\data\\module\\historical\\map\\preset\\norman\\dinan\\0\\unit_pos.csv'
[Errno 2] No such file or directory: 'C:\\Users\\user\\Documents\\GitHub\\Masendor\\data\\module\\historical\\map\\preset\\norman\\varaville2\\0\\unit_pos.csv'
[Errno 2] No such file or directory: 'C:\\Users\\user\\Documents\\GitHub\\Masendor\\data\\module\\historical\\map\\preset\\norman\\fulford\\0\\unit_pos.csv'
[Errno 2] No such file or directory: 'C:\\Users\\user\\Documents\\GitHub\\Masendor\\data\\module\\historical\\map\\preset\\norman\\stamford\\0\\unit_pos.csv'
[Errno 2] No such file or directory: 'C:\\Users\\user\\Documents\\GitHub\\Masendor\\data\\module\\historical\\map\\preset\\ottoman\\mohacs\\0\\unit_pos.csv'
[Errno 2] No such file or directory: 'C:\\Users\\user\\Documents\\GitHub\\Masendor\\data\\module\\historical\\map\\preset\\ottoman\\mohacs\\0\\eventlog.csv'

issue in rendering

in ur game a scene is being rendered above the other scene wich may be annoying i think we can fix this easily ill see if i can fix it if someone is already fixing it please comment so we dont have any conflicts in the code

eRROR

!! Traceback (most recent call last):
!! File "/Users/Emma/PycharmProjects/Madendor/Masendor-0.6.3.5 2/main.py", line 12, in
runmenu = game.Game(main_dir, error_log)
!! File "/Users/Emma/PycharmProjects/Madendor/Masendor-0.6.3.5 2/gamescript/game.py", line 218, in init
os.makedirs("/profile")
!! File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/os.py", line 221, in makedirs
mkdir(name, mode)
!! OSError: [Errno 30] Read-only file system: '/profile'

Question?

why does this happen in the run:
[Errno 2] No such file or directory: '/Users/Emma/Documents/GitHub/HamsterBattleGame/data/map/weather/matter/Wet Fog'
[Errno 2] No such file or directory: '/Users/Emma/Documents/GitHub/HamsterBattleGame/data/map/weather/matter/Sandstorm'
[Errno 2] No such file or directory: '/Users/Emma/Documents/GitHub/HamsterBattleGame/data/map/weather/effect/Sandstorm'
[Errno 2] No such file or directory: '/Users/Emma/Documents/GitHub/HamsterBattleGame/data/map/weather/matter/Wet Fog'
[Errno 2] No such file or directory: '/Users/Emma/Documents/GitHub/HamsterBattleGame/data/map/weather/matter/Sandstorm'
[Errno 2] No such file or directory: '/Users/Emma/Documents/GitHub/HamsterBattleGame/data/map/weather/effect/Sandstorm'

Using a game engine

Hello! I saw your game on the Pygame website and it caught my eye - the concept is great and I'm impressed by your progress already! I've made my fair share of games in Pygame and I'm aware of how bare-bone it is - as you may know, it isn't really a game engine. Due to a lack of spare time I've moved on from dabbling in gamedev, but since, I've come to realise that using a "proper" game engine is almost critical if you want your game to scale - writing your own game engine (which you practically must do when using Pygame) is really not a good idea, unless you are really experienced.

I'm not trying to put you off, but in my humble opinion I think using a game engine will get your game a lot further, far quicker, especially when it comes tasks like making the terrain, etc. (your note about it being difficult and long is very accurate!). My personal choice would be Godot for many reasons, amongst others that it is open source, has a very active and productive community (https://www.reddit.com/r/godot/top/?t=all) and has most of the features of professional game engines. It's native scripting language is not Python, but I believe there are addons which allow you to script it using Python. There are also plugins, demos and tutorials for (procedural) terrain generation. Some examples of plugins are https://github.com/Zylann/godot_heightmap_plugin and https://github.com/SirRamEsq/SmartShape2D)

Whatever you decide (and I'm aware the decision will not be a simple one - one that even I would find difficult due to how much I enjoy working with Pygame despite the challenges), I wish you all the best with your project, and I can't wait to see how it turns out!

font declaration error

You seem to have called 'Font' incorrectly:

File "C:\Users\user\Documents\Masendor\Masendor-0.7.3.1\engine\game\loading_screen.py", line 12, in loading_screen
    font = pygame.Font(self.ui_font["main_button"], int(60 * self.screen_scale[1]))
AttributeError: module 'pygame' has no attribute 'Font'

(full traceback not included)

EDIT: this is how I would normally do it:

font = pygame.font.Font(fontFile, fontSize)

doesn't crash with:

font = pygame.font.Font(self.ui_font["main_button"], int(60 * self.screen_scale[1]))

Change the term map "source" to something more specific

The term "source" for battle map historical source is mostly used in code and guides currently. But the word meaning is a bit too closely related to programming terms. It would be better to have a term that is more unique to historical aspects or events.

One possible term that may be more suitable is "scenario".

error

Ruleset: Historical, Mode: arcade
Map: Testmap, Source: Modern Historians, Character: 1
!! Traceback (most recent call last):
!! File "/Users/Emma/Documents/GitHub/AnchientBattleSimulator/main.py", line 12, in
game.Game(main_dir, error_log)
!! File "/Users/Emma/Documents/GitHub/AnchientBattleSimulator/gamescript/game.py", line 739, in init
self.run()
!! File "/Users/Emma/Documents/GitHub/AnchientBattleSimulator/gamescript/game.py", line 1150, in run
self.menu_char_select(mouse_left_up, mouse_left_down, mouse_scroll_up,
!! File "/Users/Emma/Documents/GitHub/AnchientBattleSimulator/gamescript/common/game/menu_char_select.py", line 26, in menu_char_select
self.start_battle(self.char_selected)
!! File "/Users/Emma/Documents/GitHub/AnchientBattleSimulator/gamescript/common/game/start_battle.py", line 9, in start_battle
self.battle_game.prepare_new_game(self.ruleset, self.ruleset_folder, self.team_selected,
!! File "/Users/Emma/Documents/GitHub/AnchientBattleSimulator/gamescript/battle.py", line 534, in prepare_new_game
self.subunit_animation_pool = self.main.create_sprite_pool(direction_list, self.main.troop_sprite_size,
!! File "/Users/Emma/Documents/GitHub/AnchientBattleSimulator/gamescript/common/game/create_sprite_pool.py", line 13, in create_sprite_pool
weapon_common_type_list = tuple(set(["" + value["Common"] + "" for key, value in weapon_list.items() if
!! File "/Users/Emma/Documents/GitHub/AnchientBattleSimulator/gamescript/common/game/create_sprite_pool.py", line 13, in
weapon_common_type_list = tuple(set(["" + value["Common"] + "" for key, value in weapon_list.items() if
!! TypeError: can only concatenate str (not "int") to str

rotationxy() takes 3 positional arguments but 4 were given

Hi,

Game looks Very interesting - wanted to see how it plays but I got an error while running it.

I got the zip file, unzipped, the install the requirements.txt
ran the game with : python main.py
however when I choose a battle and side - before starting the battle I got the following error:

python main.py
pygame 2.0.2 (SDL 2.0.16, Python 3.8.9)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "main.py", line 12, in
runmenu.run()
File "E:\dev\ai\Masendor-master\gamescript\start.py", line 1134, in run
self.battlegame.preparenewgame(self.ruleset, self.ruleset_folder, self.teamselected, self.enactment,
File "E:\dev\ai\Masendor-master\gamescript\tactical\battle.py", line 387, in preparenewgame
longscript.unitsetup(self)
File "E:\dev\ai\Masendor-master\gamescript\tactical\longscript.py", line 298, in unitsetup
subunitgameid = generate_unit(gamebattle, whicharmy, row, control, command, colour, coa, subunitgameid)
File "E:\dev\ai\Masendor-master\gamescript\tactical\longscript.py", line 235, in generate_unit
this_unit = add_unit(np.array([row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8]]), (row[9][0], row[9][1]), row[0],
File "E:\dev\ai\Masendor-master\gamescript\tactical\longscript.py", line 221, in add_unit
unit = unit.Unit(position, gameid, subunitlist, colour, control, coa, command, abs(360 - startangle), starthp, startstamina, team)
File "E:\dev\ai\Masendor-master\gamescript\tactical\unit.py", line 186, in init
self.front_pos = self.rotationxy(self.base_pos, frontpos, self.radians_angle)
TypeError: rotationxy() takes 3 positional arguments but 4 were given

No module name 'PIL'

When executing the main.py, it outputs: "ModuleNotFoundError: No module named 'PIL'"

End of game error

After destroying all of one team the following error occurs:
Traceback (most recent call last):
File "C:\Users\legot\Documents\GitHub\remanceMasendor\main.py", line 403, in
runmenu.run(maingame)
File "C:\Users\legot\Documents\GitHub\remanceMasendor\main.py", line 347, in run
self.battlegame.rungame()
File "C:\Users\legot\Documents\GitHub\remanceMasendor\gamescript\maingame.py", line 1058, in rungame
self.battalionupdater.update(self.currentweather, self.squad, self.dt, self.camerascale,
File "C:\Users\legot\AppData\Local\Programs\Python\Python38\lib\site-packages\pygame\sprite.py", line 463, in update
s.update(*args)
File "C:\Users\legot\Documents\GitHub\remanceMasendor\gamescript\gamebattalion.py", line 693, in update
getrandom = random.randint(0, len(retreatside) - 1)
File "C:\Users\legot\AppData\Local\Programs\Python\Python38\lib\random.py", line 248, in randint
return self.randrange(a, b+1)
File "C:\Users\legot\AppData\Local\Programs\Python\Python38\lib\random.py", line 226, in randrange
raise ValueError("empty range for randrange() (%d, %d, %d)" % (istart, istop, width))
ValueError: empty range for randrange() (0, 0, 0)

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.