remance / Masendor

Open source educational and historical battle action game, All helps accepted
MIT License
143 stars 32 forks source link

error #32

Closed Hamster-lord closed 1 year ago

Hamster-lord commented 1 year ago

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_typelist = 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_typelist = tuple(set(["" + value["Common"] + "_" for key, value in weapon_list.items() if !! TypeError: can only concatenate str (not "int") to str

remance commented 1 year ago

Thanks for the report, This error should be fixed with the newest update. Made a mistake not checking for the error before commit :P

Hamster-lord commented 1 year ago

I got this: 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 744, 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 13, in start_battle self.battle_game.run_game() !! File "/Users/Emma/Documents/GitHub/AnchientBattleSimulator/gamescript/battle.py", line 892, in run_game pygame.mixer.music.load(self.musiclist[self.music_current[self.picked_music]]) !! IndexError: list index out of range

remance commented 1 year ago

yeah I notice this error. Although I can't commit the update I am working yet. Will let you know when it done.

Hamster-lord commented 1 year ago

ok thx

remance commented 1 year ago

The new update should fix this issue now.

Hamster-lord commented 1 year ago

why is there a black box around the caracthers?

Hamster-lord commented 1 year ago

or soldiers

remance commented 1 year ago

Is it still there? I don't see any.

Hamster-lord commented 1 year ago
Screen Shot 2023-02-11 at 8 25 15 AM
Hamster-lord commented 1 year ago

also how to change weapons?

remance commented 1 year ago

Well that is very weird. Wonder if it related to pygame version or macOS. This never happen in the previous version before rework update right?

To change your character weapon, just press 1 or 2 (the one not on numpad).

Hamster-lord commented 1 year ago

yes

remance commented 1 year ago

For the weird black box, can you try run this code below and post a screenshot to show how it look?

class HeroUI(pygame.sprite.Sprite):
    weapon_sprite_pool = None

    def __init__(self, screen_scale):
        self._layer = 10
        pygame.sprite.Sprite.__init__(self)
        self.screen_scale = screen_scale

        self.image = pygame.Surface((200 * self.screen_scale[0], 200 * self.screen_scale[1]), pygame.SRCALPHA)

        self.health_bar_size = (10 * self.screen_scale[0], self.image.get_height())
        self.health_bar = pygame.Surface(self.health_bar_size, pygame.SRCALPHA)
        self.health_bar.fill((0, 0, 0))
        self.health_bar_original = self.health_bar.copy()
        self.health_bar_rect = self.health_bar.get_rect(topright=(self.image.get_width() - self.health_bar_size[0], 0))
        self.health_bar.fill((200, 0, 0))

        self.health_bar_height = self.health_bar.get_height()

        self.stamina_bar = pygame.Surface(self.health_bar_size, pygame.SRCALPHA)
        self.stamina_bar.fill((0, 0, 0))
        self.stamina_bar_original = self.stamina_bar.copy()
        self.stamina_bar_rect = self.stamina_bar.get_rect(topright=(self.image.get_width(), 0))
        self.stamina_bar.fill((0, 200, 0))
        self.image.blit(self.health_bar, self.health_bar_rect)
        self.image.blit(self.stamina_bar, self.stamina_bar_rect)
        self.rect = self.image.get_rect(topleft=(0, 0))

import pygame

pygame.init()
wndsize = (400, 400)
window = pygame.display.set_mode(wndsize)
clock = pygame.time.Clock()

test = HeroUI((1, 1))
run = True
while run:
    clock.tick(60)

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False
    window.fill((255, 255, 255))

    window.blit(test.image, test.rect)

    pygame.display.update()
Hamster-lord commented 1 year ago

where?

remance commented 1 year ago

Run it as a new file entirely on its own please. This is just to check if it is pygame related problem.

Hamster-lord commented 1 year ago
Screen Shot 2023-02-17 at 7 57 49 AM
remance commented 1 year ago

seem to work fine on that end then. well this is quite weird since it use the same setup. Can you check in game again with the newest update to see if it still has the same bug?

Hamster-lord commented 1 year ago

there are still black boxes

remance commented 1 year ago

Tested the game on another pc and no black box issue. Guess it is likely related to macOS. Will have a test on that later.

Hamster-lord commented 1 year ago

maybe

Hamster-lord commented 1 year ago

Have you figured out why black boxes are appearing on my screen?

Hamster-lord commented 1 year ago

I got !! Traceback (most recent call last): !! File "/Users/Emma/Documents/GitHub/AnchientBattleSimulator/main.py", line 15, in game.Game(main_dir, error_log) !! File "/Users/Emma/Documents/GitHub/AnchientBattleSimulator/gamescript/game.py", line 559, in init self.change_ruleset() !! File "/Users/Emma/Documents/GitHub/AnchientBattleSimulator/gamescript/game.py", line 587, in change_ruleset self.troop_data, self.leader_data, self.faction_data = make_faction_troop_leader_data(self.main_dir, !! File "/Users/Emma/Documents/GitHub/AnchientBattleSimulator/gamescript/common/game/setup/make_faction_troop_leader_data.py", line 12, in make_faction_troop_leader_data troop_data = datastat.TroopData(main_dir, weapon_images, ruleset_folder, language) !! File "/Users/Emma/Documents/GitHub/AnchientBattleSimulator/gamescript/datastat.py", line 252, in init self.weapon_lore |= {key: value for key, value in weapon_lore_list.items() if key !! TypeError: unsupported operand type(s) for |=: 'dict' and 'dict'

remance commented 1 year ago

Unfortunately not, I have no access to macOS to test it yet. The last error is because you need python 3.10 to run the game.

Hamster-lord commented 1 year ago

oh ok

Hamster-lord commented 1 year ago

did you get a macOS yet to test the error?

remance commented 1 year ago

Probably will be a little while longer, I don't have access to my pc yet and my laptop is not good enough for virtual machine. Will let you know when I manage to do it. For now, can you try update the game and all python library to see if it work now?

Hamster-lord commented 1 year ago

ok

Hamster-lord commented 1 year ago

The black boxes might actually be hit boxes.

Hamster-lord commented 1 year ago

I also found out the boxes size depends on the units size.

remance commented 1 year ago

I see thanks for checking, well I should be able to test the game on macOS soon. Will let you know when I mange to get to it.

remance commented 1 year ago

so I managed to run the game on macOS 12 in my virtual machine and could not manage to replicate the black box issue. So I think the issue may be from outdated requirement on your pycharm. Can you post a screenshot of your package list?

Here is what mine look like: For some reason pygame 2.3 can not be run on my macOS so I had to revert to 2.1 version. image

remance commented 1 year ago

Well you should also try run pip install -r requirements.txt too to check if it really is the issue with library.

remance commented 1 year ago

If that still not work, I will make a new release for macOS for you to test with the release version.

Hamster-lord commented 1 year ago

it doesn't work

remance commented 1 year ago

Just release mac version in the newest update. Can you try it from here?

https://github.com/remance/Masendor/releases/tag/0.6.8.4

Hamster-lord commented 1 year ago

it still doesn't work

Hamster-lord commented 1 year ago

the background is has no green. it's just grey with curved lines everywhere.

Hamster-lord commented 1 year ago

I can't even see the bases

remance commented 1 year ago

Can you post screenshot? Seem more likely now that it is system related.

remance commented 1 year ago

Also can you post screenshot for the animation maker too?

remance commented 1 year ago

So if this blackbox only appear in the newer version, I think this may solve the issue.

Can you try downgrade Pillow library from 9.4.0 to 9.3.0. And maybe all of the following libraries below to these specific version? Maybe the newer one are incompatible with your system.

iniconfig==1.1.1 numpy~=1.22.2 pandas~=1.4.1 Pillow~=9.3.0 pygame~=2.1.2 pyperclip==1.8.2 pywin32-ctypes==0.2.0 screeninfo~=0.8.1 pathfinding~=1.0.1 scipy~=1.8.0

Hamster-lord commented 1 year ago
Screen Shot 2023-04-03 at 8 58 04 PM
remance commented 1 year ago

Thank you for the screenshot, the black box around mouse icon make it more obvious now that there is some issue with transparency. Likely with pygame and your system for some reason. I will have a try to make a quick test for this.

remance commented 1 year ago

What happen when you run Aliens.py game? You can find it in python folder (not sure where it is in your macOS system). Here is an example of where mine is : C:\Program Files (x86)\Python\Lib\site-packages\pygame\examples

remance commented 1 year ago

In any case, can you post your system spec, the pygame version you are running on? If nothing is working, I think I will have to go ask in a forum or pygame issue. Maybe I can replicate it if I try using the exact same macOS version as well.

remance commented 1 year ago

So I receive a suggestion to replace pygame with pygame-ce. Can you try update the game, and uninstall pygame from your pycharm and then install pygame-ce instead?

Hamster-lord commented 1 year ago

aliens.py does not have any black boxes

remance commented 1 year ago

Did you try uninstall pygame and install "pygame-ce" instead yet?

Hamster-lord commented 1 year ago

It still doesn't work :(

Hamster-lord commented 1 year ago

where is the folder that contains the soldiers