Add images to your maps.

Tutorials and guides for Plazma Burst and community features.

Add images to your maps.

Postby phsc » 25 August 2019, 19:36

I made a quite simple program to allow one to select images from his computer and add it to a PB2 map.

Download: https://www.dropbox.com/s/3t8souejx2kef ... G.exe?dl=0

I am going to explain how it works, and make some observations too.

Spoiler: Show More
1. Activates a dialogue box to select an image, the selected image's location in your computer will appear at 2.
2. Text box where you can put the location of the image you want to add.
3. Activates a dialogue box to select an XML or a txt file, the selected file's location in your computer will appear at 4.
4. Text box where you can put the location of the XML file you want to add.
5. Progression on the X axis for transposing the image.
6. Progression on the Y axis for transposing the image.
7. Inserts the image into the file, 2, 4, 8, 9(impossible to have no value tho), 10, 11 and 12 need to have have some value, if the pixel's size/X position/Y position field(s) is text an error will happen.
8. Pixel size inside the game, as in how you see it, 10 being a single small square in the level editor.
9. Background, if white(3) it will half the RGB/HEX values because white background mulitiplies such value by two, so it is able to look natural.
10. X position where it will start.
11. Y position where it will start.
12. Door it will be attached to, #door*1 as example.
13. Runs the program but verifies for the alpha values, it will theoretically be slower than 7 but if alpha isn't 255, it will add no background, allowing people to remove parts from images and only add what is necessary.
14. Place where the selected image will appear.
15. Place where the selected image will appear after it has been inserted into the game file.

Observations:
Background white will divine the RGB/HEX value by 2, because the white background multiplies it by two.
You can input not valid values such as text for the pixel size field, but it will simply have an error to occur.
If the image is too big, it might take a very long time for it to process, if not crashing at all.
The program might stop working with big images, but the process is still going on.
Time for inserting and image purely depends on your machines capacity.
Added images can be extremely heavy.
It will always go from top to bottom and left to right when adding an image.
Only works with XML/txt files, does not work with pb2map files.

Any doubts let me know, use can be to simply add images for previews or whatever, or as sprites or textures, but it can get extremely laggy if the image is big.

Examples of what can be done:
Spoiler: Show More



I'm not a communist, it was just an image file I had in my computer and wanted to test it with.



Any problems let me know.

Edits:
Spoiler: Show More
1. Added an example made by darkstar.
2. Fixed the example made by darkstar.
3. Added the preview example.
User avatar
phsc
Noir Lime [600]
 
Posts: 694
Joined: 27 July 2013, 13:58
Location: Brazil

Re: Add images to your maps.

Postby boom5 » 30 August 2019, 02:51

So im getting lots of programs not responsive and stuff just running slow. Is there any way to fix this?
https://imgur.com/hEzoLH1
“Guard with jealous attention the public liberty. Suspect everyone who approaches that jewel. Unfortunately, nothing will preserve it but downright force. Whenever you give up that force, you are inevitably ruined.” - Patrick Henry
User avatar
boom5
Usurpation Soldier [50]
 
Posts: 97
Joined: 11 August 2014, 17:09

Re: Add images to your maps.

Postby phsc » 30 August 2019, 04:14

So let me explain to you how it works, there are two loops, one for the X axis and one for the Y axis, I go by every single pixel putting them as additional text into the XML file, that works quite well, a 500px image is 250000 times, but a high resolution image, such as a 2000px image, is 4000000, you see, after a specific amount of time if a program does not respond with any action, it will go to that mode, but it is still running, the while loops are still running and they might end, just wait a little bit, it uses a lot of memory because well, it is a lot of work to be done, I am unsure about how to optimize what I am doing, tried a few other methods but they are even slower, the only thing to do is to wait, I would recommend resizing a very high resolution image to a smaller one, because even after it processes, ingame it will lag a lot, because for a 2000px image there are going to be 4000000 backgrounds, one for each pixel, I believe that after a certain point you are not even able to save the map, or load them since error 1502 will happen, so lower the resolution for big images, may I mention that it uses the most allowed for the program to use memory-wise for it to go fast, and speed completely depends on how good your computer is, mostly your processor.
User avatar
phsc
Noir Lime [600]
 
Posts: 694
Joined: 27 July 2013, 13:58
Location: Brazil

Re: Add images to your maps.

Postby MLG COOL DOMINIK » 5 September 2019, 19:56

phsc wrote:So let me explain to you how it works, there are two loops, one for the X axis and one for the Y axis, I go by every single pixel putting them as additional text into the XML file, that works quite well, a 500px image is 250000 times, but a high resolution image, such as a 2000px image, is 4000000, you see, after a specific amount of time if a program does not respond with any action, it will go to that mode, but it is still running, the while loops are still running and they might end, just wait a little bit, it uses a lot of memory because well, it is a lot of work to be done, I am unsure about how to optimize what I am doing, tried a few other methods but they are even slower, the only thing to do is to wait, I would recommend resizing a very high resolution image to a smaller one, because even after it processes, ingame it will lag a lot, because for a 2000px image there are going to be 4000000 backgrounds, one for each pixel, I believe that after a certain point you are not even able to save the map, or load them since error 1502 will happen, so lower the resolution for big images, may I mention that it uses the most allowed for the program to use memory-wise for it to go fast, and speed completely depends on how good your computer is, mostly your processor.

Well that explains why trying to import an image makes the program lag
Nobody actually plays this game now, do they?
User avatar
MLG COOL DOMINIK
Civil Security Heavy [300]
 
Posts: 348
Joined: 25 June 2016, 21:39


Return to Tutorials

Who is online

Users browsing this forum: No registered users