Need help with procedurally generated sprites...

For questions about using Classic.

Post » Wed May 18, 2011 5:20 am

I wish to make procedurally generated sprites from an array but I am unsure how to edit the sprite based on the arrays elements.
For example, if I wanted to create random spaceship sprites based on a pattern from a 2d array by using a 2d array editor, then randomize certain parts of the array to create shapes.
But I cant figure out how to get that array pattern into a sprite. Canvas? Image manipulator? I'm stuck.
Here's some simple examples that were created similar to this:
[url:696j3ai4]http://gushh.net/blog/2010/06/10/spaceship-generator/[/url:696j3ai4]
B
2
S
1
G
1
Posts: 20
Reputation: 640

Post » Wed May 18, 2011 11:36 am

You can use just image manipulator.

+trigger -image manipulator copy from sprite
->image manipulator -flip image // known bug
->for each in array -image manipulator set rgb at current x, current y to arraygetvalue at current x, current y
-> call function after delay // you need a tick to read from gpu, function object works well
+ on function -image manipulator copy to sprite.

You may have to make sure the sprite has a channel, an alpha of 1 will do.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Thu Jul 07, 2011 4:04 am

Ive been tryin for a while to recreate the random examples from the links below (had to find them on archived website because the original web site links no longer work):
Procedural Pixel Space Ships
Procedural Pixel Robots

Eventually I want to make my own patterns. But for now I cannot get any method to work right. I just cant figure it out in construct.
Does anyone have a simple example of how I can recreate something similar to the examples in the links that can learn from.
B
2
S
1
G
1
Posts: 20
Reputation: 640

Post » Thu Jul 21, 2011 2:35 am

Heres an example cap. Note it doesnt use an array as I originally intended. I want to do that next but it kinda intimidates me. Also a seeded version would be great so that users can use a certain pattern again in a different game. And of course, eventually a full pattern editor for players.
Any help or suggestions on this?

Ship Patterns

The main problem Im having is that when I spawn a new sprite within a game and generate a texture it applies it to ALL sprites of that kind. I want some to be unique, and some to belong to factions that have the same texture. Any help on that?Darklander2011-07-21 02:45:11
B
2
S
1
G
1
Posts: 20
Reputation: 640

Post » Thu Jul 21, 2011 3:01 am

The "S" plug has seeded randoms, if you want to work it in.
Also the noise plug, and perlin by Arsonide, both run on seeds.

Edit, there's another plug by Lucid that allows for different textures per instance.newt2011-07-21 03:30:04
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Fri Jul 22, 2011 1:06 am

Thanks, Ill look into 'S' and/or the 'noise' option.
Unique sprite doesnt seem to have any different options in events or actions that are any different than the regular sprite. In fact I cant tell them apart. I have to be missing something here.
So far my attempts to put unique patterns on different instances of the same sprite end in two results, either they all change to the same pattern or I get a crash saying multisampled textures not allowed.
Do I need to have different animation frames set for each enemy sprite to hold a unique pattern?
B
2
S
1
G
1
Posts: 20
Reputation: 640

Post » Fri Jul 22, 2011 1:24 am

You can use different frames for the regular sprite, but that limits you as you can only have a set amount of frames. As to unique sprite you probably need to pick individual instances first via a private variable.
That plug was experimental, so there may be issues.
One other thing you can do is export the image from image manipulator to a directory, and then import it into the tiled background object. It can have different textures, just need to pick the correct instance.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests