New to the Maptools codebase

Developer discussion regarding MapTool 1.4

Moderators: dorpond, trevor, Azhrei

Forum rules
Posting now open to all registered forum users.
Post Reply
User avatar
Sheepyhead
Kobold
Posts: 6
Joined: Wed Aug 30, 2017 8:53 am
Location: Aarhus, Denmark

New to the Maptools codebase

Post by Sheepyhead »

Hey guys! My party have been using MapTools for a while now to great satisfaction, so I thought I'd look into contributing to the project! For now I've looked over the issue that attempting to embed an animated gif leads to strange (probably undefined) behavior, including crashing. I'm currently just trying to get an idea of the general structure of the software, and I'm having issues figuring out specifically where and how the HTML formatting is parsed. I've found the net.rptools.maptool.client.ui.chat.ChatProcessor class where it seems that messages pass through process(String incoming) unaltered, but trying to trace where in the chain of message processing this is happening is sorta difficult. It'd be awesome if someone more familiar with the software could help me figure out the structure of it, it's gonna take some time to figure out by myself :)

I guess I could write a bit about me; I recently graduated with a bachelor's degree in computer science from Aarhus University, and have been working with software development for 1-2 years on the side. I'm currently employed full time at a software consultant firm in Aarhus, so I've got a little experience, mostly with Java, but also with a bunch of other languages and paradigms etc. I hope I'll be able to contribute something meaningful :)

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: New to the Maptools codebase

Post by wolph42 »

Hi, welcome to the rptools forum and thank you for the offer. I'll inform the devs of your request and perhaps one of them can help.

Aarhus IRC that lies in Danmark right? Recently read an article concerning the chief moderator (Viking83) of the trump-trolling subreddit forum and the impact he had on american society. Alledgedly he lived in Aarhus.

Been a couple of times to Denmark, it reminds me a lot of my own country.

anyhoot: welcome!

User avatar
Sheepyhead
Kobold
Posts: 6
Joined: Wed Aug 30, 2017 8:53 am
Location: Aarhus, Denmark

Re: New to the Maptools codebase

Post by Sheepyhead »

wolph42 wrote:Hi, welcome to the rptools forum and thank you for the offer. I'll inform the devs of your request and perhaps one of them can help.

Aarhus IRC that lies in Danmark right? Recently read an article concerning the chief moderator (Viking83) of the trump-trolling subreddit forum and the impact he had on american society. Alledgedly he lived in Aarhus.

Been a couple of times to Denmark, it reminds me a lot of my own country.

anyhoot: welcome!
Thanks for the welcome, and yes, it's in Denmark. Tiny city for being the second-largest city in the country, but I've always lived in or around it. The university is pretty well-known for having quality comsci courses though, which is nice. I can't talk about the trump-trolling subreddit though, I try to stay out of politics ;)
I've already posted a comment on the issue tracker under the same account name as here, for now I'm just looking through the code base trying to figure out what's what.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: New to the Maptools codebase

Post by wolph42 »

:D i wasn't expecting to discuss politics with you. It as just that I read about Aarhus last week. I've informed the devs and also saw your notice on github.

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: New to the Maptools codebase

Post by JamzTheMan »

Welcome aboard! I don't know where that code is offhand either, I would have to dig for it as well, sorry. But I would suspect it's not just chat parsing that causes issue but also rendering on the map... Some of the image stuff is also handled in rplib, a separate project and you may need to check that one out as well from github...
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
Sheepyhead
Kobold
Posts: 6
Joined: Wed Aug 30, 2017 8:53 am
Location: Aarhus, Denmark

Re: New to the Maptools codebase

Post by Sheepyhead »

JamzTheMan wrote:Welcome aboard! I don't know where that code is offhand either, I would have to dig for it as well, sorry. But I would suspect it's not just chat parsing that causes issue but also rendering on the map... Some of the image stuff is also handled in rplib, a separate project and you may need to check that one out as well from github...
What I was thinking was that if I could follow the flow of events upon posting a message to the chat (at least locally), I'd find a point where it would make sense to look at what type of image it is, and reject it if it's animated, but the flow of events is a bit of an ordeal to track... I think a general overview of how MapTools works would help me quite a bit though.

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: New to the Maptools codebase

Post by Azhrei »

Welcome to RPTools!

