Problems creating components

Virtual tabletop software specifically designed for boardgames, wargames, card games and dice games
Post Reply
bowieb
Sergeant
Posts: 28
Joined: Sat Mar 05, 2016 5:58 pm

Problems creating components

Post by bowieb » Wed Mar 09, 2016 12:01 pm

I have a folder of 72 png images that I was trying to import and build into a deck of 24 3-sided cards.

I did it the way that was shown on the demo video with the Aliens game. I imported the whole directory into a multi-token component and then split it into individual tokens. After spending a few minutes assembling the cards, I noticed that not all of the images were there. At the bottom of the stack created by the split, there was still a copy of the multi-token component which listed all of the images in it's menu. Splitting it gave me the same results as the first time. I assumed the problem was caused by the number of files, so I split them into two directories, purged all the tokens and started over. The first directory imported and split properly. The second directory only gave me about half the images. I deleted the files around where it was stopping, purged those tokens and tried again, but still got the same result. I finally had to resort to creating the rest of the cards one by one (which worked eventually -- see below).

I also had a problem with some random crashes and strange behavior.

When I was merging the split multi-token cards into the proper sets of three, I would have an issue where I would select the three tokens, right-click, and select "merge..." and I would get a script error.

When I was adding components individually, sometimes I would select the "add token" command and nothing would happen. If I minimized BGE and then brought it back up, the token editing window would appear rather than the image selection window. If I closed that window and tried again, sometimes it would work and sometimes not.

As a programmer, I know these kinds of random problems are very hard to track down, but I thought I would mention them just in case you have any ideas. I will have a batch of images for another deck of cards in a couple of days, so if you have any suggestions, let me know and I'll give them a try when I'm working on that deck.

User avatar
heruca
Developer
Posts: 9384
Joined: Sun Nov 20, 2005 11:58 pm
Location: Buenos Aires, Argentina
Contact:

Re: Problems creating components

Post by heruca » Wed Mar 09, 2016 1:02 pm

This sounds like it might be related to an issue another user was having a couple of days ago. He'd occasionally get an error when merging multiple tokens into one unit. I think I've fixed the problem, and should be able to offer you a small patch soon, if you want to try it out to confirm that the bug is fixed.

As for the "splitting into multiple units" issue, I'm not sure why that is happening. I assume since you're just starting out that you're still nowhere near having 300+ units on the game table (a potential stumbling point if you haven't saved the game file recently). I would take a look at the component filenames in the second directory you mentioned. Are there any unusual characters in any of the filenames (commas, single quotes, double quotes, pipes, etc.)? Are any of the filenames over 27 characters long? It sounds like BGE is working it's way through the units it needs to create and is then failing silently. I say this because the last step of the splitting process is to delete the original multi-token unit, and it's clearly not getting to that step. Care to email me a screenshot of the second directory's contents so I can peruse the filenames for potential problems?
:arrow: Please help spread the word about BRPG and BGE, and never hesitate to tell me how I can make them better suit your gaming needs.

bowieb
Sergeant
Posts: 28
Joined: Sat Mar 05, 2016 5:58 pm

Re: Problems creating components

Post by bowieb » Wed Mar 09, 2016 1:19 pm

I'm nowhere near 300 units on the table. In fact, these were the first units put on the table, so the max count while I was working on this would have been 72 (if the split worked properly).

None of the filenames have any special characters. All of them are of the format "card-name-1.png". All standard alphabetic names. The longest is 24 characters including the extension.

User avatar
heruca
Developer
Posts: 9384
Joined: Sun Nov 20, 2005 11:58 pm
Location: Buenos Aires, Argentina
Contact:

Re: Problems creating components

Post by heruca » Wed Mar 09, 2016 1:52 pm

I just ran a test in BGE v1.7 where I created a multi-token unit from a folder of 87 images (PNGs). The unit was created just fine, so I split it into individual units and I got 87 individual units, with no errors, and the original multi-token unit was properly deleted. So on my end, it's all working as it should.

I'd now like to run a similar test using your card assets. Could you perhaps zip up the folder in question and email it to me? If too large to email, I have Dropbox, in case that helps.
:arrow: Please help spread the word about BRPG and BGE, and never hesitate to tell me how I can make them better suit your gaming needs.

bowieb
Sergeant
Posts: 28
Joined: Sat Mar 05, 2016 5:58 pm

Re: Problems creating components

Post by bowieb » Wed Mar 09, 2016 2:31 pm

The zip file is about 19MB (72 200-400k png files), so a bit too large to email. I can put it in your dropbox if you send me the link.

User avatar
heruca
Developer
Posts: 9384
Joined: Sun Nov 20, 2005 11:58 pm
Location: Buenos Aires, Argentina
Contact:

Re: Problems creating components

Post by heruca » Wed Mar 09, 2016 7:10 pm

