Converting objects into pixels

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Converting objects into pixels

Post by wolph42 »

that clears things up a lot.

you alas make a wrong assumption. when you have a 'clean' map of maptools you basically looking at a small image (e.g. grass texture) repeated endlessly which takes up hardly any memory. Were you to create a grass field using that same texture by copy pasting it in e.g. photoshop to fill up say 10.000x10.000 pixels and THEN put the total image in maptool (which would look exactly the same as the 'clean' map) it would take a massive amount of memory.
So turning that texture into 'unique pixels' instead of 'repeating pixels' will put a significant dent in your memory.

The trick of maptools is to use these 'textures' like grass, tombstones, trees, and whatnot and copy paste them many many many times. This allows you to create HUGE maps with hardly an impact on memory. However EVERY UNIQUE image will take that amount of memory.

Now should you be using lets say 500 seperate images to build a map and
1. put them next to eachother in maptool to create a map
OR
2. turn those same 500 images into one large map and put that into maptool
the question is: which one option takes up more memory!
Thats actually a hard to answer question, but my guestimation is that in most cases 1. takes less memory than 2.
2. can certainly lead to max mem issues as MT needs to free up a large chunk of memory for one object (which is usually slower than lots of small memory allocations for lots of objects).

And since 1. is most likely the best option I get back to the first point: in that case its best to limit the amount of UNIQUE images (or textures or objects or tokens). So use eg 5 different images for a tombstone to build a graveyard. USe 5 trees to build a forest (note that you can rotate them, flip them and resize them, making them look different, even though they remain the same as far as MT is concerned). That method is the best to use in maptool.
Beyond that its usually wise to cut up large maps into chunks and use e.g. teleports to swap between the maps, but is you limit the total amount of unique images you can build a pretty large map without issue!

hth!

User avatar
jfrazierjr
Deity
Posts: 5176
Joined: Tue Sep 11, 2007 7:31 pm

Re: Converting objects into pixels

Post by jfrazierjr »

Kjertvald wrote: If on the other hand, I am a lazy artist and I drag immages onto the map, it is a different thing entirely.
By dragging an immage onto the map, I create an object in the software for each immage i put into the map. because of the way the software is programmed, each object automatically gets alot of information attached to it. Simply put, the information is things like:
coordinates on the map
if you click it, it will be selected.
if you drag it, it will change coordinates.
if you right click it, you will be given a list of options ,which in turn are all new pieces of information
The note boxes
the text writen in the note boxes
the status of his object in terms of DnD rules
who controlls this object
does it have vision

This is an incorrect assumption. Perhaps you did not read my post or did not understand it. Let's say you place down 10,000 distinct "tree" objects. When I say distinct, I mean each "tree" is 100% distinct from each other, on your computer, you have 10,000 individual tree images such as tree1.jpg, tree2.jpg, tree3.jpg, etc, etc etc.

That is approach A....

NOW, approach B, you place into your map 10,000 tree objects, but each tree object you place into Maptool comes from the same source image on your hard drive. In this case, your hard drive has exactly ONE tree image file named tree.jpg.

The former would take an INCREDIBLY large amount of memory than the latter. When you re-use an image that is already on the map, the image itself is cached, so that bit of overhead is already loaded in memory. Then the object has to have some overhead to deal with "where are you located, how large are you scaled too, etc".

Kjertvald wrote:If this is not possible, I ask if there is any other way of reducing the information stored in the objects. By this I mean, can you remove the most unnecessary pieces of code attached to the objects, like note boxes, vision, rule-related things, etc., essentially leaving only the projection of the object and its positioning on the map?
No, token objects are token objects. They have to have all that extra stuff you don't want them to have, at least in the short-mid term(meaning likely "years" into the future.)

The correct and only solution is for you to adapt your process here and that is to either a) deal with more memory overhead(install more ram) OR b) fire up GIMP or some other image application, make a bitmap image of your forest or whatever, save it and then use that in maptool, PREFERABLY large scale image areas should be set to a background image and you could then have a MASSIVE forest or c) use multiple maps and don't overload any of them with too much crap.
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..