All images go through the AssetManager, IIRC. That means that any GIF loaded by MT that has to be used anywhere would be processed by that class. I would suggest setting a breakpoint in the code that loads and/or retrieves images and watch it get hit the first time the image is used. (And if I've got the name wrong, there are two other ways to determine which class it is: follow the code for the asset:// URL handler, or the code that loads tokens from .token files since images have to be added to the cache when that happens.)

In terms of why it might crash, my fix would be to check any loaded GIF and if it appears to be an animated GIF, only keep the first frame and throw the other frames away. Then have the AssetManager cache that single frame so in the future only the single frame version is returned. This means that animated GIFs from the web would also work when dragged and dropped onto MT, since it's the AssetManager (or one of its related classes) that creates the cache under .maptool.

Such a fix would mean animated GIFs would work in the chat window an and also as tokens when dropped on a map, and their thumbnail would show up correctly in the Library panel.

User avatar
Sheepyhead
Kobold
Posts: 6
Joined: Wed Aug 30, 2017 8:53 am
Location: Aarhus, Denmark

Re: New to the Maptools codebase

Post by Sheepyhead »

Azhrei wrote:Welcome to RPTools!

All images go through the AssetManager, IIRC. That means that any GIF loaded by MT that has to be used anywhere would be processed by that class. I would suggest setting a breakpoint in the code that loads and/or retrieves images and watch it get hit the first time the image is used. (And if I've got the name wrong, there are two other ways to determine which class it is: follow the code for the asset:// URL handler, or the code that loads tokens from .token files since images have to be added to the cache when that happens.)

In terms of why it might crash, my fix would be to check any loaded GIF and if it appears to be an animated GIF, only keep the first frame and throw the other frames away. Then have the AssetManager cache that single frame so in the future only the single frame version is returned. This means that animated GIFs from the web would also work when dragged and dropped onto MT, since it's the AssetManager (or one of its related classes) that creates the cache under .maptool.

Such a fix would mean animated GIFs would work in the chat window an and also as tokens when dropped on a map, and their thumbnail would show up correctly in the Library panel.
Awesome, thanks for the hints! I'll take another look at it tomorrow, gotta go work out and then crash! Nice to meet you all :D

User avatar
Sheepyhead
Kobold
Posts: 6
Joined: Wed Aug 30, 2017 8:53 am
Location: Aarhus, Denmark

Re: New to the Maptools codebase

Post by Sheepyhead »

Azhrei wrote:Welcome to RPTools!

All images go through the AssetManager, IIRC. That means that any GIF loaded by MT that has to be used anywhere would be processed by that class. I would suggest setting a breakpoint in the code that loads and/or retrieves images and watch it get hit the first time the image is used. (And if I've got the name wrong, there are two other ways to determine which class it is: follow the code for the asset:// URL handler, or the code that loads tokens from .token files since images have to be added to the cache when that happens.)

In terms of why it might crash, my fix would be to check any loaded GIF and if it appears to be an animated GIF, only keep the first frame and throw the other frames away. Then have the AssetManager cache that single frame so in the future only the single frame version is returned. This means that animated GIFs from the web would also work when dragged and dropped onto MT, since it's the AssetManager (or one of its related classes) that creates the cache under .maptool.

Such a fix would mean animated GIFs would work in the chat window an and also as tokens when dropped on a map, and their thumbnail would show up correctly in the Library panel.
I've looked into this now. So far it seems that the images in the chat do not pass through any of the createAsset() or getAsset() functions... I'll keep searching

User avatar
RPTroll
TheBard
Posts: 3159
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: New to the Maptools codebase

Post by RPTroll »

Thanks for taking this on. It's been an oft requested bit of functionality. It will be nice to have it working properly.

Plus - you can use an animated gif on a token? I never knew that.
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: New to the Maptools codebase

Post by Full Bleed »

RPTroll wrote:Plus - you can use an animated gif on a token? I never knew that.
You can't. ;)

At least, not yet.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

User avatar
RPTroll
TheBard
Posts: 3159
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: New to the Maptools codebase

Post by RPTroll »

MapTool would a lot cooler if you could.
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: New to the Maptools codebase

Post by aliasmask »

You can show animated gifs in other parts like chat or frames but you will need to reference an external url.

User avatar
RPTroll
TheBard
Posts: 3159
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: New to the Maptools codebase

Post by RPTroll »

I also didn't know you could reference external URLs in frames. Geeze. I've been gone too long.
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

User avatar
Sheepyhead
Kobold
Posts: 6
Joined: Wed Aug 30, 2017 8:53 am
Location: Aarhus, Denmark

Re: New to the Maptools codebase

Post by Sheepyhead »

The entire issue right now seems to be that whatever is rendering images is sorta bad at animated gifs, some will show, some will cause a stack overflow, and some will freeze the entire program. For now the proper solution seems to be either displaying the error picture, or displaying only the first frame of the gif. I still haven't figured out where the frak embedded images pass through though...

Post Reply

Return to “MapTool 1.4”