MODULE: Individual Character Scaling V1.1

Started by Gilbert, Sun 11/02/2007 09:53:23

Previous topic - Next topic

Gilbert

Individual Character Scaling
Version:1.1
Released on:11th February, 2007


Set the scalings for individual characters according to given percentages
of Walkable Area scaling settings. It may be handy in case you have several characters with their sprites drawn in different scales for some reasons, and don't want to resize the graphics.

Requires AGS V2.71 or later. (note: the demo was saved with V2.72 so probably won't work with V2.71 but I think the module might still work)

Download V1.1 here.
(15-2-07: Link updated, I forgot to re-export the SCM last time, so the SCM file was still V1.1, you could re-export it using the demo game though)

Read the included icharscal.txt file for details on usage.

Note:
Normally I have no plan on making official script modules, I only mucked up quick modules for testing purposes when I thought I could help solving some people's problems. Since I never had time to read the official guidelines, my modules probably won't follow the naming conventions and formatting, etc., they can also be glitched, and may even clash with other module codes.
This one is no exception, it's originally an attempt to fix Samwise's problem. Thanks to Samwise's suggestions and reports, V1.1 fixed some small glitched. Anyway, use at your own risks.

Samwise

I tested it in several game rooms and it works fine.

This module is very handy and easy to use.  It basically enables you to draw (or photograph in my case) the characters in any size you want, without worrying about the proportions afterwards.

I was stucked for a long time due to the fact that all my characters were made in different sizes.  This module saved me many hours of work, and reduced the game size as well.

Samwise

#2
I'm having some trouble with this great module - apparently it doesn't support the Y pivot correctly.  In the beginning (e.g. when a room loads) it does resize the characters according to the room scaling & the individual scaling like it should do, but when an NPC is starting to walk up or down, the NPC stays in the same size - his scaling doesn't change at all.

Could you PLEASE modify the module?  It's my only hope...  :'(

Gilbert

When the NPC moves, was it a blocking move?
Try opening the module code, change repeatedly_execute to repeatedly_execute_always and see if this fixes your problem.

Samwise

Hi, and thank you so much,

What you suggested did solve a PART of the problem.  The NPC's scaling does change when the NPC walks on the Y pivot, but his size doesn't change in a continuous matter, but rather in broken "jumps".  Unfortunately, it looks terrible.

Perhaps this is caused beacuse the equation that calculates the scaling works with whole numbers, and not with decimal fractions?  I'm not sure.  I'd really appreciate if you could check this one out.







Gilbert

Hmmm, scaling in AGS is limited, you can only specify whole percentages for the scales.
Try disabling the module scaling of that character, will it scale smoothly then?

The formula used in the module is very simple, just:

(Original_scale_on_the_spot * Scale_set_in_module)/100

The part in the brackets is just integral multiplication, the only part that would be affected by decimal accuracy is when it's divided by 100. The module currently uses integral division for this.

You may try changing the module code related to this calculation to use floating point arithemetic, but I doubt it will improve much:

yy=FloatToInt(IntToFloat((GetScalingAt(character[ii].x, character[ii].y)*char_scales[ii]))/100.0,eRoundNearest);

Samwise

No, that last line didn't do the trick  :(

From my (very) basic understanding, it appears that the only way to solve this issue the way you suggested is to create new "float" functions for this module, which will replace the "int" CharacterScaling and the GetScalingAt properties.  But I'm afraid my scripting skills are way too timited to solve this problem myself.  Could you please try again to help me out with this one?


Gilbert

#7
No, what I meant was that this is an engine limitation, so there's no way around it at the moment.

Edit:I just had some rethink about this problem, I think this problem is most noticiable when the character's original scaling is small on that spot but the override scaling parameter used in the module is larger than 100.
So, maybe a workaround (not tested) is to try setting the room's area scaling to larger values, while reducing the values used in to modules.

Samwise

That might ease the problem, but will definitely not solve it...  Anyway, I truly appreciate all your help in this matter.

Jonathan

Akril15

I know it's a bit late to be bumping this thread, but I've found myself in a situation where this module would really come in useful.

I wanted to try it out in the hopes that it would work in AGS 3.x, but when I tried to download it, I was confronted by a window prompting me for a username and password in order to access http://www.2dadventure.com (this window keeps popping up randomly on these forums -- has anyone else noticed this?). Since I have neither, I then get redirected to a "Authorization Required" error page.

Could you please post an alternate link where the module can be downloaded, Gilbet? (Unless it isn't AGS 3.x-compatible, in which case I'll try to find an alternate solution).

Sslaxx

Quote from: Akril15 on Sat 29/05/2010 08:22:11
I know it's a bit late to be bumping this thread, but I've found myself in a situation where this module would really come in useful.

I wanted to try it out in the hopes that it would work in AGS 3.x, but when I tried to download it, I was confronted by a window prompting me for a username and password in order to access http://www.2dadventure.com (this window keeps popping up randomly on these forums -- has anyone else noticed this?). Since I have neither, I then get redirected to a "Authorization Required" error page.

Could you please post an alternate link where the module can be downloaded, Gilbet? (Unless it isn't AGS 3.x-compatible, in which case I'll try to find an alternate solution).
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=40901.0
Stuart "Sslaxx" Moore.

Dualnames

Akril15 it appears that the game as well as some forum images (AVATARS) were hosted in 2dadventure. I don't own the module unfortunately, but I use sth similar for hitchhikers.

Code: ags

function AutoScale(Character*CInv, int scaleat) {
if (CInv.ManualScaling==false) {
CInv.ManualScaling=true;
}
int ffs;
ffs=GetScalingAt(CInv.x-1, CInv.y)+scaleat;
if (ffs==0) {
ffs=GetScalingAt(CInv.x+1, CInv.y)+scaleat;
}
if (ffs>200) {
ffs=200;
}
CInv.Scaling=ffs;
}


It gets the scaling of the area the character is near and adds/remove additional scaling set by integer scale at(if scaleat is negative it will apparently reduce scaling). I'd import that function and use it on repeatedly_execute_always() because that's where it is smooth.
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)

Gilbert

It's temporally (re)uploaded here. I'm too lazy to look at it atm and I don't know whether it will work with AGS V3+.

Akril15

Quote from: Sslaxx on Sat 29/05/2010 14:03:44
http://www.adventuregamestudio.co.uk/yabb/index.php?topic=40901.0

Quote from: Dualnames on Sat 29/05/2010 14:04:43
Akril15 it appears that the game as well as some forum images (AVATARS) were hosted in 2dadventure.
Okay, I see. Sorry for not searching for an answer myself.

Your code works fine, Dualnames, but it won't adjust a character's scale appropriately on a walkable area that doesn't use continuous scaling (which is what I'm looking for).

And Gilbet, I'm afraid that zip file you uploaded seems to be incomplete. When I open it, WinAce tries to analyze it but the files in it never appear.

Dualnames

Akril15 the file seems to be just fine for me. I use WinRar. Perhaps you should use Windows default way to open zips, or just get either winzip or winrar. Alternatively I can somehow change the file output from zip into something that would comfort you.
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)

Akril15

#15
I tried opening the file with WinRAR, Winzip and Windows' default compressed/zipped folders "method", and every time I got a "This file is either damaged or corrupted" message. I even tried re-downloading the file and then trying to extract it, and that didn't work either.

If you could upload the file to an alternate source, that would be great, Dualnames.

EDIT: Actually, you don't need to. I was able to download the file by switching from Firefox to Internet Explorer. For some reason Firefox would only download a fraction of the file.  :-\

Dualnames

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)

Akril15

Well, I was able to get the module working in AGS 3.1. The only tweak I needed to make was to replace AGS_MAX_CHARACTERS with 100 (I suppose any large number would work there, though). Unfortunately, there is still that rough "jumping" effect that Samwise mentioned whenever a character is scaled up or down, but hopefully I can find a solution for that problem (or, failing that, a substitute).

Thanks for the help, guys.

SMF spam blocked by CleanTalk