Kjertvald
Kobold
Posts: 10
Joined: Mon May 01, 2017 8:28 am

Re: Converting objects into pixels

Post by Kjertvald »

Thank you for excellent answers, although they spell doom upon my plans.

This seems counterintuitive to me, probably because of my limited knowledge on programming.

But it does bring a thought to my mind:

What if i only ever put in tiny pixel-sized immages into my map, which each only was a fill of basic color.
This would mean I could make the map with like 10-20 immages, but I guess there would be billions of each. The tiny immages would combine to create larger patterns that look like objects.
Would this be more memory-economical?
Would the very large number of uses of each immage
Use more memory than if i only had one large immage?

I guess this is kind of what would be done if you would use the draw-tool with basic colors and spend many years drawing a map of the samebdetail as a larger immage?

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

Re: Converting objects into pixels

Post by Full Bleed »

Kjertvald wrote:This seems counterintuitive to me, probably because of my limited knowledge on programming.
This is the crust of your confusion. You're really not up on what pixels are, what a digital image is, and how they affect memory.
What if i only ever put in tiny pixel-sized immages into my map, which each only was a fill of basic color.
A pixel is a single color digital square. It, by itself, is not an "image". An image is a collection of pixels (blocks) that when placed together produces something that looks like something.

So, there is no such thing as a "pixel-sized" image. There are images made with 10 pixels or images made of 10,000 pixels, or millions of pixels, etc. But a single pixel is just a block. You can point at that block and call it car if you want, but it won't look like a car.

You need to think of pixels as something like legos (though there is only *one* size and shape (square)). If you want to make something that looks like something with those legos you have to keep adding legos until it looks like what you're trying to build. In doing so, you're adding more legos and it's "costing" for each one... the size of what you're building is getting bigger. If I give you 1 lego and say, "Make a tree out of this" you're going to look at me like I'm an idiot. You can't do it. If I give you 10 legos, you might be able to make something similar to a tree, but it won't look as good as if I give you 100 or 1000 legos to work with.

Read this: http://www.ultimate-photo-tips.com/what-is-a-pixel.html
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

Kjertvald
Kobold
Posts: 10
Joined: Mon May 01, 2017 8:28 am

Re: Converting objects into pixels

Post by Kjertvald »

Yes, I know I've been using some words incorrectly.
If you read "tiny monocolored square" when i write pixel, most things i have written should be closer to correct i guess. I just wanted to use a single word instead of a sentance every time.

I am aware that a digital immage is built of tiny blocks to make up the whole and all that. This is the basis in my most recent hypothetical question. I am trying to explore the limits of the software.
If it is less memory-heavy to use several copies of the same few immages, what happens when the number of immages move towards infinity. Intuitivly, memory usage moves toward infinity, but this contradicts the initiating statement: one big immage uses more memory than several copies of several smaller immages. there should be an optimal point where the balance between the size and number of immages minimize memory usage.

I dont know much about memory usage which is why I am asking you guys these weird questions. :p

I am grateful that you guys are still answering. I half expected everyone just to say "you make no sence, go away".

I know i could read alot of texts and learn the fundamental stuff for this topic, but I don't feel like it because I don't have alot of time to spare and I enjoy this discussion alot more.

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

Re: Converting objects into pixels

Post by wolph42 »

lets make an analogy.

Lets say that computer memory is the same as the weight of ink and ink-stamps. The ink stamp you have shows a seamless (that means that if you put two of them next to each other you do not see the border) grass field image. Lets also assume that the stamp weighs 1 kg (1 Mb of memory) and using it leaves 1g (1 Kb of memory) of ink (let's call that an "ink-unit").

Now we have a white wall (your monitor) which is 100 stamps wide and 50 stamps high (So 5000 stamps surface). Now we want to fill that wall with a grassfield (just like in Maptool). roughly there are 3 methods:

1. we create one individual stamps for each ink-unit on the wall. So we end up with 5000 stamps and 5000 ink-units on the wall. Total impact on wall/system: 5005kg or 5005Mb (5Gb)

2. we use one stamp to stamp the entire wall. This costs 1kg + the weight of 5000 ink-units = 5kg of ink (5Mb of memory). Total impact on system: 6kg or 6Mb

3. (This is what you are suggesting:) we create one HUGE stamp and we stamp the wall with that, now guess what the impact is? Correct: 5005kg or 5000Mb. Moreover, your system must be ABLE to handle such a huge stamp. Java frees up memory to handle each single stamp and its much easier to free up 5000 small units then one HUGE unit.

Now when you talk of going to 'infinity' I'm guessing your talking about the fact that MT grassfield IS infinite! And according to the above analogy even though only 1 stamp is used, you would require an infinite amount of ink! This is where MT is smart. (Now im going to oversimplify things:) It ONLY stamps that which you are looking at aka 'viewport'. And as your 'viewport' or 'monitor' or 'wall' is 5000 stamps large, it will always only cost 5kg (5mb) of ink. HOWEVER MT *does* need to keep ALL stamps into memory (else it can't use it) so ALL the stamps you use to paint the map (not the wall but the map) count up to the total weight of impact on your system. This is why MT can show an 'infinite' map.

Kjertvald
Kobold
Posts: 10
Joined: Mon May 01, 2017 8:28 am

Re: Converting objects into pixels

Post by Kjertvald »

Cool stuff!

There is one thing confusing me though:
If I dont import any immages into MT and only use the draw-tool in MT, using 10 different colors, would this mean I have one big 'stamp' ?
I was under the impression that I would have 10 'stamps' which I use many times. The number of uses of each stamp would depend on the level of detail I draw.
If this is correct, would it not be the most efficient way of memory use? (Given that I dont draw much detail)

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

Re: Converting objects into pixels

Post by wolph42 »

no, to keep the analogy: if you have one stamp you can also 'paint' with it (quite literally) and as you say, the stamp can be of one color in which case it would be very very very light (couple of grams/bytes). So painting with 10 colors means you're using 10 very light stamps and using them on the map means you're using ink which weighs on the memory. Painting a big picture with it will mean you will be using a lot of ink and yes if you use enough ink to paint then eventually it will take up a lot of memory.
Where the analogy goes wrong is that with a repeating texture the pc doesn't really need to remember much, just the stamp and the fact that its used repeatedly to fill everything up. When you use it to paint, then the pc needs to rember the path you are painting (and the texture you are using) this costs less memory then a big stamp but more then a simple repeating pattern.

User avatar
Jagged
Great Wyrm
Posts: 1306
Joined: Mon Sep 15, 2008 9:27 am
Location: Bristol, UK

Re: Converting objects into pixels

Post by Jagged »

Kjertvald wrote: If I dont import any immages into MT and only use the draw-tool in MT, using 10 different colors, would this mean I have one big 'stamp' ?
I was under the impression that I would have 10 'stamps' which I use many times. The number of uses of each stamp would depend on the level of detail I draw.
If this is correct, would it not be the most efficient way of memory use? (Given that I dont draw much detail)
Using the Draw Tools in Maptool builds the map in a completely different way to using images. "Generally" speaking maps that are created with just the drawing tools use a lot less memory, but it is also true that maps created with just the drawing tools have a lot less detail.

If using less memory is important to you:
  • Use the drawing tools
  • Use the same image repeatidly as much as you can.
  • Don't use individual views for vision on your server.

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

Re: Converting objects into pixels

Post by Full Bleed »

Jagged wrote: If using less memory is important to you:
Despite being asked multiple times, the OP has still not confirmed what memory settings they are using in the first place. This very well could be a case of the "accidentally using the 256M default" or "32 bit Java when 64 bit would solve most of their problems" issues making them think they've got to be super stingy with how they consume memory...
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

Post Reply

Return to “MapTool”