Code Monkey home page Code Monkey logo

rpg_tactical_fantasy_game's Introduction

RPG Tactical Fantasy Game

made-with-python licence latest release GitHub release (latest by date)

[ English | 简体中文 | 繁體中文 ]

Open to collaborative development.

The game is a Tactical Fantasy RPG, turn-based and in 2D.

How to help development

You can submit any request you want, or report any bug you encounter, by sending an e-mail to [email protected] or by opening an issue.

Alternatively, you can join the newly created community discord: https://discord.gg/CwFdXNs9Wt.

Feel free to come up with ideas whether it is about coding practices or game mechanics, this project is far from being perfect!

Here are some suggestions of contributions:

  • Check the opened issues, there are bugs that could be fixed or enhancement waiting for implementation.
  • A lot of TODOs can be found everywhere on the project, some of them could be easy to fix even by a beginner and others are more challenging.
  • Help with balancing would be greatly appreciated... I'm not good in this kind of games even if I love them. All values could be found in the XML files wrapped in the data folder.
  • Contributions for sound effects or new soundtracks would be really appreciated.

Version : 1.0.4

Main screen with possible moves and attack Inventory menu Status window

How to start the game

If you are using 64-bit Windows you can head over to the releases page to get a prebuilt executable.

If you would rather run directly from the source (or want to develop the game), make sure to have Python3.9 (or above) installed and run python -m pip install -r requirements in the repository folder.

Then you can run python main.py or "./main.py" (only for Python 3) in linux operation system to start the game.

Keys

  • Left click : Select a player, choose a case to move, select an action to do etc (main button)
  • Left click (on any empty tile) : Open or close main menu
  • Left click (on any entity that is not a player who has finished his turn) : Open a window giving information about the entity
  • Right click : Deselect a player or cancel last action if possible (secondary button)
  • Right click (on any entity) : Show the possible movements of the entity
  • Esc key : Close a menu on the top layer

rpg_tactical_fantasy_game's People

Contributors

badarothiago avatar beibarys98 avatar benmrtnz27 avatar brenekh avatar grimmys avatar hadizamani021 avatar ildarryabkov avatar jaskrendix avatar jimzhouzzy avatar kakaa2993 avatar rambonation avatar rogerm4242 avatar sethstenzel avatar silent-lindsay avatar simonmaracine avatar sonny-cao avatar starbuck5 avatar talljosh 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rpg_tactical_fantasy_game's Issues

Left click outside of a menu to leave it if possible

Currently, the only way to exit a menu is to do a right click.
As pointed out by #24, it should be possible to do a left click outside of a menu to leave it if it's not a "blocking" menu.

Escape could also be a shortcut to leave a menu.

save game : TypeError: 'LevelEntityCollections' object is not subscriptable

In my opnion in file save_state_manager.py shold be:
self.save_collection("foes", "foe", self.level.entities.foes)
not
self.save_collection("foes", "foe", self.level.entities["foes"])
########################################################################################
TypeError: 'LevelEntityCollections' object is not subscriptable

pygame 2.0.3 (SDL 2.0.16, Python 3.9.7)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "/home/arek/helena/rpg_tactical_fantasy_game/main.py", line 95, in
main_loop(scene_manager, main_screen, pygame.time.Clock())
File "/home/arek/helena/rpg_tactical_fantasy_game/main.py", line 33, in main_loop
quit_game = game_controller.process_game_iteration()
File "/home/arek/helena/rpg_tactical_fantasy_game/src/services/scene_manager.py", line 48, in process_game_iteration
quit_game = self.active_scene.click(event.button, event.pos)
File "/home/arek/helena/rpg_tactical_fantasy_game/src/scenes/level_scene.py", line 2162, in click
self.left_click(position)
File "/home/arek/helena/rpg_tactical_fantasy_game/src/scenes/level_scene.py", line 1982, in left_click
self.menu_manager.click(1, position)
File "/home/arek/helena/rpg_tactical_fantasy_game/virtual/lib/python3.9/site-packages/pygamepopup/menu_manager.py", line 156, in click
self.active_menu.click(position)()
File "/home/arek/helena/rpg_tactical_fantasy_game/src/services/menu_creator_manager.py", line 1380, in
callback=lambda slot_id=i: save_game_function(slot_id),
File "/home/arek/helena/rpg_tactical_fantasy_game/src/scenes/level_scene.py", line 374, in save_game
save_state_manager.save_game(slot_id)
File "/home/arek/helena/rpg_tactical_fantasy_game/src/services/save_state_manager.py", line 20, in save_game
level = self.save_level()
File "/home/arek/helena/rpg_tactical_fantasy_game/src/services/save_state_manager.py", line 49, in save_level
entities = self.save_entities()
File "/home/arek/helena/rpg_tactical_fantasy_game/src/services/save_state_manager.py", line 65, in save_entities
self.save_collection("foes", "foe", self.level.entities["foes"])
TypeError: 'LevelEntityCollections' object is not subscriptable

