1. Post #1
    Gold Member
    Skyhawk's Avatar
    July 2008
    1,545 Posts
    GM Paint is, you guessed it, MS Paint in GMod. As I was working on a different addon the other day, I found myself wanting a flag for my pirate ship - and I got to thinking, what if, instead of making a new texture and material for the flag, I created something to allow myself and others to draw their own? So I did.

    [release]
    UPDATE: Version 0.77
    Now with no datastream-breaking bugs! (Hopefully :ohdear:)
    Beta Release 0.77

    Mediafire (OUTDATED, 0.76): http://www.mediafire.com/?tdhuzng0ijc

    Now you can show us all your 8-bit works of art.[/release]

    Some feature listings for y'all:

    Primary and Secondary Colors

    Like any good image editing program, GM Paint has primary and secondary color selection. When the editor is open, left clicking on a color in the color selection palette will set it to your primary color, and right clicking will set it to your secondary. This has an advantage not only in ease of selection, but also in less networking in that only an index and not a whole color value has to be sent. You then simply click on a point with your left or right mouse button to set it to the selected color on your massive :ninja: 16x16 resolution canvas. Additionally, you can hit the "Clear" button to set all the pixels on your canvas to your secondary color.

    Editor:
    http://img19.imageshack.us/img19/9687/editorg.png
    File Saving and Loading

    Easy-to-use file saving and loading allows you to keep your grand works of *cough*art*cough* and easily manage it across servers.

    Networking

    Once you're done editing your art, you can hit the Upload button to send it to the server. Once the server has a hold of it, you can spawn paint panels in the 3D world, upon all of which your image will be displayed for everyone to see. Uploading again will replace the image in your panels, and of course there are upload limits to prevent spamming minges. I kept the canvas at a resolution of only 16x16 as stated before because as is, a table of 256 values has to be sent every time you upload an image - I may add an option for daring server owners to increase the resolution later.

    Small Panel
    http://img44.imageshack.us/img44/8900/gmconstruct0021s.jpg
    Text Support (Not yet implemented.)

    In addition to pixel-based art, you will also be able to use text to create signs, perfect for RP and whatnot.

    What can currently be done in place of actual text:
    http://img23.imageshack.us/img23/756/gmconstruct0018.jpg
    Vector Art (Not yet implemented.)

    A feature still in the concept stage, I've been thinking about adding the option to use a "vector canvas," in which instead of specifying the color for every pixel, you would specify points that would be connected and filled to create polygons. This requires much less networking and would allow for "higher resolution" art.

    And since it had to be done:
    http://img23.imageshack.us/img23/509/gmconstruct0020.jpg
    Reply With Quote Edit / Delete Reply United States Show Events Artistic x 21Optimistic x 2Useful x 2Dumb x 1Agree x 1Funny x 1 (list)

  2. Post #2
    SolidusBlack's Avatar
    April 2009
    472 Posts
    Looks good.

    *imagines many swastikas to come
    Reply With Quote Edit / Delete Reply United States Show Events Agree Agree x 16 (list)

  3. Post #3
    Gold Member
    gman_freeman's Avatar
    August 2006
    1,574 Posts
    This could really come in handy!
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Agree Agree x 3 (list)

  4. Post #4
    Gold Member
    Squad's Avatar
    March 2009
    3,365 Posts
    I was about to make something like this, guess you beat me to it. Good work.

    I don't understand the dumb ratings?
    Reply With Quote Edit / Delete Reply United States Show Events Dumb Dumb x 3Late Late x 2 (list)

  5. Post #5
    Gold Member
    Jamie932's Avatar
    July 2008
    2,590 Posts
    Looking foward to this.

  6. Post #6
    likes men
    Python1320's Avatar
    May 2007
    1,717 Posts
    Nice idea, but how's the fps drop if "any"?

  7. Post #7
    Gold Member
    Skyhawk's Avatar
    July 2008
    1,545 Posts
    Nice idea, but how's the fps drop if "any"?
    From my testing so far? Really none with just one or two panels on screen. When 4 or 5 are on screen, there's a tiny drop, but far from anything of significance - and considering I wrote and tested this on such a crappy laptop, that's really saying something. It's doing really simple draw functions actually, just drawing a rectangle for each pixel. And I'm very picky about optimization, so there's hardly any network lag from uploading.

  8. Post #8
    Gold Member
    LimEJET's Avatar
    November 2007
    1,697 Posts
    Awesomeness, now we can make our own battleflags! I've been wanting something like this for a long time, since reskinning and hexing just won't cut it on a server where everyone wants their personal flag as soon as they join -_-

  9. Post #9
    Web developer
    pdkm931's Avatar
    May 2008
    2,704 Posts
    This is awesome :buddy: Gonna download it if it gets to about 64*64 pixels (if possible :3:)

  10. Post #10
    Gold Member
    ToxicJoy's Avatar
    April 2007
    308 Posts
    Make it so you can have transparent pixels.
    Reply With Quote Edit / Delete Reply United States Show Events Agree Agree x 4Dumb Dumb x 1 (list)

  11. Post #11
    moo
    CowThing's Avatar
    November 2006
    4,785 Posts
    This is awesome :buddy: Gonna download it if it gets to about 64*64 pixels (if possible :3:)
    That's a lot, that's the same as 16 of the current size.

  12. Post #12
    Web developer
    pdkm931's Avatar
    May 2008
    2,704 Posts
    Well 32 Pixels than? :frown:
    Reply With Quote Edit / Delete Reply Show Events Dumb Dumb x 1 (list)

  13. Post #13
    nicktelli's Avatar
    July 2005
    89 Posts
    Since everyone thinks I only shit on things when in reality I only bring constructive criticism to terribly made things...

    This is one of the most brilliant addons to GMod... ever. This is right up there with the vmf loader for gmod9 by Jinto.

    Sure it's limiting, but it's still quite ingenious and imaginative and will bring endless hours of fun to mingebags everywhere spamming penises and the like.
    Reply With Quote Edit / Delete Reply United States Show Events Dumb Dumb x 1 (list)

  14. Post #14
    Gold Member
    Entoros's Avatar
    October 2008
    2,318 Posts
    It would be supremely awesome if it functioned in a 16x16x16 cube (you draw by selecting unit cubes). But that's kind of ridiculously difficult. That aside, this is pretty awesome. Good job.

  15. Post #15
    SeveredSkull's Avatar
    October 2008
    1,316 Posts
    I dont really see how that would be difficult... it would just be like 6 panels welded together like a box... I'm sure you could probbably already do it but considering the fact that I have no idea what the code looks like or how it functions so i really have no idea at all on how it would work.

  16. Post #16
    Gold Member
    Skyhawk's Avatar
    July 2008
    1,545 Posts
    Well 32 Pixels than? :frown:
    Well you see, as-is, your image is stored on a per-player basis; not per-panel. So all your panels have the same image - yes it's kinda limiting but it is a LOT less to network and keep in memory. 32x32 pixels would be effectively increasing the networking and memory usage for each player's panel to 4 times its current amount - it's not terrible, but it's a bit more than I'd like, which is why increasing the resolution is a feature I may only add later for daring server owners.

    Also, the idea of the 6-sided cube is possible, but as I said, images are stored on a per-player basis, so your cube would have the same image on every side - might as well just weld them together.

    Oi, and I need to adjust some networking so it'll send info to newly connected players.

    Oh and one last thing, I will be adding dupe support but it will not record the image - it will just use a blank one until you upload the image you want to the server.

  17. Post #17
    Gold Member
    Jawalt's Avatar
    August 2007
    3,478 Posts
    TBH I don't think sending 32 integers to the server and players would be demanding at all.

  18. Post #18
    Gold Member
    Skapocalypse's Avatar
    November 2008
    769 Posts
    Would doing a table not help this? pixels would be

    1| 2 | 3 |4
    5| 6 | 7 |8
    9|10|11|12

    And just have a table entry for each pixel.. ? I haven't looked at the code because I'm on a laptop out of state, but Just a thought :3

  19. Post #19
    Gold Member
    Skyhawk's Avatar
    July 2008
    1,545 Posts
    TBH I don't think sending 32 integers to the server and players would be demanding at all.
    Not 32 integers, a resolution of 32x32 would be 1024. :what-was-the-facepalm-emote-again?:

    about tables
    It already uses table entries. It's a table of 256 values that must be sent to the server and all clients, and be kept in memory for the server and clients, too, so I really don't think a resolution higher than 16x16 is efficient for now. Like I said though, I might bring it up to 32x32 for server owners who want to risk the possible performance drop for them and their clients.

    Personally, I think 16x16 is fine - you can fit a good amount of text or a decent 8-bit-style drawing in there if you know what you're doing, but I will try to do the 32x32 option anyway since it's got such high demand.

    Oh and late response but I will try to add transparent pixels - shouldn't be too hard. There won'd be actual Alpha, but you will be able to set it to not draw a pixel at all.

  20. Post #20
    Gold Member
    Entoros's Avatar
    October 2008
    2,318 Posts
    A cool function would, like in the real MS Paint, would be the "Invert Colors" function. I'm not entirely sure how you flip colors around like MS Paint, but it wouldn't be too hard; just get all the pixels and change their color by pressing a button.

  21. Post #21
    open.gl
    Overv's Avatar
    February 2007
    7,431 Posts
    function flip( col )
            return Color( 255 - col.r, 255 - col.g, 255 - col.b )
    end
    Reply With Quote Edit / Delete Reply Netherlands Show Events Agree Agree x 1 (list)

  22. Post #22
    Gold Member
    Jawalt's Avatar
    August 2007
    3,478 Posts
    Not 32 integers, a resolution of 32x32 would be 1024. :what-was-the-facepalm-emote-again?:
    Even so, consider that every chat message sends on average ~60 string characters. :what-was-the-facepalm-emote-again?:

    Sending 1024 integers to the server then to all the clients would not be a big deal, I don't think. Considering that a serverside Youtube player can play at like 1/4th speed and sends alot more information than that.

  23. Post #23
    moo
    CowThing's Avatar
    November 2006
    4,785 Posts
    I think having the vector option would be better than 32x32 pixels anyways.
    Reply With Quote Edit / Delete Reply United States Show Events Agree Agree x 1 (list)

  24. Post #24
    Gold Member
    Skyhawk's Avatar
    July 2008
    1,545 Posts
    function flip( col )
            return Color( 255 - col.r, 255 - col.g, 255 - col.b )
    end
    Unfortunately, as I said, to reduce networking the colors are not stored as Color values but indexes matching up to a palette. So that wouldn't quite work, nor would color flipping really be possible (or necessary?)

    Wow, rating glitches are getting annoying.

  25. Post #25
    open.gl
    Overv's Avatar
    February 2007
    7,431 Posts
    Then you inverse the pallet, seems pretty obvious.
    Reply With Quote Edit / Delete Reply Netherlands Show Events Friendly Friendly x 1 (list)

  26. Post #26
    Gold Member
    Skyhawk's Avatar
    July 2008
    1,545 Posts
    Then you inverse the pallet, seems pretty obvious.
    Well yes, but it wouldn't match up quite right. (i.e. inversing blue would get you yellow normally, but not necessarily on the palette since the colors aren't in too particular of an order)

  27. Post #27
    open.gl
    Overv's Avatar
    February 2007
    7,431 Posts
    I don't think we're understanding each other. On the palette you have your colors defined with RGB values and indices right?

  28. Post #28
    Gold Member
    Skyhawk's Avatar
    July 2008
    1,545 Posts
    I don't think we're understanding each other. On the palette you have your colors defined with RGB values and indices right?
    Code:
    local palette = {Color(0,0,0), Color (245, 125, 50), Color (60, 60, 60), Color (50, 125, 50)}
    Not those actual colors but that's how it works. Flipping the indexes (i.e. flipping 1 to 16, 12 to 4, etc.) would work but visually you wouldn't have the actual opposite of the color. As far as going through the palette and actually flipping the values it contains would be possible but it would require another Networked Integer and more crap the client would have to deal with when drawing (recreating the palette inversed for just clients that have it inversed) It would also mean you are flipping all your palette colors and not just inversing the colors to others on the palette. I suppose it could be done but I really don't see why it would be necessary.

  29. Post #29
    open.gl
    Overv's Avatar
    February 2007
    7,431 Posts
    You only need one user message to flip the values, it can all be done on the client.

  30. Post #30
    Gold Member
    Skyhawk's Avatar
    July 2008
    1,545 Posts
    You only need one user message to flip the values, it can all be done on the client.
    Well yes, that or a networked variable, doesn't really matter, but the point is it's not really useful as it's not expanding the client's palette and it's not just flipping the existing colors as you would use it in MS Paint. I don't know, I might add it anyway later.

  31. Post #31
    Gold Member

    June 2007
    5,036 Posts
    I love it. I'd like to see cube mapping, like you draw something and it gets applied to all 6 sides of the cube.

  32. Post #32
    Gold Member
    Skyhawk's Avatar
    July 2008
    1,545 Posts
    I love it. I'd like to see cube mapping, like you draw something and it gets applied to all 6 sides of the cube.
    Might as well just weld 6 together. I could make a function to automatically create a cube of six of them lined up properly and whatnot, but chances are most servers aren't going to want you to have 6 panels :frown:

  33. Post #33
    open.gl
    Overv's Avatar
    February 2007
    7,431 Posts
    Well yes, that or a networked variable, doesn't really matter, but the point is it's not really useful as it's not expanding the client's palette and it's not just flipping the existing colors as you would use it in MS Paint. I don't know, I might add it anyway later.
    Alright, let's break it down.

    Reply With Quote Edit / Delete Reply Netherlands Show Events Friendly Friendly x 2Agree Agree x 2 (list)

  34. Post #34
    Web developer
    pdkm931's Avatar
    May 2008
    2,704 Posts
    Not 32 integers, a resolution of 32x32 would be 1024. :what-was-the-facepalm-emote-again?
    I meant a total of 32 pixels. Not 32*32 :ughh:

    Edited:

    Meh, no facepalm emot for me :frown:

  35. Post #35
    Gold Member
    Skyhawk's Avatar
    July 2008
    1,545 Posts
    Alright, let's break it down.
    <an image>
    Yes, I get that. I just don't see a point in having it. I'll probably add it at some point later.

    I meant a total of 32 pixels. Not 32*32 :ughh:
    32 does not have a square root so... no.

    Edited:

    [release]Okedokey, beta release 0.75 is here:

    Mediafire: http://www.mediafire.com/?btzmwg3lmkm

    Garrysmod.Org:

    Please keep in mind I have not yet tested all the network functionality - I am confident in my knowledge of networking and my coding ability but I can't be sure, I need you guys to bug test for me since I don't have a server available! If anyone would like to host an unofficial beta launch and testing party I wouldn't mind an invite
    [/release]

  36. Post #36
    Web developer
    pdkm931's Avatar
    May 2008
    2,704 Posts
    32 does not have a square root so... no.
    Shall you then have them by the size of:
    Code:
    4*4
    9*9
    16*16
    25*25
    36*36
    49*49
    64*64
    81*81
    100*100
    121*121
    etc*etc
    Then?

    :confused:

  37. Post #37
    Gold Member
    Skyhawk's Avatar
    July 2008
    1,545 Posts
    more stuff
    :confused:
    http://img22.imageshack.us/img22/3341/facepalmpng.png
    I don't think you get it. The current system requires that the panel be square, ok? That means the height and width must be the same. A resolution of 32x32 is possible, because your total number of pixels from that is 1024, which has a square root of, you guessed it, 32 (hence the whole 32 times 32 thing.) A resolution with 32 total pixels is not possible, because the square root of 32 is 5.6, and you can't have less than a whole pixel.

  38. Post #38
    Gold Member
    Jawalt's Avatar
    August 2007
    3,478 Posts
    You are severely overestimating network traffic. Try sending a table of 1024 integer values, it won't be a big deal.

  39. Post #39
    Gold Member
    Skyhawk's Avatar
    July 2008
    1,545 Posts
    You are severely overestimating network traffic. Try sending a table of 1024 integer values, it won't be a big deal.
    Eh, I'll add the higher resolution option in the next release. I just figured tables of 1024 values to the server, then to every client and storing that in memory on each client for every client might be a bit excessive.

    Oh and the collision is kinda fucked in the smallest size option, I'll fix that later.

  40. Post #40
    Gold Member
    Jawalt's Avatar
    August 2007
    3,478 Posts
    Eh, I'll add the higher resolution option in the next release. I just figured tables of 1024 values to the server, then to every client and storing that in memory on each client for every client might be a bit excessive.

    Oh and the collision is kinda fucked in the smallest size option, I'll fix that later.
    1024 integers is like, a kilobyte tops, and if it's not going to be used any longer it'd get garbage collected.