Got your files, thanks. I was able to duplicate the issue here (that's a good thing, means I can debug it).

Nothing conclusive, yet, but the issue appears to be related to the unit name in some fashion (perhaps BGE's auto-naming code is failing due to the format of your filenames?). Because I noted that there's a <void> value being saved in the game file (you can open game files in a text editor), right in the slot where the unit name should be (which is different than the media asset's name).

I've found that if I remove the dash right before the number in each of the 72 filenames, the "split apart" operation works properly, and you're left with 72 units, as expected.

Your current filenames should be valid, but something in BGE doesn't like the "continuous-and-ending-with-a-digit" format.
:arrow: Please help spread the word about BRPG and BGE, and never hesitate to tell me how I can make them better suit your gaming needs.

bowieb
Sergeant
Posts: 28
Joined: Sat Mar 05, 2016 5:58 pm

Re: Problems creating components

Post by bowieb » Wed Mar 09, 2016 8:25 pm

That's annoying. The files were originally going to have spaces, but I used Photoshop's "Save for Web" feature to create the png files and it automatically converted the spaces to dashes.

I'll make sure I rename the files to get rid of the dashes for the next batch.

User avatar
heruca
Developer
Posts: 9384
Joined: Sun Nov 20, 2005 11:58 pm
Location: Buenos Aires, Argentina
Contact:

Re: Problems creating components

Post by heruca » Wed Mar 09, 2016 10:37 pm

Keep in mind that images lose any compression once they get imported into BGE. So a save-for-web JPG with over-the-top compression is going to balloon in size once in BGE, though an uncompressed PNG will probably stay more or less the same size. In short-don't bother with save-for-web in Photoshop.The PNG will probably look a lot better than the JPG, in any case.
:arrow: Please help spread the word about BRPG and BGE, and never hesitate to tell me how I can make them better suit your gaming needs.

User avatar
Omnidon
Site Admin
Posts: 2186
Joined: Mon Feb 06, 2006 7:46 pm
Location: NY State, USA
Contact:

Re: Problems creating components

Post by Omnidon » Wed Mar 09, 2016 11:59 pm

I highly recommend Bulk Rename Utility for renaming a lot of files on windows:
http://www.bulkrenameutility.co.uk/Download.php

bowieb
Sergeant
Posts: 28
Joined: Sat Mar 05, 2016 5:58 pm

Re: Problems creating components

Post by bowieb » Thu Mar 10, 2016 1:18 pm

I am using the "save for web" just for convenience. It remembers that I want PNG files, so I don't have to specify the filetype every time. I'm using PNG files so I can use the alpha channel for transparency.

I'll take a look at Bulk Rename Utility. I used the batch rename function built into IrfanView. It's a little funky, but it works.

I decided to start from scratch to avoid any other problems that might be caused by the filenames. I renamed all the files with spaces rather than dashes, purged everything, and re-created the game file. Everything loaded in fine. The split worked properly. The only problem I had was a single script error while merging the cards. But since I knew that was a possibility, I was saving frequently, so I only had to redo a couple of cards.

Now I just have to format the card images and make one more deck and I'll be ready to start playing!

BTW, I need to deal cards face up from the deck in this game. Should I do that by simply flipping the card with <>, or is there a better way?

bowieb
Sergeant
Posts: 28
Joined: Sat Mar 05, 2016 5:58 pm

Re: Problems creating components

Post by bowieb » Thu Mar 10, 2016 1:21 pm

Omnidon wrote:I highly recommend Bulk Rename Utility for renaming a lot of files on windows:
http://www.bulkrenameutility.co.uk/Download.php
I just looked up Bulk Rename Utility and I take back my previous comment. Compared to this, IrfanView's Batch Rename is quite simple! :D

User avatar
heruca
Developer
Posts: 9384
Joined: Sun Nov 20, 2005 11:58 pm
Location: Buenos Aires, Argentina
Contact:

Re: Problems creating components

Post by heruca » Thu Mar 10, 2016 4:48 pm

bowieb wrote:I decided to start from scratch to avoid any other problems that might be caused by the filenames. I renamed all the files with spaces rather than dashes, purged everything, and re-created the game file. Everything loaded in fine. The split worked properly. The only problem I had was a single script error while merging the cards. But since I knew that was a possibility, I was saving frequently, so I only had to redo a couple of cards.
Well done. That is what I would have advised you do.
bowieb wrote:I need to deal cards face up from the deck in this game. Should I do that by simply flipping the card with <>, or is there a better way?
There is a Draw Card command, and a Discard Card command. Both are covered on pg. 121 of the BGE User Manual. If dealing with drawing or discarding more than one card at a time, see pg. 78.

If it's a solo game, you can probably use the token-swapping keys just as easily.
:arrow: Please help spread the word about BRPG and BGE, and never hesitate to tell me how I can make them better suit your gaming needs.

bowieb
Sergeant
Posts: 28
Joined: Sat Mar 05, 2016 5:58 pm

Re: Problems creating components

Post by bowieb » Thu Mar 10, 2016 8:42 pm

It's a cooperative game, so all hands are face up on the table. The draw command causes the card to be hidden from the other players. I guess the options are either "draw and discard" or don't bother with the draw and just use the token swapping keys to flip the card.

User avatar
heruca
Developer
Posts: 9384
Joined: Sun Nov 20, 2005 11:58 pm
Location: Buenos Aires, Argentina
Contact:

Re: Problems creating components

Post by heruca » Thu Mar 10, 2016 9:37 pm

Draw and Discard (same hotkey for both) has the advantage of moving the card off the draw deck and placing it to the right of it.
:arrow: Please help spread the word about BRPG and BGE, and never hesitate to tell me how I can make them better suit your gaming needs.

User avatar
Omnidon
Site Admin
Posts: 2186
Joined: Mon Feb 06, 2006 7:46 pm
Location: NY State, USA
Contact:

Re: Problems creating components

Post by Omnidon » Thu Mar 10, 2016 10:26 pm

bowieb wrote:I just looked up Bulk Rename Utility and I take back my previous comment. Compared to this, IrfanView's Batch Rename is quite simple! :D
Last time I used irfanview's bulk rename it only worked for images (which I guess is fine in your case).

Bulk Rename Utility might look intimidating but it only takes 1 text box and 1 button click to use it, and it integrates nicely with windows context menus (optional).

bowieb
Sergeant
Posts: 28
Joined: Sat Mar 05, 2016 5:58 pm

Re: Problems creating components

Post by bowieb » Fri Mar 11, 2016 9:40 am

heruca wrote:Draw and Discard (same hotkey for both) has the advantage of moving the card off the draw deck and placing it to the right of it.
And moves the card to the top, which is nice.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests