Author Topic: PyProcGameHD+SkeletonGame - Help getting game started  (Read 3078 times)

Paikuhan76

  • Newbie
  • *
  • Posts: 10
    • View Profile
PyProcGameHD+SkeletonGame - Help getting game started
« on: June 10, 2015, 10:03:54 PM »
Hi guys!

I'm really trying to get a barebones game up and running so I can setup the SwitchMatrix GUI and just start coding my game from scratch.  I've tried doing this using the T2 sample game and Curbfeeler's Pinbot game, but neither game has the animations, fonts or other assets that the game is looking for. 

So here is the latest error I have run into:

WARNING no font_path set in ./config.yaml!
2015-06-10 21:43:34,397 - game.sound - INFO - Initializing sound...
Desktop init begun.
****************
WINDOW SET
****************
Using a virtual DMD ONLY - no physical DMD output will be sent
2015-06-10 21:43:34,642 - game - INFO - Loading machine configuration from "conf
ig/Avengers.yaml"...
2015-06-10 21:43:34,691 - game - INFO - Programming switch rules...
2015-06-10 21:43:34,694 - game - INFO - LEDS...
2015-06-10 21:43:34,697 - game.assets - INFO - asset configuration found at C:\P
-ROC\PyProcGameHD\Avengers/config/asset_list.yaml
2015-06-10 21:43:34,782 - game.assets - ERROR - ===ASSET MANAGER - ASSET FAILURE
===
2015-06-10 21:43:34,785 - game.assets - ERROR - Animation: [None]: None
2015-06-10 21:43:34,786 - game.assets - ERROR - ======
Traceback (most recent call last):
  File "C:\P-ROC\PyProcGameHD\Avengers\Avengers.py", line 104, in <module>
    run_proc_game(Avengers)
  File "c:\p-roc\pyprocgamehd\procgame\game\skeletongame.py", line 74, in run_pr
oc_game
    game = game_class()
  File "C:\P-ROC\PyProcGameHD\Avengers\Avengers.py", line 44, in __init__
    super(Avengers, self).__init__('config/Avengers.yaml', self.curr_file_path)
  File "c:\p-roc\pyprocgamehd\procgame\game\skeletongame.py", line 137, in __ini
t__
    self.load_assets()
  File "c:\p-roc\pyprocgamehd\procgame\game\skeletongame.py", line 498, in load_
assets
    self.asset_mgr = assetmanager.AssetManager(game=self)
  File "c:\p-roc\pyprocgamehd\procgame\assetmanager.py", line 112, in __init__
    self.load()
  File "c:\p-roc\pyprocgamehd\procgame\assetmanager.py", line 244, in load
    self.loadIntoCache(k,ft,f,r,h,o,c,x,y)
  File "c:\p-roc\pyprocgamehd\procgame\assetmanager.py", line 152, in loadIntoCa
che
    file=key + '.vga.dmd.zip'
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
Exception AttributeError: "'NoneType' object has no attribute 'SDL_DestroyWindow
'" in <bound method Window.__del__ of <sdl2.ext.window.Window object at 0x032E1D
30>> ignored
Exception TypeError: "'NoneType' object is not callable" in <bound method Render
er.__del__ of <sdl2.ext.sprite.Renderer object at 0x032E1E50>> ignored

Here is my asset list yaml file:

https://www.dropbox.com/s/z4vpxbwddwysovs/asset_list.yaml?dl=0

If you guys could give me some suggestions on a barebones set of animations, sounds, fonts, etc that I would need just to get a game up and running, I would really appreciate it. :)

Thanks,
Pai

MOcean

  • Moderator
  • ****
  • Posts: 822
  • Michael Ocean
    • View Profile
Re: PyProcGameHD+SkeletonGame - Help getting game started
« Reply #1 on: June 10, 2015, 10:34:10 PM »
Looks like my code is expecting there to be an Animation section in the asset_list file (which made sense at the time as it was originally the only thing that was supported for loading... Then sound, then fonts, and it snowballed into what it is now).

Try uncommenting the Animations section but don't put any entries in it, and I'll try to toss a fix up asap so it isn't so presumptuous.

Paikuhan76

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: PyProcGameHD+SkeletonGame - Help getting game started
« Reply #2 on: June 10, 2015, 10:43:09 PM »
Thanks! I commented out all the animations and sounds and got this error (just in case this is another line you might need to fix):

  File "c:\p-roc\pyprocgamehd\procgame\assetmanager.py", line 183, in load
    self.total = (len(lamps) + len(fontstyles) + len(anims)+len(hfonts)+len(rfon
ts)+len(music)+len(effects)+len(voice))
TypeError: object of type 'NoneType' has no len()

