Dynamic Sprites as Player Character

Started by ToeKnee, Wed 19/08/2020 10:32:50

Previous topic - Next topic

ToeKnee

Hi all,
I have finished a full-length Point and Click AGS Adventure game Called BYO-Hero
See: https://www.adventuregamestudio.co.uk/forums/index.php?topic=58073.msg636621409#msg636621409

As you can see the Main theme for this game is for people (specifically children) to 'Draw' and scan their own player as per this picture;


Their drawing can then be scanned in to operate as the playing character as per the example screens above (Picture of the character drawn by my daughter) - hence the game's name: BYO-HERO!
I want to automate this step > loading it into AGS as Dynamic Sprites with various 'Loops' I can draw arms and legs based on the size of the drawing and the resulting sprite loops for walking in the key 4-directions.

I have read the Manual through and looked through the forum Dynamic Sprites posts but nothing I can read seems to detail if this might be possible or not before I release the game for free here.
I think I can write up a program externally (or website) that can take the drawings and scale, then produce, the AGS Character Loops that will allow this but once I have a Sprites for the Player Character and the various Loops I wonder if it is possible in AGS to use Dynamic Sprites to load from a file in this way?


Note: My own kids and other family members have already drawn their own pictures, and I have cut-out/digitised those for use in the game as Loops and I have found this works really great! - but takes time. This idea however is really (re)connecting them to this era of (Point-Click Adventure) game and they love it so far (since it is 'them' in the game, they can relate and become potentially more immersed in the game experience(s)... and outcome) and it becomes a game you can play with your kids!

I work for people with disability in Australia, so I also hope to add in any coding that would help release an accessible version for those with disability to play (particularly for Teens/Children)! You can do the entire game with a mouse only.
- eg: If their carers/family could get a drawing (or a funny cartoon, or anything really) then I could digitise this into the game, record some sounds used in the game like dog-barking / bird-squawking or even talking if they wanted some key areas in the game as well however Dynamic Sprites will be the only way to make the Character Sprites automated so it can be implemented for the game.

Thanks!
If it’s not broken, let’s fix it till it is...!

Crimson Wizard

#1
You can create DynamicSprites at runtime loading images from external files (DynamicSprite.CreateFromFile()), but you cannot create new views and loops or add/remove loop frames. So long as you have a fixed placeholder for all the loops, you will be able to fill them in script with dynamic sprites.

You may also scale dynamic sprites (it uses primitive nearest-neighbour algorithm), and combine multiple sprites on one DynamicSprite using DrawingSurface interface (see DrawingSurface and DynamicSprite.GetDrawingSurface())

PS. In theory you may also script your own animation with varied frame count.

ToeKnee

Thanks again Crimson, you AGS Rockstar;

Quoteyou cannot create new views and loops or add/remove loop frames
- I think that's ok... since I don't want to create new loops or frames, just 'overwrite' the default game ones with new (created in a outside of AGS program) 'sprite' creator program.

I was hoping to include the (standard) 4 x Walking Loops
- Up, Down, Left, Right (Mirror copy of Left - Reversed in external program for sprite one-time creation)
   Q: Unless the AGS 'Flip this Frame' option can be turned on as a property in runtime of course??

With 9 frames each Loop
1. Neutral (Start)*
2. Leg-1 out & Arm 2 out*
3. Leg-1 end & Arm 2 end*
4. Leg-1 out & Arm 2 out
5. Neutral (Start)
6. Leg-2 out & Arm 1 out*
7. Leg-2 end & Arm 1 end*
8. Leg-2 out & Arm 1 out
9. Neutral (Start)

Made up of 5 unique sprite frames (* above)
I can alter the game to work with the above and 'limit' the automation for the main player eg: remove other special areas like climbing etc or bending over to pickup something or taking an object off someone (THEY can move closer to you instead)

QuoteYou may also scale dynamic sprites (it uses primitive nearest-neighbor algorithm)
Q: This sure sounds like a lot of work (and possibly messy) but is it required? I mean - once Sprites are dynamically loaded into Frames and those frames are part of an existing Loop (attached to a existing view, attached to a Character!), then wouldn't the character use those frames when say, walking, and therefore wouldn't those (dynamically sourced/loaded) sprite frames also therefore scale normally in the game (as per your typical walkable areas scaling)?? Or have I missed the construct of Dynamic Scaling??


Quoteand combine multiple sprites on one DynamicSprite using DrawingSurface interface
Thanks, do you think this would significantly help my problem though? i.e:
Q: If an external program put together Frames then is the DrawingSurface needed (isn't this to load once rather then multiple loads) or is it much, much better and easier to load into AGS and therfore loading dynamically is also much easier??
If it’s not broken, let’s fix it till it is...!

Crimson Wizard

Quote from: ToeKnee on Wed 19/08/2020 13:43:24
- Up, Down, Left, Right (Mirror copy of Left - Reversed in external program for sprite one-time creation)
   Q: Unless the AGS 'Flip this Frame' option can be turned on as a property in runtime of course??

Frame's Flipped is a readonly property at runtime. If you plan to always have mirrored images you can set them flipped initially and assign same sprites. If, on other hand, you plan to allow individual images for each direction, then this won't work.
Note that dynamic sprites may be flipped at runtime too using DynamicSprite.Flip. So, for example, you may have a clone of dynamic sprite which you flip and assign to another frame.



Quote from: ToeKnee on Wed 19/08/2020 13:43:24
QuoteYou may also scale dynamic sprites (it uses primitive nearest-neighbor algorithm)
Q: This sure sounds like a lot of work (and possibly messy) but is it required? I mean - once Sprites are dynamically loaded into Frames and those frames are part of an existing Loop (attached to a existing view, attached to a Character!), then wouldn't the character use those frames when say, walking, and therefore wouldn't those (dynamically sourced/loaded) sprite frames also therefore scale normally in the game (as per your typical walkable areas scaling)?? Or have I missed the construct of Dynamic Scaling??

I only mentioned sprite scaling as an option. This may be used to adjust relative sizes of images. Of course, when assigned to a character, they will be scaled automatically according to character's scaling in the room too.


Quote from: ToeKnee on Wed 19/08/2020 13:43:24
Quoteand combine multiple sprites on one DynamicSprite using DrawingSurface interface
Thanks, do you think this would significantly help my problem though? i.e:
Q: If an external program put together Frames then is the DrawingSurface needed (isn't this to load once rather then multiple loads) or is it much, much better and easier to load into AGS and therfore loading dynamically is also much easier??

I'm afraid I don't fully understand the question...
DrawingSurface is used to draw upon something, such as dynamic sprite (also on room background for instance). I am not completely sure how are you planning to structure your images, but in theory one could have a tilemap and "generate" a frame out of pieces of that tilemap using dynamic sprites and drawing surface.

SMF spam blocked by CleanTalk