Forum | HOWTO: properly replace graphics (PSA)

You must be logged in to post Login Register

Search Forums:


 






HOWTO: properly replace graphics (PSA)

No Tags
UserPost

1:35 pm
September 22, 2009


saluk

Admin

posts 144

Post edited 8:37 pm – September 22, 2009 by saluk


"Oh Noes! All of my custom art is reset! I can't change the artwork because PyWright automatic updates overwrite my changes! What shall I do!"

Is the cry that has been heard many times. For example, many case authors want to make their game less pywright-y and more phoenix wright-y by replacing the press/present buttons, court record buttons, etc. They go into PyWright/art/general, see the "crossex.png" button that has "z Press" and "x present" in it and think, "Hmm, if I change this, I can fix these buttons so they look more official."

And they are correct. They replace the image, and are happy to find that the new graphics show up in their game.

Then the unfortunate occurs – they update PyWright and all of the graphics go back! So they see two options: 1, never update; 2, don't bother with trying to replace graphics.

Here is the key, PyWright is designed for case authors to be able to override anything*, within their own games. Everything outside of your game folder is the standard by which all PyWright games are created, however that standard can be modified from within your game.

The way you do this, is to mirror the directory structure you find in PyWright, but starting from your game folder instead of the root folder.

PyWright has a specific order in which it looks for things.

When you say "char phoenix" in your code, it follows this search path until it finds a proper Phoenix Wright "normal" blinking pose, and a proper Phoenix Wright "normal" talking pose. The order PyWright searches when it looks for content is:


the current case ("PyWright/games/mygame/mycase")

the current game ("PyWright/games/mygame")

finally, the root path ("PyWright/")


If it is looking for an fg, it will look under "art/fg" starting from each of those starting points. If it is looking for "art/general/buttonpress.png" it will first look at "PyWright/games/mygame/mycase/art/general/buttonpress.png", then "PyWright/games/mygame/art/general/buttonpress.png", and finally "PyWright/art/general/buttonpress.png".

Characters are even more confusing. Say you want your Maya to wear a cowboy hat. If you only replace her speaking pose, with "PyWright/games/wildwest_adventure/art/port/maya/normal(talk).png", then every time she blinks, her hat will vanish.

It is recommended to put most of your custom work, be it sounds, character files, macro files, or core art that you want to override, in your game's folder. Most art is not going to be completely specific to one case, and there is little benefit to putting it only in the case folder itself. (We'll leave the facts that most custom cases are only one case long so far aside for now). And any art you put at the root is subject to vanish when pywright updates, or, worse, when you distribute your case people playing it will not have your updates.

So, put all of your stuff in PyWright/games/mygame. That is where you should live during the long arduous process of creating your games.

Hope this helps alleviate some confusion.

*You are not yet able to override any of the python code that runs the engine; anything else though can be overridden.

2:44 am
October 15, 2009


Matx

Roma (Italy)

Member

posts 104


I can not figure out how to post images


8:05 pm
February 7, 2010


StBacchus

Madison, WI

Member

posts 39

This makes sense to me, but I'm having a problem with it.

PyWright wants to check mygame/art/art/port when it's loading custom character graphics. It doesn't actually load the character art from that location, only checks it, then loads from the correct location mygame/art/port. This seems to be a problem only with one game I created – other games and even a different demo I made all work fine. Here's what the log says:

Traceback (most recent call last):
  File "corelibengine.py", line 285, in update
  File "corelibengine.py", line 392, in interpret
  File "corelibengine.py", line 1033, in _char
  File "corecore.py", line 542, in add_portrait
  File "corecore.py", line 1121, in __init__
  File "corecore.py", line 1196, in init
  File "corecore.py", line 1167, in loadfrom
  File "corecore.py", line 904, in load
  File "corecore.py", line 403, in open_art
  File "corecore.py", line 368, in _open_art_
error: Couldn't open art/art/port/Rhea/normal(blink).png

I copied the directory structure for this game straight over from one that works. But I also started in the middle, so I may be missing some critical command that's supposed to go in intro.txt or something.


I can work around this by keeping an extra art directory in the art directory, but maybe you have an idea of what's going on?

7:36 am
February 8, 2010


Matx

Roma (Italy)

Member

posts 104

it's strange… maybe you don't put the graphics on the correct folder!!!
Where did you put this graphincs?? On the prncipal folder???

Iit does't give my this error I'll post the directory where I put:

game/Mygame/Mycase/art/port/….

Let me know if it works ok?

Hello word….

                                                                                                                                                                                       By MatxCool

12:57 pm
February 8, 2010


StBacchus

Madison, WI

Member

posts 39

My directory structure is like this:

games/MyGame/art/port


If I'm understanding correctly, that should work. But I will try:

games/MyGame/MyCase/art/port


And now I get a different error:

error: Couldn't open art/MyCase/art/port/Rhea/normal(combined).png

Setting debug to either "true" or "false" in the intro.txt doesn't change anything. Also, other art and sfx loads just fine. It's only character portraits. I think this must be some weird bug, but I'm not sure how I tripped it!

8:27 pm
February 8, 2010


StBacchus

Madison, WI

Member

posts 39

Ha!!! OK, here's the problem:

I named my game directory "TurnaboutSubstitution_MyPart". Renamed to "TurnaboutSubstition_Mine" = problem solved.


Hubby thinks the error is occurring at line 1158 of core.py. Meanwhile, this issue can now be declared "known." Laugh

1:39 am
February 9, 2010


saluk

Admin

posts 144

Post edited 1:23 pm – February 9, 2010 by saluk


That's awesome, I was just about to ask what the name of your game was. It's a pretty dumb bug, it shouldn't be hard to fix. Thank your hubby for finding the offending line too!

Edit: yes, I only had to change one letter in the source, lol.

No Tags