Module: AGS Character Clone Module

Started by Dualnames, Tue 10/06/2008 12:21:40

Previous topic - Next topic

Dualnames

Welcome to the AGS Character Clone module.

AGSVersion: 3.0.2
Works with 3.0 and 3.01

Version:
1.0 First Public Release.

Download
AGS 2.72 Compatible:Here
Demo:Here
Module:Here

a)What does this module do?
-Clones character using a prototype. So it creates in-game instances of characters.
-Animates them, have them immitate prototype, make them walk, and place them

b)What do I need it for?
-If you want to create many characters in a room but don;t want to use them for anything else and AGS is bugging you to create each character then this module is for you.
-If you want a character to immitate a prototype's movements there's no better way to do it.

Caveats
Well, it uses GUI buttons as clones. Rawdraw and drawing surface couldn't do the trick, overlays did but can't be interactable and 10 per screen are so few. So only buttons can do it.

And thus there's the baseline GUI thing..

Also if you have a flipped screen the module shows the frames un-flipped this is AGS I think and not the modules problem.

Advantages
It's not slow at all. Animate function works regardless of prototype and you can have different delays. Check demo.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Buckethead

This sounds pretty awsome!  ;D Gui buttons sound kinda weird but hey, if it works it works.

GarageGothic

#2
Great idea! But I'm not sure I really see the point in using buttons. They offer the same proplem as DrawingSurface of not supporting walkbehinds and will always be drawn in front of the real characters and objects no matter their baseline. Creating a bunch of actual characters and storing their associations in a struct wouldn't be a huge amount of work for the end user and is much more flexible.
For instance, I use a lot of dummy characters to fake different light and shadow effects. I have one function called GetEffectCharacter, which runs through the struct looking for free dummy characters and return a pointer to them. This function can be accessed from any other script. Once I'm done with it, I ReleaseEffectCharacter and the dummy character is again available for use by other functions.

Dualnames

Yes, but clones. It's all about clones(drawing surface cuts the animation by the way), how many free dummy characters can you use and make? That's where this module comes in handy.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

GarageGothic

Quote from: Dualnames on Fri 13/06/2008 11:10:56how many free dummy characters can you use and make?

As of recent AGS versions, unlimited. Replicating the view, loop and frame settings to a dummy character doesn't seem like more work than retrieving the same information and applying their graphic to a button. What do you mean by "drawing surface cuts the animation"?

Dualnames

It just creates a frame then draws the next too fast. If you try to find a way to slow it down, it draws a frame erases the image puts the next frame ecc
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

GarageGothic

Ok, I haven't checked out your script, so I don't know how it handles the timing for updating the frames. But obviously the clones would have to be stored in a struct, their animations updated and then drawn to the DrawingSurface every loop in baseline order every loop.

Overall, I really think dummy characters would be a better solution than either the buttons or RawDrawing. Characters naturally supports baseline, scaling, lighting, walkbehinds and anything else you can't do easily with the GUI method..

Dualnames

How about this.. make 30.000 dummy characters.
AGS doesn't allow such numbers.
AGS Clone Module does.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

GarageGothic

#8
Are you telling me that your module can show 30.000 characters on-screen at once? That's pretty darn impressive. I though it could only show one character per button, but now that I checked the module itself you can use unlimited GUIs. However, as you'll still be adding GUIs (and adding 30 buttons to each one) instead of creating dummy characters and initilizing them into the array (which could even be avoided if they are all numbered in sequence) (Edit: I didn't realize you just keep importing the same GUI, that does make things a bit easier). And as for 30.000, I'm pretty sure that AGS will struggle quite a bit with 1000 GUIs on-screen at the same time. Not sure about characters, but I've definitely seen a hundred characters walking around on-screen without any slowdown.

Listen, I'm not bashing your module, nor am I begging you to rewrite it in any way, because personally I don't have any uses for it. If it works for your game, that's awesome and you shouldn't change anything. I was just making some suggestions as to how to get around some of the limitations (walkbehinds, baselines, lighting and tint) and make it more useful for other developers. I totally accept that you're not using my suggestions. But you could at least consider implementing something as simple as sorting the ZOrding of the buttons by their respective y coordinates. It's obvious from your demo that there are baseline issues in the module, and it would be as easy as a setting (button.ZOrder = button.Y+320 //adding a screenheight to cover cases where button.Y<0) whenever the y coordinate changes, with exceptions that (if > 1000 then = 1000) and (if < 0 then = 0).

Dualnames

No really, I must have missed that Zorder thing.. sorry.
Seems like a good idea. GUI's are not so dependant on resources. Unless they're not transparent. If they are ..hell will rise.

And yes, the problems is scaling, baseline,lightning and tint indeed.
Baseline can be fixed though..as you said.

Seriously, I want to make this module better.
At any way possible.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

SMF spam blocked by CleanTalk