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

Textbox with an Animated loop in the back
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Thu Feb 09, 2017 12:03 am    Post subject: Textbox with an Animated loop in the back Reply with quote

Hi! So, I am making a game where you need to see something animated during textbox dialogues.

There will be 2 kinds of animation.
1. Looping = Looping animations go on forever as long as the text box that needs it is active.
2. Ending = Cycles through some frames and loads a different textbox afterwards.

Example of usage:
Legend: TB= textbox, BGL=Background loop, SCA=Single cycle animation, HT=Hidden blank text box so you can enjoy the background graphics without closing the dialogue session.

1. TB: I love candy! BGL: Person licking a lollipop. (click)
2. TB: I can't get enough of it! BGL: same (click)
3. TB:(HT) BGL: same (click)
4. TB: (menu) A. Slowdown B. Normal C. Faster, BGL: same (choose)
5. if A: TB:(HT) BGL: Person licking lollipop slowly (click)
5.a. load a menu: A. Normal B. Faster BGL: same (choose)
5.b. if A: go back to #3.
5.b. TB:(HT) BGL: Animate swallowing which leads to a different textbox after animation is complete.
6. if B: and so on...

In the battle formations editor there is an option to cycle screens, is it possible to have an option like that for text boxes, in the part where it lets you choose a backgrounds screen? That would be very handy. It won't work for single cycle animations though so a 'play once' factor might be cool. Thanks as always!

Also: The game will be a creature collection game. Let's suppose that there will be 100 creatures in the game and each of them will have their own "candy" conversations, it would really be handy to have a built-in function than to manually write unique scripts for each...

------
http://rpg.hamsterrepublic.com/ohrrpgce/PalEdit
http://rpg.hamsterrepublic.com/ohrrpgce/CHGPAL
_________________
So many ideas, so little focus. Monk spirit please lend me your power!

Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Thu Feb 09, 2017 1:09 am    Post subject: Reply with quote

Oh cool, making an OHR game again?

I'm actually currently working on an animation system. I still haven't decided whether backdrops should be included, which would mean that animated backdrops would have multiple frames, like other kinds of animated graphics, instead of using of using a series backdrops like you do for animated battle backrops. That seems a bit weird and maybe over-complex; what do you think? But it would be more flexible.

But if I decide not to do that, then I can just add options to animate the backdrop of a textbox; that's easy. And so is an option to loop forever or play X times.

So, I suggest you wait for me to implement this. The animation system is heaps of work, but I'm sure it'll be in the next release, because it's top priority.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Thu Feb 09, 2017 4:59 am    Post subject: Reply with quote

Yes! I have searched for several engines, but I always return here. OHR can potentially be the greatest RPG engine out there.

Do you mean that your animation system will have a separate "room" in the graphics editor section? Like 'edit hero graphics', 'edit walkaby graphics' then 'edit animated backdrops'? That would be cool! Any idea when this update might be? I am planning to introduce my game next month and it updates every first week of every month. I'm not sure wether to do separate episode installments or just add updates to an rpg file and post updated versions to overwrite the former each time. If it's possible to make OHR 'expansion packs' that might be cool too! Like if they have the core rpg files i can post addons like additional characters, maps or quests from time to time to keep the players occupied with nice stuff.

I really like how the animated backdrops work. For a test I just exported 8 frames that comprise an animated loop and loaded them up as screens. I made a battle scene with nobody there and set it up as a formation in the map editor. I ran it on my android phone and it looks freakin' good! I love the OHR framerate it is very smooth. This also proves that the ticks or framerate control in the battle screen editor is a very useful option to have.

Just another problem would be the palette. It just looks like I will have to choose colors carefully in order to make good imports.

"But if I decide not to do that, then I can just add options to animate the backdrop of a textbox; that's easy. And so is an option to loop forever or play X times. " - Man, hearing this is just pure pleasure! Please let me know when it is possible! :-) :-) :-)
_________________
So many ideas, so little focus. Monk spirit please lend me your power!

Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Fri Feb 10, 2017 1:26 am    Post subject: Reply with quote

No, I meant that I'll add animations to the existing backdrop editor. Like:


(This is a mockup, not real!)

After creating that mockup I can imagine more easily how it will work, and I've pretty much made up my mind to do it that way.

I'm hoping the next OHR release will be in something like ~2 months from now.
But I think adding animated backdrops seems quite a bit easier than adding the animation system to all the other sprite types, so I think I'll start with backdrops. I think I should have it ready this month...

BlastedEarth wrote:
I'm not sure wether to do separate episode installments or just add updates to an rpg file and post updated versions to overwrite the former each time. If it's possible to make OHR 'expansion packs' that might be cool too! Like if they have the core rpg files i can post addons like additional characters, maps or quests from time to time to keep the players occupied with nice stuff.

Is there any problem sending players a new file? Will it be quite large?
Actually, you *could* send players 'patches' fairly easily.
First, unlump your .rpg file to an .rpgdir folder containing separate lump files (you can still edit and run this as normal). Then you could send players a .zip containing just the lumps that have changed (e.g. new maps and music) and tell them to unzip it ontop of the old game, overwriting files. You can use a simple tool like windiff from Microsoft to figure out which files to include in the zip, by comparing the current version of the game with the last version you sent for changed/new files.
Hmm.... actually it would be fairly easy to make this a builtin feature. But only if more people aside from you would actually make use of it...

Also, this isn't what you were asking for, but I recently added the "run game" script command to switch to a different .rpg file. Some people were interested in using it for "expansion packs", but then you need to split everything into multiple files. (Also, that command isn't totally finished yet).

Quote:
I love the OHR framerate it is very smooth.

Hahaha, that's the first time I've heard that; mostly people say the opposite. 18FPS is pretty low. But of course, you're not going to draw an animation with that many frames per second anyway, it's too much work. James even recently said:
James wrote:
Yeah, the fps thing is really an issue. I have ignored it for so long because I am used to how 18.2 fps looks, but I have recently come to understand that is just me being abnormal, and that it looks really bad when scrolling for almost everybody else.



Quote:
Just another problem would be the palette. It just looks like I will have to choose colors carefully in order to make good imports.

Yes, it's bad. Do you convert the graphic to 256 colours in an external graphics editor first, before importing it? You should; it can produce far better results then when Custom converts the colours.
Also, if you're displaying a backdrop behind a textbox (not in-battle, and not a transparent backdrop through which you can see the map) then you can use a new master palette for the backdrop when you import it. Then you'll notice almost no reduction in quality. You just need to make sure that the colours for the text/textbox exist in the new master palette. The engine will automatically map UI colours like text colours to the nearest match.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Fri Feb 10, 2017 7:25 pm    Post subject: Reply with quote

Quote:
(This is a mockup, not real! I think I should have it ready this month...)


I cannot wait for this to be real, this looks really handy! This month? Man, I'll go crazy using this.

Quote:
Is there any problem sending players a new file? Will it be quite large?


Not really, at first it won't be that large. The thing is though that it might be a neat way to distribute if there would be little contents which I can package in an interesting way. For example:

This week's special: Lightning creatures pack. "Get your lightning golems this week and beat the crap out of the Water witch in the March event, "The Attack of the Agua Encantada!" *Includes a nice promo picture, a link to a purchasable poster and a neat 'patch' file that is always placed in the same folder so followers of the series are never confused where to put which stuff where. Then imagine a new special every now and then.

Also: Thanks for the tips, I will definetely use those for the PC release. For this game I'm planning, it will be targeting the Android platform, can the same technique be done there? If I was just updating rpg files, will the saves remain? Or maybe there's an even better than this...

Quote:
Hmm.... actually it would be fairly easy to make this a builtin feature. But only if more people aside from you would actually make use of it...


I'm sure some people could make use of something like this if the feature is available...

Quote:
Also, this isn't what you were asking for, but I recently added the "run game" script command to switch to a different .rpg file.


This looks handy! You can save variables in external text files right? Or maybe saves can be loaded in other rpg files so you can carry over levels, powers, etc?

Quote:
Hahaha, that's the first time I've heard that; mostly people say the opposite. 18FPS is pretty low. But of course, you're not going to draw an animation with that many frames per second anyway, it's too much work.


Well, I don't really mind that in the rest of the game because the animations are usually limited to a couple of frames which makes good use of it as it's not too fast or too slow. Running this game on very high fps should look stupid and anything slower would be torture. So yeah I'm with James on that part. The animated backdrops on the other hand, it's just great because the ticks can be controlled and I can tweak how the animation should look and the loss of quality from the import actually gives the pictures a unique vibe.

Quote:
Yes, it's bad. Do you convert the graphic to 256 colours in an external graphics editor first, before importing it? You should; it can produce far better results then when Custom converts the colours.


There's a new feature which I thought saves time from doing that but yeah I should try that some more...

Quote:
Also, if you're displaying a backdrop behind a textbox (not in-battle, and not a transparent backdrop through which you can see the map) then you can use a new master palette for the backdrop when you import it.


How do I do this? I do not see an import option anywhere aside from the 'import screens' and in the text box editor it just allows choosing from the already imported screens...
_________________
So many ideas, so little focus. Monk spirit please lend me your power!

Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sat Feb 11, 2017 4:46 am    Post subject: Reply with quote

Right. Unzipping one file on top of another isn't fool-proof, some people might do it wrong, and it requires that all files are unzipped in exactly the right order, with none skipped. I was just talking about a builtin feature for producing these 'patch' zips, but ideally there would also be a builtin feature to apply them safely. However that's not something I want to start on, it seems like there's a lot more important things to do (and anyway, someone else could easily write programs to do this patching, there's not much advantage to building it into the engine).

You can't anything like those patch files for Android. (It would have to be a built-in feature to download and apply a patch, and that's far more work.)
However, apparently Android 4.1 automatically create and install patches for games when you upload a new version, instead of having to redownload the whole game. (And Android installs updates automatically by default, right? )
The save files will be preserved when the app updates.

BlastedEarth wrote:
This looks handy! You can save variables in external text files right? Or maybe saves can be loaded in other rpg files so you can carry over levels, powers, etc?


You can't read/write external text files yet. I was planning that, but it's not a high priority. However, I am going to add a way to share save files between games, because you definitely need something like that to make use of "run game". So hopefully that's in the next release.

Quote:
Quote:
Also, if you're displaying a backdrop behind a textbox (not in-battle, and not a transparent backdrop through which you can see the map) then you can use a new master palette for the backdrop when you import it.


How do I do this? I do not see an import option anywhere aside from the 'import screens' and in the text box editor it just allows choosing from the already imported screens...


If you import an 8-bit BMP as a backdrop, and its palette isn't the same as your master palette, then you're given the option whether to remap the colours into the current master palette, or add the palette from the BMP as a new master palette.
But then to actually use the new master palette you have to call the load palette command followed by "update palette" (or "fade screen in") when you display the backdrop. And then do the same to go back to the normal master palette.
Also, if you do this you might notice that the image updates a split second (1/60th of a second) before the palette. That's a bug, which I can fix fairly easily.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Sat Feb 11, 2017 11:34 pm    Post subject: Reply with quote

Ah, I see, I will look into the Android stuff that you are talking about. By the way, I am not planning on using google to distribute the game, I am thinking of providing the apk or rpg files myself through my website if I couldn't find a host for them. Is there a program that allows you to update apps the way that you've mentioned in your last message aside from the playstore?

Quote:
If you import an 8-bit BMP as a backdrop, and its palette isn't the same as your master palette, then you're given the option whether to remap the colours into the current master palette, or add the palette from the BMP as a new master palette.


Great! This works when the image is in 256 color mode and not rgb, the options don't appear when importing rgb images. It DOES look good! That's one setback out of the way, I will just have to wait for the animated backdrops feature then it's all set, thanks!

Oh btw: Can I use separate master palettes for different backdrops?
_________________
So many ideas, so little focus. Monk spirit please lend me your power!

Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sun Feb 12, 2017 6:36 am    Post subject: Reply with quote

Oh, that might be a problem. I'm not 100% sure, but according to pages like this, it sounds like they can download a new .apk and use it to replace the old version, without losing their saved games. There wouldn't be any patching; they'd have to download the whole game each time.

Yes, there's no limit on the number of master palettes.

Note that there is a 'default' master palette (the one actually used in-game unless you use 'load palette' command) and an 'active editing palette' which is what Custom is using for display. To change either of these you have to go the the Master Palettes menu in General Game Settings. Might be a bit confusing. You have to change the active palette to see what your import backdrops look like, because backdrops don't remember which master palette they should be displayed with... hmm, actually in this new backdrop editor I can now easily make them remember their master palette.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Sun Feb 12, 2017 7:25 am    Post subject: Reply with quote

Quote:
hmm, actually in this new backdrop editor I can now easily make them remember their master palette.


And you wouldn't have to use the load palette command for each backdrop which is using a different palette?
_________________
So many ideas, so little focus. Monk spirit please lend me your power!

Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Sun Feb 12, 2017 8:36 am    Post subject: Reply with quote

That's the idea, but I'm not sure about it... automatically changing the master palette when you display a backdrop set to a different master palette would be strange, because it would probably screw up anything elses visible. Unless all 16-colour palettes and tilesets were automatically temporarily remapped... which I guess is quite possible to implement. And some day if we have 32 bit colour depth, the remapping won't be necessary anyway.
However, you can actually display multiple backdrops at once as slices. I guess if you load a backdrop as a slice the master palette setting should be ignored.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Sun Feb 12, 2017 5:58 pm    Post subject: Reply with quote

