Welcome, Guest. Please Login or Register.  • Help
SMF Underground
+ SHMUP-DEV » SHMUP DEV FORUMS » Game Design » SHmUP Utilities and SDK's
|-+ Shmup Pixel Craft Generator (or how to create a much BETTER-looking pixel ship!)

Pages: [1]   Go Down
0 Members and 1 Guest are viewing this topic. Topic Tools  
Read February 21, 2008, 03:46:21 pm #0
Adigun A. Polack

Shmup Pixel Craft Generator (or how to create a much BETTER-looking pixel ship!)

Ok people, I AM BACK after a long absence from Shmup-dev... and it is so awesome to be returning indeed after all those months!!!  d=grin2=b !!

Now, I present to you my very first original shmup utility program entitled Shmup Pixel Craft Generator, which is quite the one that can actually generate up to millions upon millions of custom-made ships as well as let you save custom sprite sheets of them, just to really help you get started in your 2d shmup developing... observe!!



Download this program right here (ver. 2008-02-23), please (for those of you logged in, there is also a backup download of this file at the end of this post, in case the first download link fails to work!  wink2 )

Based on such a fascinating Pixel Spaceships tutorial by Dave Bollinger himself, these ships and many more in my shmup utility program are simply created using my own custom algorithm that I have programmed in FreeBASIC v0.18b, as you will see in this sample program code:

Code:
'======================================================================
' P i x e l   C r a f t   D e s i g n e r   ( F r e e B A S I C )
'======================================================================
' For 8-bit color modes.   The special custom version for 15- to 32-bit
' color graphics modes is gonna be built-in EXCLUSIVELY into the new
' AFlib2 Remixed!!!
'
' Presented by Adigun Azikiwe Polack.
' (c)2008 Adigun Azikiwe Polack.  All Rights Reserved.
'======================================================================


Declare Sub GeneratePalette_Rel

Declare Sub MakeGradient ( Byval startcol as Integer, _
                           Byval r1 as Integer, Byval g1 as Integer, _
                           Byval b1 as Integer, _
                           Byval endcol as Integer, _
                           Byval r2 as Integer, Byval g2 as Integer, _
                           Byval b2 as Integer)

Declare Sub CreatePixelCraft_256color ( Byval x as integer, _
                                        Byval y as integer, _
                                        Byval ColSpread as integer, _
                                        Byval Size_x as integer, _
                                        Byval Size_y as integer )


Screenres 400, 300, 8, 0, 0

Dim rand as integer
GeneratePalette_Rel

NextPattern:
rand = int(rnd(1)* 155) + 101
Line(0, 0)-(400, 300), 1, bf
For ShipLine_x as Integer = 0 to 28 step 1
  For ShipLine_y as Integer = 0 to 14 step 1
    CreatePixelCraft_256color (ShipLine_x * 20) + 1, (ShipLine_y * 20) + 1, 0, 16, 17
  Next
Next
sleep
IF multikey(&h01) then end else Goto NextPattern




Sub CreatePixelCraft_256color ( Byval x as integer, _
                                Byval y as integer, _
                                Byval ColSpread as integer, _
                                Byval Size_x as integer, _
                                Byval Size_y as integer )
                               
If Size_x > 16 then Size_x = 16
If Size_y > 17 then Size_y = 17

Size_x /= 2
Size_y += 11

x -= 1
y -= 2

Dim as Integer ColRandom, OuterShell, Start

Start = (Size_x + 2)
For Vert as Integer = 0 to Size_y
  Outershell = 1
  If Vert < (Size_y / 2.1) then
    Start -= 1: If Start < 0 then Start = 0
  else
    Start += 2
  End if
  For Horiz as Integer = Start to Size_x
    If OuterShell > 0 then
      If (int(rnd(1) * 70) + (1 + Vert)) > 35 - (Vert \ 2) or Vert = 0 and Horiz = (Size_x) or Horiz = (Size_x - 1) then
        Pset (Horiz + x, Vert + y), 0
        Pset (((Size_x - Horiz) + (Size_x + 1)) + x, Vert + y), 0
        OuterShell = 0
      End if
    Else
      ColRandom = int(rnd(1) * 7) + 1
      ColRandom += 1
      If ColRandom > 8 then ColRandom = int(rnd(1) * 4) + int(rnd(1) * 4)
      Select Case as const ColRandom
        Case 1:
          Pset (Horiz + x, Vert + y), 23 + (Colspread * 16)
          Pset (((Size_x - Horiz) + (Size_x + 1)) + x, Vert + y), 19 + (Colspread * 16)
        Case 2:
          Pset (Horiz + x, Vert + y), 24 + (Colspread * 16)
          Pset (((Size_x - Horiz) + (Size_x + 1)) + x, Vert + y), 20 + (Colspread * 16)
        Case 3:
          Pset (Horiz + x, Vert + y), 25 + (Colspread * 16)
          Pset (((Size_x - Horiz) + (Size_x + 1)) + x, Vert + y), 21 + (Colspread * 16)
        Case 4:
          Pset (Horiz + x, Vert + y), 26 + (Colspread * 16)
          Pset (((Size_x - Horiz) + (Size_x + 1)) + x, Vert + y), 22 + (Colspread * 16)
        Case 5:
          Pset (Horiz + x, Vert + y), 28 + (Colspread * 16)
          Pset (((Size_x - Horiz) + (Size_x + 1)) + x, Vert + y), 24 + (Colspread * 16)
        Case 6:
          Pset (Horiz + x, Vert + y), 31 + (Colspread * 16)
          Pset (((Size_x - Horiz) + (Size_x + 1)) + x, Vert + y), 27 + (Colspread * 16)
        Case 7:
          Pset (Horiz + x, Vert + y), 29 + (Colspread * 16)
          Pset (((Size_x - Horiz) + (Size_x + 1)) + x, Vert + y), 25 + (Colspread * 16)
        Case 8:
          Pset (Horiz + x, Vert + y), 0 + (Colspread * 16)
          Pset (((Size_x - Horiz) + (Size_x + 1)) + x, Vert + y), 0 + (Colspread * 16)
      End Select
    End if
  Next
Next

End Sub



'_________________________________________________________________________
Sub GeneratePalette_Rel

'Special thanks to Richard Eric M. Lope (Relsoft) for his classic 256-color
'palette which inspired me to do this exact custom emulation of this one
'indeed!!!  ^-^=b !

Dim as Integer SetupPalette, PaletteArrange
Dim as Single RGBchannel(1 to 3), Channel_Target, PalSet

Palette
For SetupPalette = 0 to 15 step 1
  Select Case as Const SetupPalette
    Case 0: Channel_Target = 0
    Case 1: Channel_Target = 5
    Case 2: Channel_Target = 8
    Case 3: Channel_Target = 11
    Case 4: Channel_Target = 14
    Case 5: Channel_Target = 17
    Case 6: Channel_Target = 20
    Case 7: Channel_Target = 24
    Case 8: Channel_Target = 28
    Case 9: Channel_Target = 32
    Case 10: Channel_Target = 36
    Case 11: Channel_Target = 40
    Case 12: Channel_Target = 45
    Case 13: Channel_Target = 50
    Case 14: Channel_Target = 56
    Case 15: Channel_Target = 63
  End Select
  For PalSet = 1 to 3
    RGBchannel(PalSet) = Channel_Target
  Next
  Palette 16 + SetupPalette, RGBchannel(1) + (256 * RGBchannel(2)) + (65536 * RGBchannel(3))