Figured this might help.  Looks like it always wants assets under each section of the asset_list.

MOcean

  • Moderator
  • ****
  • Posts: 822
  • Michael Ocean
    • View Profile
Re: PyProcGameHD+SkeletonGame - Help getting game started
« Reply #3 on: June 10, 2015, 11:00:47 PM »
Good point. I'll also make sure I declare the lists to have a default value of an empty list so that len() works on them.  You could always just have a single png as an asset in there for now just to get past this, even if you don't use it.

I'll fix the code tomorrow morning. Sorry!

Paikuhan76

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: PyProcGameHD+SkeletonGame - Help getting game started
« Reply #4 on: June 10, 2015, 11:21:09 PM »
Ah okay! I'll whip up a PNG then.  No rush on the fix sir.  I just wasn't sure what type of file that I could put into animations.  I tried a JPG (same jpg I use for the loading screen) and it was throwing that error.  So I figured I needed a series of images or a certain dmd type file (or even a zip file, since that is what the error mentioned).  I guess I will do this for the sounds section as well just to make I have one sound that the asset manager picks up.

Thanks

MOcean

  • Moderator
  • ****
  • Posts: 822
  • Michael Ocean
    • View Profile
Re: PyProcGameHD+SkeletonGame - Help getting game started
« Reply #5 on: June 11, 2015, 09:57:15 AM »
Just pushed an updated assetmanager.py up to github.  It now tolerates several kinds of missing/empty tags in that file.

Paikuhan76

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: PyProcGameHD+SkeletonGame - Help getting game started
« Reply #6 on: June 11, 2015, 07:12:10 PM »
Great! Thank you! I will try that out later tonight.

Paikuhan76

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: PyProcGameHD+SkeletonGame - Help getting game started
« Reply #7 on: June 11, 2015, 11:04:48 PM »
Intro screen up and running!

Now I am trying to start a game and I've run into a snag with the update_layer_1p definition in the score_display.py file.  I have a my keyboard mapped to start a game, when I hit start I get the following error:

Traceback (most recent call last):
  File "C:\P-ROC\PyProcGameHD\Avengers\Avengers.py", line 98, in <module>
    run_proc_game(Avengers)
  File "c:\p-roc\pyprocgamehd\procgame\game\skeletongame.py", line 75, in run_pr
oc_game
    game.run_loop()
  File "c:\p-roc\pyprocgamehd\procgame\game\skeletongame.py", line 751, in run_l
oop
    super(SkeletonGame, self).run_loop(min_seconds_per_cycle)
  File "c:\p-roc\pyprocgamehd\procgame\game\game.py", line 661, in run_loop
    self.process_event(event)
  File "c:\p-roc\pyprocgamehd\procgame\game\game.py", line 532, in process_event

    self.dmd_event()
  File "c:\p-roc\pyprocgamehd\procgame\game\skeletongame.py", line 703, in dmd_e
vent
    self.dmd.update()
  File "c:\p-roc\pyprocgamehd\procgame\dmd\displaycontroller.py", line 77, in up
date
    layer.composite_next(self.frame)
  File "procgame\dmd\dmd.py", line 413, in composite_next
  File "c:\p-roc\pyprocgamehd\procgame\modes\score_display.py", line 18, in next
_frame
    self.mode.update_layer()
  File "c:\p-roc\pyprocgamehd\procgame\modes\score_display.py", line 242, in upd
ate_layer
    self.update_layer_1p()
  File "c:\p-roc\pyprocgamehd\procgame\modes\score_display.py", line 255, in upd
ate_layer_1p
    self.score_layer.set_text(self.format_score(score)) #, blink_frames=3)
AttributeError: 'str' object has no attribute 'set_text'

Suggestions? Am I missing an asset that I need for the layer building?

MOcean

  • Moderator
  • ****
  • Posts: 822
  • Michael Ocean
    • View Profile
Re: PyProcGameHD+SkeletonGame - Help getting game started
« Reply #8 on: June 11, 2015, 11:21:39 PM »
I must be missing something too since every instance of score_display is initialized as a layer.

Not that I understand why one would cause the other, but do you have a config/score_display.yaml?  If not do you have HDfonts defined with aliases
score_1p
score_active
score_inactive
score_sub
?