some inconsistencies, in my amateur understanding of turn-based games

1 - talking
-> did not move -> talk -> turn is finished [can't move, can't attack, can't open menu's but i think you should be able to] (trying to fix this)
-> move -> talk -> turn is finished [can't attack, can't open menu's but i think you should be able to] (trying to fix this)

2 - trading
-> trade -> move [can attack, can open menu's] (makes sense)
-> move -> trade [can attack , can open menu's] (makes sense)
-> move -> trade -> cancel -> return [don't stay where you moved but i think you should be able to] (trying to fix this)

3 - potion
-> move -> drink [can attack, can open menu's] (makes sense)
-> did not move -> drink [can't move but i think you should be able to] (trying to fix this)

  • similar inconsistencies in attacking, visiting a house, visiting a shop, opening a chest, perhaps more (drinking from fountain?)

4 - suggestion

  • this is my vision for this game, hope you agree:

  • things you can do in a turn at most ONCE:

    • move
    • attack
    • wait (finishes the turn) (i would suggest "finish")
  • all the other things can be done repeatedly and at any time, here is the combination table:
    [insert action] move [insert action] attack [insert action] finish

Add a notion of "tile type"

A notion of "tile type" could be implemented to add new gameplay mechanics to the game.

As in games like Fire Emblem or Advance Wars, we can imagine tiles that will cost more points of movement to pass by, tiles that will increase specific stats of the entity on it or even tiles that will inflict an alteration to the entity staying on it.

Accessibility. Game is not accessible for blind players

Hello,
First, thank you for this project, it can be a good base and reference for me to use in case of learning about audio game development.
But there is an issue:
I am a blind player and this game is not accessible for me as for screen reader user.
You can use the following library to provide accessibility for screen readers and keyboard access:
accessible_output2
Thank you!

Display default message when diary is empty

There is a Diary in the game, accessible through the main menu of a level, listing the history of recent events (currently logging only fights afaik).

Example of Diary:

Diary with content

But of course at the beginning, this journal is going to be empty.
And currently, this is not rendered really nicely:

Empty Diary

I think a message should be displayed stating that the Diary is empty, instead of blank space which could let think it's buggy.

Current behaviour: Display empty body content for diary when there is no registered event
Expected behaviour: Display default message such as "No event has been recorded yet" when there is no registered event
Bonus: Add translation for other supported languages

Unintuitive Elements

Unintuitive to Players

  • You have to open the menu to start.
  • You cannot auto-move to an enemy by clicking on them.
  • You cannot attack an adjacent enemy by clicking on them.
  • You cannot left-click out of a menu
  • There is no help menu in case you forget the commands
  • Escape does not exit a menu
  • Once you've used a potion from the inventory, you must wait - but the game does not auto-wait you.
  • The game does not autosave after a level complete.

Unintuitive in the Codebase (to me, anyway)

  • What's your code style?
    • Why do you use from x import * when you could use from x import y, z
    • Why do you use auto() for enums?
    • Why do you not use type hints?
    • Why raise SystemExit instead of sys.exit()
  • Why are src.gui.constantSprites and src.gui.fonts built using an initialisation function rather than being a dict literal?
  • Why is show_fps in main.py a function?

None of these (especially those under code style) are intended to be offensive - I'm simply curious.

Add effects for permanent stat increase

Currently, only effects giving temporary stat increase as an alteration are present (such as speed_up, strength_up or defense_up).
Nothing for increasing the stats in a more "definitive" way.

It would be nice to add these kind of effects, and why not a few items making use of them.
These effects should not result in the creation of an Alteration (since it would not be temporary), but should rather directly modify the stats of the targeted entities.

Place to add implementation of the effects is effect.py.
Place for defining displayed names is in text.py (effects sub-dictionary in TRANSLATIONS).

No need to bother about translations to other languages than English right now, checking if the game is not crashing when using another language should be sufficient.

Move->Trade->Cancel->Move Again

It is possible to move a character to a position next to an ally, initiate a trade, trade itens/money, cancel menu and that character is returned to his initial position, but the trade is already done and he can move again. I suggest that after trades, the player loses the ability to cancel the menu until character has attacked or choose to wait.

Game crashes when visiting the blue house

The game crashes when visiting the blue house at the top of the map. Error message is included below

Traceback (most recent call last):
File "main.py", line 49, in
quit_game = start_screen.click(e.button, e.pos)
File "C:\Users\Aaron\Downloads\rpg_tactical_fantasy_game-master\rpg_tactical_fantasy_game-master\src\StartScreen.py", line 282, in click
self.level.click(button, pos)
File "C:\Users\Aaron\Downloads\rpg_tactical_fantasy_game-master\rpg_tactical_fantasy_game-master\src\Level.py", line 1190, in click
self.left_click(pos)
File "C:\Users\Aaron\Downloads\rpg_tactical_fantasy_game-master\rpg_tactical_fantasy_game-master\src\Level.py", line 1123, in left_click
self.interact(self.selected_player, ent, interact)
File "C:\Users\Aaron\Downloads\rpg_tactical_fantasy_game-master\rpg_tactical_fantasy_game-master\src\Level.py", line 509, in interact
entries = target.interact(actor)
File "C:\Users\Aaron\Downloads\rpg_tactical_fantasy_game-master\rpg_tactical_fantasy_game-master\src\Building.py", line 20, in interact
for talk in self.interaction['talks']:
KeyError: 'talks'

Autosave at the end of a level

As pointed out by #24, end a level does not automatically save the game.

Maybe a menu inviting people to save at the end of a level could be added.

Suggestion: Environment requirements add "python3.9 and above"

Due to the syntax change of Python3.9, the following error will occur when running the source code in Python3.8 and below

pygame 2.5.0 (SDL 2.28.0, Python 3.8.0)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "main.py", line 13, in <module>
    from src.gui.tools import show_fps
  File "D:\Py\RPG\rpg_tactical_fantasy_game-master\rpg_tactical_fantasy_game-master\src\gui\tools.py", line 12, in <module>
    from src.gui.position import Position
  File "D:\Py\RPG\rpg_tactical_fantasy_game-master\rpg_tactical_fantasy_game-master\src\gui\position.py", line 9, in <module>
    Position = Union[pygame.Vector2, tuple[int, int]]
TypeError: 'type' object is not subscriptable

This small error puzzled me for a little while. So I suggest writting this environment requirement into README.md.
Thank you for reading. : )

TypeError when attempting to talk to Doran in level 2

After killing a bunch of enemies, I ran Chrisemon up to Doran and selected "talk". The program crashed with the following traceback.

I'm using Python 3.8.2, running on Ubuntu 20.04.

Traceback (most recent call last):
  File "main.py", line 53, in <module>
    quit_game = start_screen.click(e.button, e.pos)
  File "/home/josh/Downloads/games/rpg_tactical_fantasy_game/src/StartScreen.py", line 286, in click
    self.level.click(button, pos)
  File "/home/josh/Downloads/games/rpg_tactical_fantasy_game/src/Level.py", line 1370, in click
    self.left_click(pos)
  File "/home/josh/Downloads/games/rpg_tactical_fantasy_game/src/Level.py", line 1296, in left_click
    self.interact(self.selected_player, ent, interact)
  File "/home/josh/Downloads/games/rpg_tactical_fantasy_game/src/Level.py", line 582, in interact
    self.ally_to_player(target)
  File "/home/josh/Downloads/games/rpg_tactical_fantasy_game/src/Level.py", line 478, in ally_to_player
    player = Player(character.name, character.sprite, character.hp, character.defense, character.res,
  File "/home/josh/Downloads/games/rpg_tactical_fantasy_game/src/Player.py", line 21, in __init__
    Character.__init__(self, name, (), sprite, hp, defense, res, strength, None,
  File "/home/josh/Downloads/games/rpg_tactical_fantasy_game/src/Character.py", line 22, in __init__
    Character.races_data[race]['move'] + Character.classes_data[classes[0]]['move'],
TypeError: unhashable type: 'list'

Errors in use of typing module

There seem to be many places where I cannot run the code because of improper use of the typing module.

For example:
(position.py)
instead of:

from typing import Union

import pygame

Position = Union[pygame.Vector2, tuple[int, int]]

where I get the error: type object is not subscriptable

i need to change it to:

from typing import Union
from typing import Tuple

import pygame

Position = Union[pygame.Vector2, Tuple[int, int]]

this is just one example...
am I missing something?

want to change "fight summary" menu

each time enemy attacks you get a menu and have to press "close" each time.
want to change this.
make it an optional feature for those who are interested in specific stats.
i want to add a button to the player menu.
after each enemy turn, you can go to player menu and press "diary" button, or "battle log" button.
where you can see each blow, each hp loss, etc.
i want its menu to look like a book.
similar to minecraft book and quill, or morrowind mission log.

Question about the Choice of XML for Configuration Files

Hello,

I'm a beginner in Python programming and I've been learning a lot from studying your game project. I noticed that the game configurations are stored in XML format. As a newcomer to the field, I am curious to know if there was any particular reason for opting for XML instead of JSON. From what I've gathered, JSON seems to be a more lightweight and popular choice for data storage nowadays.

I'm eager to understand more about the technical choices made in this project and would appreciate any insights you could provide.

Thank you!

Equip an item blocks the game

Very recent issue I guess.

Equip an item resolve on blocking player actions.

Item menu is not automatically closed as it should be after an action done on the item.

Game Crash When Loading Level3

Crash after level loading scene.

pygame 2.5.0 (SDL 2.28.0, Python 3.10.11)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "D:\Py\RPG\repo\origin-master\rpg_tactical_fantasy_game\main.py", line 95, in <module>
    main_loop(scene_manager, main_screen, pygame.time.Clock())
  File "D:\Py\RPG\repo\origin-master\rpg_tactical_fantasy_game\main.py", line 33, in main_loop
    quit_game = game_controller.process_game_iteration()
  File "D:\Py\RPG\repo\origin-master\rpg_tactical_fantasy_game\src\services\scene_manager.py", line 52, in process_game_iteration
    if self.active_scene.update_state():
  File "D:\Py\RPG\repo\origin-master\rpg_tactical_fantasy_game\src\scenes\level_loading_scene.py", line 120, in update_state
    self.level.load_level_content()
  File "D:\Py\RPG\repo\origin-master\rpg_tactical_fantasy_game\src\scenes\level_scene.py", line 327, in load_level_content
    self.missions, self.main_mission = tmx_loader.load_missions(
  File "D:\Py\RPG\repo\origin-master\rpg_tactical_fantasy_game\src\services\load_from_tmx_manager.py", line 136, in load_missions
    main_mission = _load_mission(tmx_data, True, "main", players)
  File "D:\Py\RPG\repo\origin-master\rpg_tactical_fantasy_game\src\services\load_from_tmx_manager.py", line 104, in _load_mission
    targets = foes_by_mission.pop(mission_id)
KeyError: 'main'

It seems dict foes_by_mission is not loaded properly. It's an empty dictionary.

New release?

Three years passed. I think it's a good idea to publish a new release version.

added walking sound effect

but there is a probem. sound is a bit distorted. but when i play it with player it is ok. something to do with python or pygame? i am pulling a request right now so you can check it out.

Add a dialog when entering in a shop

Currently it's like if nobody was managing the shop: no character is speaking to you.

It may be cool to have a " welcome message " when entering in a shop, or even reactions to our shopping.

AttributeError during enemy turn

During level 2, when the enemy was attacking and possibly killing one of my characters, I got this traceback:

Traceback (most recent call last):
  File "main.py", line 57, in <module>
    start_screen.update_state()
  File "/home/josh/Downloads/games/rpg_tactical_fantasy_game/src/StartScreen.py", line 112, in update_state
    status = self.level.update_state()
  File "/home/josh/Downloads/games/rpg_tactical_fantasy_game/src/Level.py", line 286, in update_state
    self.entity_action(ent, (self.side_turn is EntityTurn.ALLIES))
  File "/home/josh/Downloads/games/rpg_tactical_fantasy_game/src/Level.py", line 707, in entity_action
    self.duel(ent, ent_attacked, allies, targets, ent.attack_kind)
  File "/home/josh/Downloads/games/rpg_tactical_fantasy_game/src/Level.py", line 642, in duel
    xp += target.xp_gain
AttributeError: 'Player' object has no attribute 'xp_gain'

Support for multiple languages

Hi, I would like to suggest adding support for multiple languages in the game.

Currently it seems the game only supports English. It would be great if we could translate the game text and dialogues into other languages like Chinese, French, Spanish etc.

This will help bring the game to more players around the world and make it more accessible.

Some suggestions on how to implement:

  • Use gettext to mark translatable strings
  • Create language resource files for each supported language
  • Allow player to select language at start of game
  • Load correct resource file based on language selection

Please consider adding multi-language support in future versions. Let me know if any help needed with the implementation.

Thanks!

what next?

you have asked for sound effects and i did that bcz of it. game does not seem to have many bugs. may be one or two. but what is next? should we add more levels? story? maps? what can we add to make the game that you want?

Over-indentation

The Level class' methods are over-indented. This is very unusual and probably
just a mistake. Sorry if the over-indentation was actually on purpose and not a mistake.

Show in UI that given foe is related to a mission objective

Currently, nothing is telling the player which enemies are required to be killed for the level to be finish.

For example, in level 3 (Lost City), the main mission is to kill the Mutanter, but nothing is directly indicating who is the Mutanter, and that it is the mission target.

Something could probably be added in one (or both) of these places:

mutanter_preview
Preview of the Foe when hovering it

image
Details about the Foe when clicking on it

The property to look for is Foe.target_of_mission, its value is whether None or the id of the related mission.

Define limited stock of money for shops

Currently, Shops have infinite amount of money: you can sell them whatever amount of items you want and still get money from it.

My idea would be to define a limited amount of money for Shops, same as what is already the case for the players.

The amount of money owned by the seller should be display in the "Sell" view (and maybe in the "Buy" view as well?).

Selling items to the seller would decrease the money left according to the sell value of the item, and buying items from the seller should increase the money left.
If the seller does not have enough money for buying the item, then something should be happening between:

  1. Forbid the sell (inform the player that seller cannot buy the item)
  2. Allow the sell but only give to the player what the seller had left (0 if the seller already had no money anymore), and maybe ask confirmation to the player that the sell would be "at loss"

I don't have any strong opinion about which behaviour is the best.

Concerned places should be shop.py, menu_creator_manager.py#create_shop_menu (if anything should be updated in the menu) and level_0/map.tmx, level_3/map.tmx (for giving the new "money" property to the shops defined in these levels).

N.B.: I don't know if this feature is a balanced one, I just think it may be funny to implement. Let see after experimenting if it's bringing some value or too boring

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.