Next
For PaletteArrange = 2 to 15 step 1
  For SetupPalette = 0 to 15 step 1
    Select Case as Const SetupPalette
      Case 0: Channel_Target = 0
      Case 1: Channel_Target = 4
      Case 2: Channel_Target = 8
      Case 3: Channel_Target = 12
      Case 4: Channel_Target = 16
      Case 5: Channel_Target = 21
      Case 6: Channel_Target = 25
      Case 7: Channel_Target = 29
      Case 8: Channel_Target = 33
      Case 9: Channel_Target = 37
      Case 10: Channel_Target = 42
      Case 11: Channel_Target = 46
      Case 12: Channel_Target = 50
      Case 13: Channel_Target = 54
      Case 14: Channel_Target = 58
      Case 15: Channel_Target = 63
    End Select
    Select Case as Const PaletteArrange
      Case 2:
        RGBchannel(1) = Channel_Target
        RGBchannel(2) = 0
        RGBchannel(3) = 0
      Case 3:
        RGBchannel(1) = 0
        RGBchannel(2) = 0
        RGBchannel(3) = Channel_Target
      Case 4:
        RGBchannel(1) = 0
        RGBchannel(2) = Channel_Target
        RGBchannel(3) = 0
      Case 5:
        RGBchannel(1) = Channel_Target
        RGBchannel(2) = 0
        RGBchannel(3) = Channel_Target
      Case 6:
        RGBchannel(1) = 0
        RGBchannel(2) = Channel_Target
        RGBchannel(3) = Channel_Target
      Case 7:
        RGBchannel(1) = Channel_Target
        RGBchannel(2) = Channel_Target
        RGBchannel(3) = 0
      Case 8:
        RGBchannel(1) = Channel_Target
        RGBchannel(2) = int(Channel_Target / 2)
        RGBchannel(3) = 0
      Case 9:
        RGBchannel(1) = Channel_Target
        RGBchannel(2) = 0
        RGBchannel(3) = int(Channel_Target / 2)
      Case 10:
        RGBchannel(1) = 0
        RGBchannel(2) = int(Channel_Target / 2)
        RGBchannel(3) = Channel_Target
      Case 11:
        RGBchannel(1) = Channel_Target
        RGBchannel(2) = int(Channel_Target / 1.5)
        RGBchannel(3) = int(Channel_Target / 2)
      Case 12:
        RGBchannel(1) = Channel_Target
        RGBchannel(2) = int(Channel_Target / 2)
        RGBchannel(3) = int(Channel_Target / 2)
      Case 13:
        RGBchannel(1) = int(Channel_Target / 1.4)
        RGBchannel(2) = int(Channel_Target / 2)
        RGBchannel(3) = 0
      Case 14:
        RGBchannel(1) = 0
        RGBchannel(2) = 0
        RGBchannel(3) = 0
      Case 15:
        RGBchannel(1) = (int(Channel_Target / 2) + 32)
        RGBchannel(2) = Channel_Target
        RGBchannel(3) = 0
    End Select
    Palette (PaletteArrange * 16) + SetupPalette, RGBchannel(1) + (256 * RGBchannel(2)) + (65536 * RGBchannel(3))
  Next
Next

End Sub



'_________________________________________________________________________
Sub MakeGradient (Byval startcol as Integer, _
                  Byval r1 as Integer, Byval g1 as Integer, _
                  Byval b1 as Integer, _
                  Byval endcol as Integer, _
                  Byval r2 as Integer, Byval g2 as Integer, _
                  Byval b2 as Integer)

'This command makes a gradient color by interpolating the RGB values of
'the first color index (startcol) and the second (endcol) by the number of
'colors.

Dim as Single R, G, B
Dim as Single Rstep, Gstep, Bstep
Dim as Single col, cols

If r1 <= -24 then r1 = -24
If g1 <= -24 then g1 = -24
If b1 <= -24 then b1 = -24
If r2 <= -24 then r2 = -24
If g2 <= -24 then g2 = -24
If b2 <= -24 then b2 = -24

If r1 >= 63 then r1 = 63
If g1 >= 63 then g1 = 63
If b1 >= 63 then b1 = 63
If r2 >= 63 then r2 = 63
If g2 >= 63 then g2 = 63
If b2 >= 63 then b2 = 63

If startcol > endcol then
  Swap endcol, startcol
  Swap r2, r1
  Swap g2, g1
  Swap b2, b1
End if

