MercifulNinja Posted April 5, 2017 Share Posted April 5, 2017 (edited) Im going to be using an image to encode game data for my world map. The basic gist is i will have 4 layers. One layer only using red channel, one for blue, one for green, and one for alpha (using black as the base color). I need to be able to merge the 4 layers into a single argb image without distorting each pixels values. So when i look at the final image the red, green, blue, and alpha channels of any given pixel match exactly to the corresponding pixels on each layer. Take the red value from the red layer(where gba are ignored), green value from green layer (rba ignored), blue value from blue channel (rga ignored), and the alpha value from the alpha/black channel (rgb ignored). I hope this makes sense. My main concern is that for editing purposes the alpha value on the rgb layers will need to be opaque so i can see them clearly but the final alpha value must come from only the black/alpha layer. Any thoughts on the layer stack order and blend modes of each layer would be much appreciated and a huge headache and time saver. Thanks in advance. Edited April 5, 2017 by MercifulNinja Quote Link to comment Share on other sites More sharing options...
MercifulNinja Posted April 5, 2017 Author Share Posted April 5, 2017 Ok so I've decided to use the Green Layer for two of my data values and get rid of the need for the alpha Channel period so I'll only be using a red green and blue layer and then merging them down to one image. I would like to know if I'm thinking in the right direction with using the addition blend mode period because my thought is that if 2 out of 3 values on each layer are 0 then the addition blend will result in a conposit color with the correct rgb values from each layer. please correct me if I'm wrong. Thanks in advance Quote Link to comment Share on other sites More sharing options...
MJW Posted April 5, 2017 Share Posted April 5, 2017 I don't quite understand how you intend to use the green layer for two different values. What you could do is have R, G, and B layers, and a grey-scale layer for alpha. You could merge the R, G, and B layers using Additive blending, then copy the grey layer to the clipboard, and merge it into the color layer using BoltBait's Paste Alpha plugin to paste the gray as alpha. That's not as convenient as just merging layers, but unfortunately there's no way of merging that will just transfer the alpha value. Quote Link to comment Share on other sites More sharing options...
MercifulNinja Posted April 5, 2017 Author Share Posted April 5, 2017 (edited) Sorry not 2 values for green. I meant use the greens value for 2 things in my game. Green is terrain type and i realized i could use it for movement speed adjustment as well as dungeon spawn locations. Thereby removing the need for the alpha channel altogether. So everything can be opaque rather than having transparency to represent the movement speed adjustments. I figured the issue was the alpha and pondered my design a bit. Thanks for the reply. So i was right in thinking additive for taking a R,0,0 layer and a 0,B,0 layer and a 0,0,G layer to flatten into a single RGB value without changing the actual values? If thats the case then problem solved Edited April 5, 2017 by MercifulNinja Quote Link to comment Share on other sites More sharing options...
MJW Posted April 5, 2017 Share Posted April 5, 2017 27 minutes ago, MercifulNinja said: So i was right in thinking additive for taking a R,0,0 layer and a 0,B,0 layer and a 0,0,G layer to flatten into a single RGB value without changing the actual values? Yes, that should work. Quote Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted April 5, 2017 Share Posted April 5, 2017 I'm also working on some world maps (for an RPG). What I've done is used entire layers to encode/save the information. One layer is topography, another is rainfall, a third is vegetation, towns & cities, travel routes, etc.., I'm up to seven layers and I'm still finding things to add (religion, political regions, races....). Your idea of using the channels is difficult to expand (more channels are not available) limited in its ability to edit the channels individually I strongly urge you to consider using layers and not channels. If I wish to change the rainfall - I simply edit the rainfall layer. Easy. Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
Ketenks Posted April 5, 2017 Share Posted April 5, 2017 1 hour ago, Ego Eram Reputo said: I strongly urge you to consider using layers and not channels. If I wish to change the rainfall - I simply edit the rainfall layer. Easy. I second and third this motion. I still can't understand how you are using the channels to do what you're doing. Layering is great. 1 hour ago, Ego Eram Reputo said: Also, ERR I snagged that Gossamer and actually just the whole plugin pack, because I'm going to be doing this very thing on a card game I've been working on! So thanks. Quote Link to comment Share on other sites More sharing options...
MercifulNinja Posted April 6, 2017 Author Share Posted April 6, 2017 Everything else from towns, politics, and so on is stored in an xml file. Which will eventually have a mini editor to manipulate. The only things i am using the data image for are thing relative to the players position on the world map. I wont need to expand the structure of the image. I only need to grabthe pixel from the image at the players position when moving, foraging, or at the time of a random encounter. Weather has no impact on my game as most of the gameplay is done in menus or when dungeon crawling. Thank you for the feedback though Quote Link to comment Share on other sites More sharing options...
MercifulNinja Posted April 6, 2017 Author Share Posted April 6, 2017 I am curious on the topic of layers and the pdn format. From what i gather it utilizes the .net framework for a lot of the saving and loading details. Are there any descriptive tutorials or documentation on the file format? My game is written for mobile using java and libgdx. The libgdx forums are telling me to load the image, parse the data, and store the information in a custom format rather than leaving it in a texture. Im guessing its due to the memory limits of the gpu on mobile devices. Which is odd considering the texure should be stored in ram after loading and is never drawn so it shouldnt be in the gpu, but i digress. So if i need to write a custom loader could i not just parse the layer info from a native pdn file. Keep in mind im having to use paint.net due to the free factor. And have not had time to delve into all of its features. Any thoughts? Quote Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted April 6, 2017 Share Posted April 6, 2017 The PNG should suffice at that will give you access to the RGBA channels on a per pixel basis. The native PDN format is largely the result of data serialization. I don't recall anything specific having been posted on the format itself. Aside: in my game I'll be using a 32" TV as a secondary monitor. I'll be showing the overland map directly in paint.net where I'll zoom in on the player position. The players get to see the visible structures (local topography, vegetation, towns, rivers and roads). I'll keep the other layers hidden below the visible layer(s). I drag the Layers Window and Colors Window to my (private) primary monitor so I can do color checks on specific layers without the players seeing which layer I'm checking or the result I get. Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
MercifulNinja Posted April 8, 2017 Author Share Posted April 8, 2017 Sounds like your speaking about tabletop dnd stuff. Im referring to mobile game development with libgdx. Quote Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted April 8, 2017 Share Posted April 8, 2017 Correct. Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.