With such detailed territories, staying under the file size limit can be hard.
I'm pretty sure it can be done, though.
First a few general tips to keep file size low:
- Only draw with the bezier tool (but you've already done this). Straight lines are much better than curves.
- Clone instead of duplicate/copy-paste
- Combine (ctrl-K) everything that can be combined (all visuals that have the same colour can be combined - all the bottoms of the boats, all the bridges, all those dotted lines). Group everything else (ctrl-G)
- If you use duplicates or layers, make sure you haven't accidentally doubled objects without noticing.
Then, there is some clean-up you can do with the file, especially if you've changed a lot of things throughout the process.
-Saving as "plain svg", reopening and then saving as regular svg will sometimes get rid of unnecessary layers.
- Under "File" is the option "Clean up document" (symbol of a little vacuum cleaner), which will get rid of unnecessary meta data and temporary data.
- Under "Edit" - "Inkscape Preferences" - "Input/Output" - "SVG output", play around with the "Numeric precision" value. Depending on your map, you can often lower that number (it minimises the amount of decimals in the svg data).
Lastly, there are quite a few svg-compressors online. I like SVGomg (
https://jakearchibald.github.io/svgomg/) best, since it gives a lot of options.
Be careful, though, because it can mess up your file pretty badly. Be sure to make a few backups, and take some time to try out the settings (don't be discouraged if it messes the file up the first time).
In general you can keep all the options checked except for "rewrite paths" and "cleanup ID's". Play around with the precision slider; there's a fine balance between precision and file size.
Using mostly the above I've gotten a >4MB file down to <2MB, so I'm sure it should work out with yours too.
If you're really desperate, you can also send me the file and I'll see if I can get it to behave.
Good luck!
---
I think I can answer the questions you had too:
But I wonder why the maximum size is 2 MB. Why can't it be more?
Because the game needs to be available to everyone, even those with shitty computers and ten-year-old phones. Compressed maps of 2MB can already be tough for a lot of devices; anything bigger would be unplayable for a lot of people.
Something really weird is now that I have simplified about 100 territories, the size of the map got larger. Any possible explanation?
Yes, this is why I wouldn't recommend simplifying (ctr-L). When simplifying, you'll often see that the amount of nodes decrease, but the remaining lines get curved (Inkscape tries to decrease the nodes but keep the shape). Curved lines are complex. Multiple straight lines < a few curved lines.
Simplify can make things look more smooth, but if you used the bezier tool often increases file size.
BUT, when I remove nothing the file is 3,8 MB. Which means that if I remove the bridges and stuff the size should be 2 MB. Well it was 3,5 MB. I don't get it anymore.
SVG files data isn't just all your objects. It's chock full with metadata, lay-out etc. too. Having said that, 1.8 MB for just your boats and bridges is way too much. I don't know what you've done with it, but there is bound to be redundancies in there. See if you can get it down with everything above; if not, I would love to take a look at it. There's just no way those boats and bridges alone should be 1.8MB.
Edited 2/2/2019 08:14:23