Also you can have an animation keyed score_background and another keyed score_interior (animated fill); you shouldn't need these, but you'd need those fonts if you don't have a config/asset.yaml

Doesn't seem to me like that problem would cause this specific error, but...

Paikuhan76

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: PyProcGameHD+SkeletonGame - Help getting game started
« Reply #9 on: June 11, 2015, 11:30:53 PM »
I must be missing something too since every instance of score_display is initialized as a layer.

Not that I understand why one would cause the other, but do you have a config/score_display.yaml?  If not do you have HDfonts defined with aliases
score_1p
score_active
score_inactive
score_sub
?

Also you can have an animation keyed score_background and another keyed score_interior (animated fill); you shouldn't need these, but you'd need those fonts if you don't have a config/asset.yaml

Doesn't seem to me like that problem would cause this specific error, but...

I do have a score_display.yaml.  And I also have the aliases defined in the asset list.

However, one of the things I had to do to get the game running was change my HDFonts all to Arial:

 - key: 'score_1p'
    systemName: "Arial"
    size: 48
  - key: 'score_activeL'
    systemName: "Arial"
    size: 48
  - key: 'score_activeM'
    systemName: "Arial"
    size: 40
  - key: 'score_activeS'
    systemName: "Arial"
    size: 32
  - key: 'score_inactive'
    systemName: "Arial"
    size: 32
  - key: 'score_sub'
    systemName: "Arial"
    size: 14

I was throwing errors with the fonts listed in the example I had.  So maybe I have to use a font other than Arial?

MOcean

  • Moderator
  • ****
  • Posts: 822
  • Michael Ocean
    • View Profile
Re: PyProcGameHD+SkeletonGame - Help getting game started
« Reply #10 on: June 11, 2015, 11:44:20 PM »
Mapping them to Arial is totally fine. What about the background?  Does that map to a tag that exists in your asset_list Animations section?

Paikuhan76

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: PyProcGameHD+SkeletonGame - Help getting game started
« Reply #11 on: June 11, 2015, 11:54:31 PM »
Mapping them to Arial is totally fine. What about the background?  Does that map to a tag that exists in your asset_list Animations section?

I didn't have those keys in my animation list.  I added them.  This is my animation list:

Animations:
- key: 'Avengers'
  file: 'Avengers.png'
- key: 'chrome'
  file: 'Avengers.png' 
- key: 'dark_chrome'
  file: 'Avengers.png'
- key: 'status_bg'
  file: 'Avengers.png'
- key: 'score_background'
  file: 'Avengers.png'
- key: 'score_interior'
  file: 'Avengers.png' 

I added the status_bg key because I noticed this snippet of code in skeletongame.py:

self.animations['status_bg'] = GroupedLayer(self.dmd_width-8, self.dmd_height/2-8,[t2,t1])
self.animations['status_bg'].set_target_position(4,self.dmd_height/4+4)

Still got the same error.

MOcean

  • Moderator
  • ****
  • Posts: 822
  • Michael Ocean
    • View Profile
Re: PyProcGameHD+SkeletonGame - Help getting game started
« Reply #12 on: June 12, 2015, 06:23:02 AM »
You don't want a animation entry called status_bg -- the framework makes that one for you. If you can point me to your code, I'll check it out myself here.

Curbfeeler

  • Wizard
  • *****
  • Posts: 239
  • Dan - Des Moines, IA
    • View Profile
Re: PyProcGameHD+SkeletonGame - Help getting game started
« Reply #13 on: June 12, 2015, 10:05:21 AM »
Do you have luck now when you run the two bat files included in my Pinbot code?  Sounds like you're super close...welcome!

Dan

Paikuhan76

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: PyProcGameHD+SkeletonGame - Help getting game started
« Reply #14 on: June 12, 2015, 12:00:49 PM »
Do you have luck now when you run the two bat files included in my Pinbot code?  Sounds like you're super close...welcome!

Dan

Thanks Dan, I edited your bat file for the switch matrix gui.  Your code helped me tremendously with seeing how to setup a plurality of modes, in addition to the sample game that came with the framework, so thank you for posting that.

I am definitely close.  I have an intro screen and now I'm just trying to hit the start button on my keyboard to start a game, display the score and let me see the trough and flipper switches going in the windows command console.  Figure once I have a stable game I can build up the code from there.   

Michael has been helping me so much.  Can't thank him enough.