Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

About plotsprites

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Wed Jan 07, 2009 11:35 am    Post subject: About plotsprites Reply with quote

As you may already know, the current nightly builds support a new feature that Mike added called plotsprites. This feature was not included in the xocolatl stable release.

Plotsprites allow you to load hero pictures, walkabouts, enemies, attacks, etc. and manpulate them with plotscripting in a layer above the map.

I am planning on re-writing plotsprite support to sync up with the 'Plan for slice tree', but before I get too deep into it I would really like to know who has already been working with plotsprites?

If there is a lot of code being written already that uses plotsprites, then I need to make sure my changes are backwards compatible with existing code

However if nobody is using this feature yet (or if the people using it don't mid rewriting some things) then I can make things easier on myself by changing and simplifying some implementation details.

If anybody has any demos of code that uses plotsprites, I would love to see them. it would make my testing a whole lot easier. (and if you have something that you aren't ready to release publicly, would you consider e-mailing it or PM'ing it to me?)
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ShakeyAir




Joined: 27 Apr 2004
Posts: 93

PostPosted: Wed Jan 07, 2009 12:07 pm    Post subject: Reply with quote

I have used plotsprites for 2 things in my game so far, and both are fairly simple implementations. (One is a cursor on the title screen, one is a small dust animation)

And since (I have not released screenshots of this yet) I now have a custom textbox engine, I plan to use plotsprites for portraits but as of yet I'm not. (In the plotscripting dictionary, it seemed that plotsprites can only use hero sprites as of yet?)

I would not mind sending you the game I'm working on, but it is far from ready for demo release. Would you want just the game, or the scripts too? Or just the scripts using plotsprites?

And certainly, if it makes it easier for you, I'd say change the implementation. I have no problem going back and fixing any sort of break that could happen.
Back to top
View user's profile Send private message
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Wed Jan 07, 2009 1:09 pm    Post subject: Reply with quote

I haven't used plotsprites at all. I was passively dreading having to learn them for the SS101 after this one, the HUD article. So if you make changes, you should do them before I write that and engrave the Old Ways into impressionable minds.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
The Drizzle
Who is the Drizzle?




Joined: 12 Nov 2003
Posts: 432

PostPosted: Wed Jan 07, 2009 4:06 pm    Post subject: Reply with quote

I had no idea this even existed but I'm happy to screw around with it.
_________________
My name is...
The shake-zula, the mic rulah, the old schoola, you wanna trip? I'll bring it to yah...
Back to top
View user's profile Send private message AIM Address
Spoon Weaver




Joined: 18 Nov 2008
Posts: 421
Location: @home

PostPosted: Wed Jan 07, 2009 11:43 pm    Post subject: Reply with quote

oh.... I making one of the attacks for my Tim-Tim game with plotsprites when I saw this.

when will the changes be done do you think?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Thu Jan 08, 2009 8:55 am    Post subject: Reply with quote

I'm not sure. I'll keep you posted with the progress in this thread.

So far, I received some test code from Mike, and I have started work on the conversion.

I am now drawing a slice layer for plotsprites, and I am revamping each plotsprite-related plotscripting command one-by-one.

Once concern I have is the re-usability of old handles.

The current plotsprite code allocates plotsprite handles like this:

Code:

FUNCTION grow_plotsprites AS INTEGER
 DIM i as integer
 FOR i = 0 to UBOUND(plot_sprites)
  IF plot_sprites(i).used = NO THEN RETURN i
 NEXT
 
 REDIM PRESERVE plot_sprites(UBOUND(plot_sprites) * 1.1 + 5)
 RETURN i
END FUNCTION


Which means that if you delete a plotsprite but keep the handle in a varaible, that variable will then point to the next plotsprite you create.

I was going to use the same system to allocate slice handles, but I would love it if somebody could suggest to me a scheme by which a deleted handle would remain deleted.

The only methods I can think of to accomplish this is
A) to have an ever-growing array of handles that doesn't recycle freed ones. This would be a memory leak, but it would be a very slow one (only 1 pointer per plotsprite deletion)
B) or I could simply cast plotsprite pointers into integers and use them as handles. This make me uncomfortable because then why couldn't someone just make up a pointer and use it, potentially causing crashes or out-of-range data access?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Thu Jan 08, 2009 2:13 pm    Post subject: Reply with quote

Okay, I finished the conversion. It went more smoothly than I expected. I am currently forcing an early nightly build in case anybody wants to try this out now. Your existing scripts that use plotsprites should work exactly the same without need of modification. If anything suddenly breaks, please do tell me.

The only thing that should really be different right now is that instead of using plotsprite handles you are now using plotslice handles. The reasons why this is cool will not become manifest until:
A) I implement commands to manipulate other slice properties
B) plotslice handles for other slice types become available.

Currently I am using the scheme that allows recycling of old handle numbers, which is a bad thing. I still want input on how this might be done better.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Thu Jan 08, 2009 2:25 pm    Post subject: Reply with quote

I'm not sure it's a bad thing. It's not a great thing, but it's a better thing than some of your alternatives.

A) Do plotsprites preserve from map to map? Between saves? If both answers are yes, then even a slow memory leak is probably unacceptable.

B) This makes it way easier to screw things up than the current method.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Thu Jan 08, 2009 2:40 pm    Post subject: Reply with quote

Moogle1 wrote:
I'm not sure it's a bad thing. It's not a great thing, but it's a better thing than some of your alternatives.


Yeah. Those other fixes are probably worse than the problem they try to solve :(

Moogle1 wrote:
A) Do plotsprites preserve from map to map? Between saves? If both answers are yes, then even a slow memory leak is probably unacceptable.


Yes, they preserve between maps, no they do not preserve between saves.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Thu Jan 08, 2009 3:14 pm    Post subject: Reply with quote

James Paige wrote:
Yes, they preserve between maps, no they do not preserve between saves.


I should probably work with these before running my mouth off, but that seems like a bad thing to me.

Of course, you'd probably need to retool the SAV format before you're able to save them, but maybe it's time...
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Thu Jan 08, 2009 3:56 pm    Post subject: Reply with quote

Moogle1 wrote:
James Paige wrote:
Yes, they preserve between maps, no they do not preserve between saves.


I should probably work with these before running my mouth off, but that seems like a bad thing to me.

Of course, you'd probably need to retool the SAV format before you're able to save them, but maybe it's time...


Yeah, right now it is simply not realistic to save them. So for now, users are just going to have to understand that

A) you have to re-create your sprites when you load a saved game
B) any sprite handles stored in global variables have to be assumed to be invalid after a load.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Bob the Hamster
OHRRPGCE Developer




Joined: 22 Feb 2003
Posts: 2526
Location: Hamster Republic (Southern California Enclave)

PostPosted: Fri Jan 09, 2009 11:00 am    Post subject: Reply with quote

I fixed some more bugs, so be sure to pick up a fresh nightly.

So far I have only made one change to the way that plotsprites work, which is that I change them to default to visible instead of invisible. You can still make a sprite invisible with "set sprite visible(false)"
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group