Asset - Extension Interactive Books - Now with GMS 2 support!

Dragon47

Member


Download demo: https://goo.gl/Nhgpds


Marketplace link: https://marketplace.yoyogames.com/assets/4858/interactive-books

This asset lets you add highly flexible and interactive books to your game. Flipping from one page to another is animated and you can flip multiple pages at once. Lighting and custom textures make for a great look and extensive customization. The asset includes a guide, a well-commented example, and documentation for each script making it easy to implement it into your game. Development and testing has only been done with the windows VM target and the windows YYC target, you might run into problems if you use this asset with other targets.

The asset is compatible with GM Studio 2 and GM Studio 1.

Features:
  • Animated page flipping.
  • Support for flipping multiple pages at once, letting you move directly to any page in a book.
  • Customizable stiffness for each sheet.
  • Customizable sheet curving.
  • Fast shadow casting (each sheet can cast shadows on the sheets below).
  • Gradient lighting.
  • Customizable lighting colors.
  • Customizable textures (sprites, surfaces etc. can be added to any sheet).
  • Sheet thickness.
  • A guide for implementation.
  • Commented and organized code.
  • Fast and optimized, made with efficiency in mind.
  • Irrespective of room speed, dependent on delta_time.
  • All in GML and GLSL ES.
Screenshots from the marketplace:











 
Last edited:
C

Cinderfire

Guest
Love it. Might purchase and add to my project, instead of my current unanimated books that just jump from page to page suddenly.
 

GMWolf

aka fel666
I've been looking forwards to you releasing this for a bit now! Amazing job as usual.
I love the pricing too!
I may well get this even if I don't have a project for it just yet!
 
Spectacular. I will buy this, however I want to know a few more things first.

1) How easy is it to customize the cover of the book? Is that just a sprite I can color and change however I want?

2) Can you explain a bit about how the code is implemented? Is everything manageable with preset scripts? I want to make sure I can easily add the book into my pre-existing game without hassle as well as only show the book during certain times.

3) How easy is it to add pages? Can I make certain pages only visible based on variables (so you unlock pages over time).

4) Can I have more than one book at a time?

5) Can I have it display different text depending on what language is selected at the beginning of the game? (I'm not asking for it to translate for me, just making sure I can easily include other language options. Though, how cool would it be if it did translate? Ha!)

These can make my game way cooler, as there are going to be two different books used heavily throughout the game, and right now they're just white rectangles with text on them... Answer as much of my questions as you can/are willing, please. I appreciate it a lot. Once again, these look absolutely fantastic.
 

Dragon47

Member
Spectacular. I will buy this, however I want to know a few more things first.

1) How easy is it to customize the cover of the book? Is that just a sprite I can color and change however I want?

2) Can you explain a bit about how the code is implemented? Is everything manageable with preset scripts? I want to make sure I can easily add the book into my pre-existing game without hassle as well as only show the book during certain times.

3) How easy is it to add pages? Can I make certain pages only visible based on variables (so you unlock pages over time).

4) Can I have more than one book at a time?

5) Can I have it display different text depending on what language is selected at the beginning of the game? (I'm not asking for it to translate for me, just making sure I can easily include other language options. Though, how cool would it be if it did translate? Ha!)

These can make my game way cooler, as there are going to be two different books used heavily throughout the game, and right now they're just white rectangles with text on them... Answer as much of my questions as you can/are willing, please. I appreciate it a lot. Once again, these look absolutely fantastic.
Thank you :)

1) There are two objects in the asset (excluding example objects): obj_ib_book and obj_ib_sheet. Creating a book creates an obj_ib_book instance that has a list containing all its obj_ib_sheet instances (I'm not using the word page, because a sheet actually has two pages). The cover of the book is a sheet instance like all other sheets in the book, with a stiffness set to 1 so it doesn't bend and a thickness added to make it look more like a hardcover. If you wanted to, you could create a pocket book cover by having a lower stiffness, or transparent book covers like you have in some school notebooks etc. Every sheet instance has has two textures, one called the front texture (the earliest page of the two pages in the sheet) and another called the back texture (the last page of the two pages in the sheet). You can set these textures to whatever texture you want, so you can set them to sprites (sprite_get_texture), backgrounds (background_get_texture), surfaces (surface_get_texture), anything you can get the texture of, textures are used to make it as general as possible. You can also add a horizontal offset for where the bending begins, this is something you usually only want for the front and back cover of the book, if you look at the example you can see how the edge in the cover doesn't flip around when you open the book, the flipping starts a few pixels into the front cover texture.

2) Here's the guide included with the asset, it should explain it. There are more scripts than the ones described in the guide. You can see all the script by going to the marketplace, then preview.
/*
-------------------------------------------------------------------------------------------------------------------------------------------------------------

Thank you for purchasing Interactive Books. Here's some information on how to use the asset.

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Before you start:

The example provided together with this asset had its texture group set to no cropping. When importing assets from the marketplace this change does
not come through, so you have to set it manually. You can do this by going to Global Game Settings (ctrl + shift + G), clicking the "Texture Groups"
tab, then select the "Default" texture group in the list to the left, and check "No cropping" to the right under "Texture Group Settings".
This is just for the sake of the example code, you don't really have to do this with your own books. The reason it's done here is that it will
interpolate the curved edges of each sheet with a transparent border to get a smooth antialiasing effect.

-------------------------------------------------------------------------------------------------------------------------------------------------------------

The resources:

If you've imported all the resources from the asset into your project you'll see that they're organized into two types of folders, one called
"Interactive Books" and the other called "Example". "Interactive Books" contains the essential resources needed to use the Interactive Books asset.
"Example" contains resources used in the example that shows up when you run the game. Resources in the "Example" folders are well commented and
shows you how you can use the Interactive Books asset.

To use Interactive Books all you have to do is to call scripts from the "Interactive Books" folder. All of the scripts are commented with a general
description of what the script does as well as descriptions specific to each parameter. It's recommended that you read through these whenever
you want to use them.

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Implementing Interactive Books into your game - the essential steps:

First off you'll have to create a book with ib_book_create. This script returns an instance id that you will use with the other scripts in the
asset later. You can then add sheets to the book with ib_book_add_sheet. In the create event of obj_example_main you can see how ib_book_add_sheet
is used to add all the sheets of the example book.

Then you should find a draw event to call ib_book_draw in. This will draw your book to the screen.

You can use ib_book_goto_sheet to move to different pages in the book.

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Further implementation of Interactive Books into your game:

ib_book_set_transformation: This script lets you set the position and scale of the book.

ib_sheet_position_curved_to_flat/ib_sheet_position_flat_to_curved: These scripts lets you transform positions between the flat version of a sheet
and the version where the sheet is curved out. This can be used if you e.g. want to check presses on rectangular buttons that are curved out when
drawn. The curve makes it impossible to check collision with the button like normal, so you have to transform the position from curved to flat first.
The example code shows how this can be done in obj_example_button.

If you want to know more, there are lots of comments with explanations in the example code and the scripts themselves. You can also contact me
by sending a mail to [email protected] or messaging Dragon47 on the GameMaker Community.

-------------------------------------------------------------------------------------------------------------------------------------------------------------
*/

3) You can add sheets to the book whenever you want, and you can add them at the end of the book or insert them somewhere in the book. You can also delete sheets from wherever you want in the book.
The script used to add a sheet returns the sheet instance, and you can use another script if you later want to check the current location of the sheet in the book. There's also a script for getting the sheet instance id at a specified location in the book.
So yes, you should be able to add sheets whenever something is unlocked, and the other scripts will make it easy to navigate the book etc.

4) Yes, and sheets are deactivated at nearly all times, so if you have hundreds of sheets in a book they won't slow down your game (as active instances would).

5) Yes. In the example the pages with the random text in the beginning are surfaces that I've drawn the text to using strings. In your case you can choose the string for the selected language and draw it to the surface.
 
V

Vanavah Edwards

Guest
I just bought your Interactive Books. I need help with the following 2 things:

(1) How do I turn off the text as I will be using sprites instead of the following text. How do I remove this so as to put in own?

sf_text_string[0] = "";
sf_text_string[1] = "";
sf_text_string[2] = "";
sf_text_string[3] = "";
for (var i = 0; i < array_length_1d(sf_text_string); ++i) {
sf_text_front = -1;
sf_text_back = -1;
}
for (var i = 0; i < 10; ++i) {
sheet_text = ib_book_add_sheet(book, -1, -1);
}

(2) I would like to remove the following Button Example page to put in own. How do I do this?

 

Dragon47

Member
I just bought your Interactive Books. I need help with the following 2 things:

(1) How do I turn off the text as I will be using sprites instead of the following text. How do I remove this so as to put in own?

sf_text_string[0] = "";
sf_text_string[1] = "";
sf_text_string[2] = "";
sf_text_string[3] = "";
for (var i = 0; i < array_length_1d(sf_text_string); ++i) {
sf_text_front = -1;
sf_text_back = -1;
}
for (var i = 0; i < 10; ++i) {
sheet_text = ib_book_add_sheet(book, -1, -1);
}

(2) I would like to remove the following Button Example page to put in own. How do I do this?

Hi,
since you also sent me an email, I replied with my answers there, so you should find them in your inbox.
 
K

kusumoto hidetaka

Guest
There is a mistake in the processing which destroys an object.

The variable which isn't defined
1. list_sheets_dependent_on_surfaces

2.list_depth_sort
 
A

AttaBoy

Guest
I'm really interested in this asset, but mostly for the page deformation and flipping. Is it easy to isolate those scripts/shaders and disregard the book framework?

Also, will this be alright for low resolution? I imagine it will but I figured I'd ask. Thanks!
 
C

Crask

Guest
When this asset is out for GMS2 I'm instantly buing it :) Great work! Do you know meaby when it will be avaiable?
 

Dragon47

Member
I'm really interested in this asset, but mostly for the page deformation and flipping. Is it easy to isolate those scripts/shaders and disregard the book framework?

Also, will this be alright for low resolution? I imagine it will but I figured I'd ask. Thanks!
Not exactly sure what you mean by disregard the book framework. The asset is pretty customizable, but it's structured like a book. The book in the example is separated from the essential asset resources, so you're not stuck with that book specifically if that's what you meant to ask. The page deformation and flipping is an animation (with some parameters), it's not physics-based, so it will still behave somewhat like a book (or newspaper or magazine) if you isolate the code, unless you drastically change the isolated code or use the asset in a bit of a hacky way.

Low-res should be okay. You might have to change some texture_set_interpolation calls in the internal asset code, but this is not that difficult.

When this asset is out for GMS2 I'm instantly buing it :) Great work! Do you know meaby when it will be avaiable?
Thank you. I don't have time to port it to GMS2 at the moment, and haven't laid out any plans for doing so, so no, I don't know. Maybe one day will come where I feel like putting in the necessary effort to do so.
 
Z

zmads

Guest
My last thing before buying was to read this topic to solve some doubts, then I saw here that it doesn't work for GMS2, what a bummer. Do you think it will be very complicated to convert?
 

Dragon47

Member
My last thing before buying was to read this topic to solve some doubts, then I saw here that it doesn't work for GMS2, what a bummer. Do you think it will be very complicated to convert?
It's possible to convert it, but it will probably be very complicated since you would have to change the internal code to make it work.

Edit: In case you don't know, you can see what assets support GMS 2 by their icon image on their page. It should have a G in the top left corner resembling the GMS 2 logo.
 
Last edited:

Dragon47

Member
@Dragon47 , Any chance of a GMS2 release?
GMS 2 version now released!

A customer figured out the main bug of what I was referring to in my previous post. I went back to the project to try out the fix now. It worked, and the other bug seems to have been resolved by Yoyogames having fixed some GMS1-to-GMS2 importer issues since I last tested. So now it's up and ready for download!
 
J

Jacob Conway

Guest
Hello, I am using your example code in gms:2. I am trying to add a sheet with a surface to a specific location into the book when the user presses a button. However i do not know how to set a sheet position without also setting sprite and texture for that page. But then i do that the surface is not being updated. the surface is identical to the button surface code that i duplicated in example_set_surface. Any ideas?
 

Dragon47

Member
Hello, I am using your example code in gms:2. I am trying to add a sheet with a surface to a specific location into the book when the user presses a button. However i do not know how to set a sheet position without also setting sprite and texture for that page. But then i do that the surface is not being updated. the surface is identical to the button surface code that i duplicated in example_set_surface. Any ideas?
Not sure what you mean, but in obj_example_button's step event, you can see the code that chooses the specific page index to go to in the book upon button click.
 

chorrus