R = r1
G = g1
B = b1
cols = (endcol - startcol + 1)
Rstep = (r2 - r1 + 1) / cols
Gstep = (g2 - g1 + 1) / cols
Bstep = (b2 - b1 + 1) / cols
For col = startcol TO endcol
  R = R + Rstep
  G = G + Gstep
  B = B + Bstep
  If R > 63 then R = 63
  If R < 0 then R = 0
  If G > 63 then G = 63
  If G < 0 then G = 0
  If B > 63 then B = 63
  If B < 0 then B = 0
  Palette col, (65536 * (fix(B)) + (256 * fix(G)) + fix(R))
Next col

End Sub

This code will work under FreeBASIC v0.17b or a higher version of it.  You can get FreeBASIC beginning at www.freebasic.net, ok please?

In the meantime, I have NOT forgotten about Native Legend Shorakee at all, the very first Native American shmup that I am currently hard at work on in the purest style of a Cave arcade shmup (yep, I am sure some of you remember might remember my compo version of Dragon Dancer, too!!).  Do not miss it!!  cool1=b !

Right now though, please enjoy this wonderfully amazing little work which took me over the course of a couple of days to produce!!!  Thank you!!  Wink !
« Last Edit: February 23, 2008, 06:44:27 am by Adigun A. Polack »
Offline  
Read February 21, 2008, 07:10:10 pm #1
Pixel_Outlaw

Re: Shmup Pixel Craft Generator (or how to create a much BETTER-looking pixel ship!)

Wow really nice program AAP! I've missed seeing you around.

I do have some thoughts you might implement.

Have you considered adding a more curved gradient coloring system? This is hard to put into words but sometimes you can get nice effects from using non linear gradients. You can weight the gradient a bit for different results.

Here you can find an example using logarithms to get from color a to color b. http://www.pixeljoint.com/forum/forum_posts.asp?TID=791&KW=palette

Also it might be nice to have control over the base color and the reflected light color. As it stands now it just goes from a base color to white. With coltroll over the base color and the reflected light color you could get some nice results like green to a light yellow.

Also it might be nice to have a single ship exporter. And a way to save the current project.

« Last Edit: February 21, 2008, 07:49:24 pm by Pixel_Outlaw »


Aviator sunglasses are pretty much the shmups of the sunglasses world.
Offline  
Read February 22, 2008, 01:18:02 am #2
berilium

