7 Replies - 2736 Views - Last Post: 03 November 2011 - 04:39 PM Rate Topic: -----

#1 Greltam  Icon User is offline

  • D.I.C Head

Reputation: 90
  • View blog
  • Posts: 225
  • Joined: 29-January 09

Procedurally generated Sprites

Posted 20 October 2011 - 10:35 AM

I was wondering if anyone had experience with procedurally generated sprites?
I'm in the planning/feasibility part of a new idea I want to work with. If anything, It'd be like Spore but 2d(I haven't played spore but I can across it while researching.) I also came across a site that's been semi inspiration. Pixel Robots details procedural generation, which also spun off to a Pixel Spaceship generator.

My idea is to have a String of set size for the genetics, and generate a sprite based on that. I don't want to constrain the sprite to fixed size, so that some creatures will be small, others large. I would also like to have the sprite "grow" from it's birth(say a few pixels) into its full-sized form.

Idk.. it might be something I have to do myself. At this point I've got just random pixels sans color.Attached Image

Is This A Good Question/Topic? 0
  • +

Replies To: Procedurally generated Sprites

#2 Greltam  Icon User is offline

  • D.I.C Head

Reputation: 90
  • View blog
  • Posts: 225
  • Joined: 29-January 09

Re: Procedurally generated Sprites

Posted 21 October 2011 - 05:39 PM

Noone probably cares, but I found a method to at least procedurally generate plants. L-System's can produce branching structures that resemble plants.
If you flip it upside down Attached Image it looks like a bush.
Was This Post Helpful? 0
  • +
  • -

#3 stackoverflow  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 164
  • View blog
  • Posts: 545
  • Joined: 06-July 11

Re: Procedurally generated Sprites

Posted 31 October 2011 - 11:29 PM

I suppose you could also use a short random walk, then shorter random walks from random portions of the first random walk. I think that would produce a similar looking bush?
Was This Post Helpful? 0
  • +
  • -

#4 ButchDean  Icon User is offline

  • Ex-Pro Games Programmer
  • member icon


Reputation: 876
  • View blog
  • Posts: 3,340
  • Joined: 26-November 10

Re: Procedurally generated Sprites

Posted 01 November 2011 - 05:33 AM

The trouble with these procedures is that unless they are properly implemented you will end up with unexpected results. I really don't know where you are going with this, but I suggest you leave it alone for now and get a game developed without procedurally generated sprites - you're just adding complexity to an already fairly complicated task. :)
Was This Post Helpful? 0
  • +
  • -

#5 Greltam  Icon User is offline

  • D.I.C Head

Reputation: 90
  • View blog
  • Posts: 225
  • Joined: 29-January 09

Re: Procedurally generated Sprites

Posted 02 November 2011 - 12:03 PM

I think I'll do as PixelRobots/PixelSpaceShips does, and predefine a few sizes/areas within to denote head/body/legs/arms for the animals. I'm thinking of sticking with L-Systems for the plants. I wrote a prototype for plant growth, as I wanted to see if it would work. Highly unoptimized.

"Plants" growing
Was This Post Helpful? 3
  • +
  • -

#6 ButchDean  Icon User is offline

  • Ex-Pro Games Programmer
  • member icon


Reputation: 876
  • View blog
  • Posts: 3,340
  • Joined: 26-November 10

Re: Procedurally generated Sprites

Posted 02 November 2011 - 01:02 PM

Very nice work, Greltam! I feel you need to apply yourself to 3D work now. I feel you have the drive to give it a good go. ;)
Was This Post Helpful? 0
  • +
  • -

#7 stackoverflow  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 164
  • View blog
  • Posts: 545
  • Joined: 06-July 11

Re: Procedurally generated Sprites

Posted 02 November 2011 - 11:20 PM

That's cool~ I can imagine those in a game. How hefty is the algorithm on resources?
Was This Post Helpful? 0
  • +
  • -

#8 Greltam  Icon User is offline

  • D.I.C Head

Reputation: 90
  • View blog
  • Posts: 225
  • Joined: 29-January 09

Re: Procedurally generated Sprites

Posted 03 November 2011 - 04:39 PM

@StackOverflow It was bottoming out my CPU with just 10... I reworked it alittle bit, and now It runs a bit better. I have a list of the shapes that constitute the "plant", lines and ellipses. These are then pulled out and put into their respective list of branches or leaves. Here, for plant growth, I have two different methods. Redraw the whole plant to keep the branches behind the leaves, or draw the branch/leaf over everything.

2.0GHZ Dual-Core CPU
With 100 plants onscreen

at 30 updates(plants growing) + 30 screen draws:
sequential shape drawing/no screen Draw - avg Cpu: 8% avg RAM: 100MB
sequential shape drawing/screen Draw - avg Cpu: 65% avg RAM: 100MB
redraw whole plant/no screen Draw - avg Cpu: 65% avg RAM: 400MB
redraw whole plant/screen Draw - avg Cpu: 100% avg RAM: 400MB

at 10 updates + 10 screen Draws:
sequential shape drawing/no screen Draw - avg Cpu: 3-5% avg RAM: 100MB
sequential shape drawing/screen Draw - avg Cpu: 25% avg RAM: 100MB
redraw whole plant/no screen Draw - avg Cpu: 35% avg RAM: 200-350MB
redraw whole plant/screen Draw - avg Cpu: 55% avg RAM: 200-350MB

10 updates/"plant growth" per second is also pretty fast. I think 3 per second would be alright. I'm also using Java, and could be shuttling the images to the graphics card so screen draws wouldn't incur as much on the CPU.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1