What about an option to switch between master palettes? Kind of one of those options that you can press space on to toggle...

Hmmm maybe:

Can you help me write a couple of plotscripts that can be attached to textboxes, TMC?

1. Load Looping Animation Script:
A. Load the master palette, cycle forever through backdrop frames at a certain speed(pal#, beginning frame, end frame, ticks)
B. When box advances, check a 'maintaining' tag (if yes, maintain animation loop, if no, terminate animation loop).

2. Fixed Frames Animation Script:
A. Load the master palette, run through backdrop frames at a certain speed(pal#, beginning frame, end frame, ticks)
B. When box advances, terminate animation loop.

Maybe I can use these temporarily just to get a working prototype...
_________________
So many ideas, so little focus. Monk spirit please lend me your power!

Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Tue Feb 14, 2017 4:28 am    Post subject: Reply with quote

Well, OK. Adjust as needed.

I used 'Scripts:Skippable wait' from the wiki.
Code:

script, skippable wait, ticks, begin
  # Returns true if the wait was cancelled by a keypress.
  variable(i)
  for(i, 1, ticks) do, begin
    wait(1)
    if(key is pressed(key:ENTER)) then(exit returning(true))
    if(key is pressed(key:SPACE)) then(exit returning(true))
    if(key is pressed(key:CTRL)) then(exit returning(true))
    if(key is pressed(key:ALT)) then(exit returning(true))
    if(key is pressed(key:ESC)) then(exit returning(true))
    if(key is pressed(joy:button 1)) then(exit returning(true))
    if(key is pressed(joy:button 2)) then(exit returning(true))
  end
  exit returning(false)
end


plotscript, animation 1, begin
  show text box(52)   # Optional

  variable(backdrop, first backdrop, last backdrop, ticks per frame, pressed key)
  first backdrop := 10
  last backdrop := 14
  ticks per frame := 2
  backdrop := first backdrop

  load palette(1)
  update palette
  suspend player  # Suspend the player in case you want to show an animation without a textbox

  # Change the while condition to e.g.
  # "while (current textbox == 52)"   # Only animate for a certain textbox in the chain
  # "while (pressed key == false)"  # Stop when player presses key
  # "while (check tag(tag:animation 1) == off)"   # Until a tag turns on
  # "while (current textbox > -1 || pressed key == false)"  # Keep playing after the textbox is gone, until the player presses a key
  while (current textbox > -1) do (  # While a textbox is being displayed
    show backdrop(backdrop)
    backdrop += 1
    if (backdrop > last backdrop) then (backdrop := first backdrop)

    if (current textbox > -1) then (
      # Don't allow skipping while a textbox is shown (maybe you do want to allow this)
      wait (ticks per frame)
    ) else (
      if (skippable wait(ticks per frame))  then (pressed key := true)
  )

  show map  # Hide the backdrop
  load palette(0)  # The default palette is usually the first one
  update palette
  resume player
end


The different things you asked for can all be done with different while loop conditions; see the script. Aside from the different while conditions, you could give the script some arguments and reuse it.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Wed Feb 15, 2017 7:15 am    Post subject: Reply with quote

Thanks, TMC, can't wait to test these!
_________________
So many ideas, so little focus. Monk spirit please lend me your power!

Back to top
View user's profile Send private message
BlastedEarth




Joined: 05 Oct 2009
Posts: 243

PostPosted: Wed Feb 15, 2017 6:53 pm    Post subject: Reply with quote

I've looked into it as far as I can understand it, nope, couldn't find what causes the error, also tried googling the error line and code but nothing appears, what could be wrong?

The error is as follows:
ERROR: in script animation1 on line 18 in C:\Program Files (x86)\HamsterWhisper\animation1plotscript,

animation 1, begin
^
plotscript animation1 is missing end or )

Compiler returned error code (1)
_________________
So many ideas, so little focus. Monk spirit please lend me your power!

Back to top
View user's profile Send private message
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Thu Feb 16, 2017 1:36 am    Post subject: Reply with quote

Oh, that's my fault (and to be clear, I didn't test the script)

The end of the while loop should look like
Code:
    ) else (
      if (skippable wait(ticks per frame))  then (pressed key := true)
    )
  )


instead of
Code:
    ) else (
      if (skippable wait(ticks per frame))  then (pressed key := true)
  )


It can be hard to find these mistakes. There not really any alternative to reading through the script checking every ( is matched by a ).

BTW, I replied to your other thread on the pixel perfect draw tool.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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