Need help with procedurally generated sprites...

This forum is currently in read-only mode.
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • 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:

    http://gushh.net/blog/2010/06/10/spaceship-generator/

  • 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.

  • 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.

  • 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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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?

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)