Re: Shmup Pixel Craft Generator (or how to create a much BETTER-looking pixel sh

Hey man! That's pretty awesome! I didn't know about the original work until I read an entry in the2bears' blog. Seen some implementations, your's really cool though (downloding). Just a question, can the background be changed to a constant color, say, to make them sprites with transparency?

(yep, I am sure some of you remember might remember my compo version of Dragon Dancer, too!!)

Ah I remember that one. The Chinese dragon like...

 Grin
Offline  
Read February 23, 2008, 06:57:10 am #3
Adigun A. Polack

Re: Shmup Pixel Craft Generator (or how to create a much BETTER-looking pixel ship!)

Pixel_Outlaw, I thank you here so richly now, and those are some excellent ideas that I am gonna keep in mind, when I get the chance to.  Wink !  Right now though, I have currently updated the Shmup Pixel Craft Generator, and take a look at these next couple of screens here:



...and as you can see, this update lets users scale his/her own pixel craft up and down a bit, creating bullets, missiles, and even some options to boot!!!  Cheesy

Do not miss this one, as the update to my program which is ver. 2008-02-23 is found on the very first post of this thread, so be sure to pick it up and enjoy!!

Thank you all so very much again, and some constructive/encouraging feedback is most DEFINITELY welcome here!!!  Cool !
Offline  
Read February 23, 2008, 07:52:57 am #4
Pixel_Outlaw

Re: Shmup Pixel Craft Generator (or how to create a much BETTER-looking pixel ship!)

This is VERY cool Adigun. I love how you get an idea and really go for it. Not just ships but options and shots! Neat.



Aviator sunglasses are pretty much the shmups of the sunglasses world.
Offline  
Read February 23, 2008, 09:12:28 am #5
skyy

Re: Shmup Pixel Craft Generator (or how to create a much BETTER-looking pixel sh

Oh ... WOW!
Honestly, I felt like replying but I don't know what to say about this program. Oh jesus, dear lord, this is so awesome.

I wasn't really expecting complex and over the top sprites to be generated but it did still suprise me. You can actually change the size and color of the ships. That's so neat.
Only thing I kinda felt was missing is just a bit bigger ships. Currently it goes to.. hmm.. as high as  18x19? I was kinda hoping to see some sort of boss ships or something, in a size of 50x50 or so but not that I'm complaining. I'm taking what I'm given Cheesy

All in all, great job.
I give it thumbs up!

Offline  
Read February 23, 2008, 10:38:54 am #6
pieslice

Re: Shmup Pixel Craft Generator (or how to create a much BETTER-looking pixel sh

Only thing I kinda felt was missing is just a bit bigger ships. Currently it goes to.. hmm.. as high as  18x19? I was kinda hoping to see some sort of boss ships or something, in a size of 50x50 or so but not that I'm complaining. I'm taking what I'm given Cheesy

At least you can upscale the output ships and use them as a reference when drawing the larger sprites by hand. Just for example, put the upscaled ship to a layer in photoshop and draw the outlines by mimicking the upscaled sprite into another layer and color the result.

Basically same technique as reference images in 3d modeling.

Or even better, remove the outlines when coloring the sprite, as outlined sprites seem to be a plague in amateur-level pixel graphics.

I think this is more useful for references, where the user can detail the output sprites by hand,  as 100% generated ships seem the be a bit - umm... - generic.
« Last Edit: February 23, 2008, 10:40:49 am by pieslice »
Offline  
Read February 23, 2008, 05:05:08 pm #7
Null1024

Re: Shmup Pixel Craft Generator (or how to create a much BETTER-looking pixel ship!)

Quote from: skyy
Only thing I kinda felt was missing is just a bit bigger ships. Currently it goes to.. hmm.. as high as  18x19?

You could use a Scale2x app. (google hq2x.exe), and get a very good, almost directly usable sprite immediately. (run it from the command line like so: "hq2x input.bmp output.bmp")
Offline  
Read February 23, 2008, 05:42:26 pm #8
VilleK

Re: Shmup Pixel Craft Generator (or how to create a much BETTER-looking pixel sh

Really nice looking pixel graphics Smiley .  Great idea!


ZGameEditor - Develop 64kb games for Windows.
Thrust for Vectrex - ROM-file and 6809 source code.
Offline  
Read February 24, 2008, 03:25:05 am #9
monoRAIL

Re: Shmup Pixel Craft Generator (or how to create a much BETTER-looking pixel sh

Nice work Adigun. I'm looking forward to the first game to use this - where every enemy is different!
Offline  
Read February 25, 2008, 04:25:44 am #10
Adigun A. Polack

Re: Shmup Pixel Craft Generator (or how to create a much BETTER-looking pixel ship!)

Nice work Adigun. I'm looking forward to the first game to use this - where every enemy is different!

Boy, that will be quite an interesting use of this baby, won’t it, my main man monoRAIL?  I mean, that would be some amazing originality (and even possibly a shmup breakthrough!) right there if I ever saw one, let me tell you that myself!!!  d=Grin=b !

And thank you everyone for such wonderfully supportive feedback... at last, a program that I am sure A LOT of shmup developers and game hobbyist creators like that can use for their own games, I believe!!!  wink2

Also, remember the source code that I presented at the beginning of this thread?  Well, since I have used that entire code (which contains my whole custom algorithm indeed!) to create and custom-build many random and sleeker-looking pixel craft — pixel by every single individually colored pixel — I thought that I would show you what I did with some of those countless MANY ships as I presented them on deviantART as some wonderful pixel-art, so here they are:

         • Pixel Craft
         • Pixel Craft - Extra Edition
         • Pixel Craft - Micro Edition


...where in each one, I have tweaked my own custom algo in order to create something really more interesting!!!  cool1

Now the2bears, can you do a latest write-up about the three designs on dA that pertain to my custom algo that was implemented for my program indeed, hmmmm?  grin2
Offline  
Pages: [1]   Go Up
Jump to:  

Page created in 0.175 seconds with 20 queries.