Member
I don't think so. There's a slim chance, but you likely have to do some work to get it to work. It was made for Windows, so no guarantees for other platforms.
Alright, thanks for the prompt reply! If I ever try it I'll let you know how it goes :)
 

Dragon47

Member
Alright, thanks for the prompt reply! If I ever try it I'll let you know how it goes :)
No problem. Thinking more about it, I don't think it will work out of the box as I recently worked on a project based on this asset with someone for Android and there were some graphics issues at the end. Managed to solve them, but haven't gone back and fixed it for the asset itself as I want to focus on other things. And I don't have a GMS 2 Android license either.
 
R

RadiumSkull

Guest
Hi @Dragon47 , thanks for this great asset package.

I'm sorry to report I'm having some issues with running the example right out of the box. When I import everything and set the Room 'rm_example' to run first, I get some compile errors under GMS 2.3.0.529. Syntax errors as well in other files.

Can you advise on the best way to deal with this? Admittedly, I'm using the DnD framework because it's easier for me. But I attempted the same with a GML setup and got the same results. Thanks.

ib_errors.png
 
Last edited by a moderator:

Dragon47

Member
Hi @Dragon47 , thanks for this great asset package.

I'm sorry to report I'm having some issues with running the example right out of the box. When I import everything and set the Room 'rm_example' to run first, I get some compile errors under GMS 2.3.0.529. Syntax errors as well in other files.

Can you advise on the best way to deal with this? Admittedly, I'm using the DnD framework because it's easier for me. But I attempted the same with a GML setup and got the same results. Thanks.

View attachment 35083
Ah, yeah, it seems like the 2.3 update has broken some stuff. I got the same errors. I went ahead and fixed those for this as well as my other GMS 2 assets. Seems I crashed the marketplace processing or got blocked or something before I could upload the last two assets, but at least I managed to publish this (Interactive Books) asset. So you can download that now and try again. Also, in case you didn't know, you can see what assets have been uploaded for v2.3 on the marketplace.
 

❤️×1

Member
In the current version of GameMaker (and in all previous versions back to September 2022), Interactive Books doesn't display anything. Could you take a look? Hopefully it isn't that hard to fix.
1681560279740.png
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
In the current version of GameMaker (and in all previous versions back to September 2022), Interactive Books doesn't display anything. Could you take a look? Hopefully it isn't that hard to fix.
They address this on their Marketplace page:

NOTE: I've got the asset working in version 2022.2.1.618, but I had to import the asset in an older version of GMS 2. If you run into issues with e.g. the book pages being invisible, try this: 1. Downgrade to GMS 2 version 2.3.7.606 (you can find it here: http://gms.yoyogames.com/ReleaseNotes.html). I use Windows by the way; not sure if the OS matters. 2. Import the asset into a blank project in the downgraded IDE (merging into existing projects might work too, but I haven't tested this). 3. Reinstall version 2022.2.1.618 (similar versions might work too). After this, the asset worked fine for me (both with Windows VM and YYC output), but importing directly in the new IDE version did not. Hopefully YoYo Games can fix this.
 

❤️×1

Member
Indeed, I did not check the description... Thanks for pointing it to me.

Then, I'd gladly buy it again on itch.io if you were to release it there, just to have it working : I'm still using a countryside internet connection and juggling between GM installations literary takes me hours.
 

Dragon47

Member
Sorry for the late reply. I'm not so active with GameMaker anymore, and maintaining things take time, so not sure if I will continue working on this. Hope you got things working.
 

Dragon47

Member
Hi again! Good news: I had an email waiting, which gave some very helpful information, and I have now published a new version for the asset (v1.7.0) which I have confirmed is working with direct import into the v2023.11.1 setup I'm running.
 

rIKmAN

Member
Hi again! Good news: I had an email waiting, which gave some very helpful information, and I have now published a new version for the asset (v1.7.0) which I have confirmed is working with direct import into the v2023.11.1 setup I'm running.
I'm glad the email I sent over on the cause of the problem helped you out!

I just tested it and can confirm it's working in the latest Beta version too and it doesn't matter if Copy on Write behaviour is on/off - both seem to work fine.
EDIT: That's IDE v2024.200.0.451 / Runtime v2024.200.0.461.

Thanks for the fix and publishing it so quickly - much appreciated! 👍
 
Last edited:
Top