Unity 3d Interactive Book Design - c#

I'm designing an interactive book using Unity 3d.
I've some ideas of how to do this but I'm not sure if it's the right approach.
This interactive book contains around 15 pages, in which 12 of those pages contain apart from text, some animations that the user can trigger.
There are also sound effects (e.g. storm sounds, birds singing, etc) and a background soundtrack. It's very likely that a narrator voice would be present during the reading of the text, because it's intended to be an accessible application.(e.g. blind people could not read so they have to listen).
I've been thinking in the following design:
Create one scene per page. The idea is to represent each page through a scene, so we will have around 15 scenes.
Each scene will contain sound effects, audio tracks, narrator voice, text of the book and animations that can be triggered by the user.
We will concatenate the scenes, simulating the effect of book pages.
There are some issues, for example page transitions, up to now, we don't know if they want some 3d effect, but I could use Page Turn Curl or Page curler (Assets).
Any ideas? Is this a correct way of designing this app?
Thanks in advance!

this is quite a broad question but if I was approaching this I would start with the following...
Create a base class called interactive page...
An instance of an interactive page would be able to do the things you mentioned (play narration, play animations, display text, turn forward & backwards a page etc.)
I would then create another class with a list (probably called pages) which would be filled with all the customised instances of the pages I wanted to add.
I would devote a class to managing this list and the pages contained in it. If I wanted to add more books, that's when I would consider using another scene, but even then I would probably just stick to one.
There are many ways to do what you are talking about and the above is only one way off the top of my head.
Hope this helps :)

Related

Augmented Images in ARCore - How to use more prefabs and to update trackables, in an easier way?

I'm trying to make a simple AR Images app, for students to use but, since I don't have much programming experience, I'm trying to just use and change the example files as the base for the app.
Until now, after many hours of trying, and reading about it, I still couldn't make it work with my own images and prefabs... Using AR Images should be the easiest thing in ARCore, right?
Could someone please help, by uploading a working base project, that is independent of the ARCore example files? Or at least the main scripts with these improvements:
using several images and prefabs, like 15 or 20 max.
an easier way, like a drag and drop prefab list, of corresponding the images number or name with the correct prefab...
...maybe like shown in ARCore + Unity + Augmented Images - Load different prefabs for different Images
an easier way of updating trackables - their state, adding and removing prefabs when visible or they get out of sight
I have seen some answers to individual problems, but it's hard to put all that in the scripts, without messing something else... at least for me it is ;-)
I think this could help a lot more people besides me, by updating this problem and putting several answers in one place. Thank you!
Using: Unity 2019.2 beta - ARCore 1.10 for Unity

How to prevent the rendering of unseen triangle in Unity3D?

In Unity3D the logic dictates that objects are not to be rendered unless in the field of view. This is obviously the way to go for optimization purposes. However, it still renders meshes that can not be seen by a player due to being occluded. I would like to solve this and was wondering if there was already a method to do so or if I had to do it myself.
Here's a picture to help illustrate my point.
So far my only real ideas are using the culling, but that still would be in a range not necessarily visible.
https://docs.unity3d.com/ScriptReference/Camera-layerCullDistances.html
I guess essentially what I need to know is how to do occlusion culling after a scene starts because the scene is generated, it's not premade.
For anyone who's interested, I asked the unity community
Answer by Bunny83 ยท 4 hours ago
No, that's not possible. At least not with the occlusion culling
system that Unity uses. The calculation which parts are visible from
which points is quite complicated and has to be precomputed in the
editor. So it won't work for procedurally generated levels.
You have to roll your own solution if you need something like that.
Just a few weeks (or month?) ago i implemented a VisPortals solution
similar to those used by Doom3 (basically how most ID Tech engines
work). It's more a prove of concept than a ready-to-use solution.
Usually i upload a webplayer demo onto my dropbox, however i just
realised that Dropbox finally prevented to directly view HTML pages
off my public folder. They now force a download of the page which
breaks everything. So if you want to try it, you have to download the
project.
Of course vis portals doesn't work in all situations. They are perfect
for closed environments which can be split nicely into seperate areas.
Of course this splitting into areas and the creation of the visportals
currently is done by hand. So you would need to automate this
yourself.
Be careful with static batching, it might break the system as each
area has to be seperate so it can be enabled / disabled seperately.

Creating Checkpoints in XNA

I'm making an XNA 4 game, and I want to create checkpoints for certain areas in my stage. I figured I could create a "ghost" object of the player object that would be created whenever the player reaches a checkpoint. And when you want to reload that checkpoint, you'll start to where that ghost player is.
As for now, I thought this would be an easy way to achieve this (although I think XML may be a better solution, but I've no idea on how to use that, yet). But the player has too many variables (health, stamina, ammo, bleeding timer, silver keys, golden keys, coins, infection, position, speed, angle, states [involve dying, infected, bleeding, burning, dodging, etc], I just thought that statemets like "continuep1 = p1;" (both are instances of the same object) would re-assign all the variables to the values that the other class contains, but when I tried to re-load "p1 = continuep1" it wouldn't work. It doesn't seem to do anything.
So I'm wondering, do I have to re-assign ALL the variables one by one? Should I start using XML? Or is there a way to assign all the variables without having to do it one by one? (I'm not asking for code, unless the last question is possible)
In my opinion I would say yes, start using xml. Don't worry about using xml, it's pretty simple once you get your head around it. A great way to learn would be to see your characters information displayed in xml format.
I think the most ideal option would be to serialize your game. So this involves storing the state of your character, the position it is at, the direction it is facing(which texture is currently loaded) and the stats(health, staming, bleeding etc).
With this you could reload your game from the last save when the player dies or when the game is next played. This would solve both cases.
This tutorial on making a top-down RPG game in Xna 4 is very good in my opinion and goes into good detail. Many of the techniques in this tutorial apply to more than just this genre and style of game.
http://xnagpa.net/xna4rpg.php
Part 11A(Game Editor) is the first part of a tutorial guiding the reader in making an editor for their game. With this Winforms project items, classes, quests etc can be added to the game and are stored as Xml files. At the bottom of page 6, and pages 7 and 8 outlines methods to serialize and deserialize your game.
In Part 11C(Game Editor), particularly at the bottom of page 9 and page 10. A save game method is introduced which serializes the game. You can also look at the new game and open game methods too.
These methods work with DataManager classes which store the items, classes etc in Dictionary's. This may be how you want to model your game information, if not the code in these guides may have to be altered to work with your solution.
I thought it best to provide my source for learning on this subject, rather than regurgitating it. I would recommend reading around this, not just the pages I've pointed to. Furthermore, in a later tutorial the serialization goes a step further and the files are stored in .xnb, which is a much more secure way to store information.
I hope this has helped and that you appreciate the guide in the right direction as opposed to just being given the answer. Besides, this isn't a task that would be solved in one method anyway.
Let me know how you get on and I'd be happy to help more.

Suggestions for a video montage application (extracting and playing randomized short clips from a playlist)?

I'm an electronics engineer used to coding in embedded C and assembly, but I decided to start learning higher-level stuff like C#, .NET, etc., so I can start making software as a hobby. I have a great idea for one of my first projects, but after searching several forums for days on end, I'm left not really knowing what would be the easiest path forward.
The functionality that I'm looking to create is pretty similar to the idea of a photo slideshow, but applied to videos instead. The program would open a playlist or a folder full of videos and then play the videos in a random order, starting from a random starting position, and with a fixed duration (let's say 10 seconds as an example). You would end up being able to watch a sort of "video montage" that consisted of small clips from random parts of the videos in the playlist, shown in a random order, ad infinitum until the program is closed.
There are a number of ways I could tackle the problem:
Develop a standalone video player with the fixed functionality of showing "video slideshows." DirectX has the Microsoft.DirectX.AudioVideoPlayback API that
could be a good starting point. I found an example here: http://www.dreamincode.net/forums/topic/111181-adding-video-to-an-application/
Modify an open source project to add the desired functionality. I've seen a few cool projects that could get me started, like this simple C# Movie Player: http://www.codeproject.com/Articles/18552/C-Movie-Player
Use a scripting interface to implement this functionality on an existing media player, like VLC or Winamp. You could also control VLC via C#, like the example here: Controlling VLC via c#
I realize that the obvious answer for most people would be to "use whatever you're most comfortable with," but since I'm a pure beginner, I don't really have any allegiances to a particular language or development environment. So, I was just curious if anybody had an idea of what might be the least painful option for a beginner.
I also apologize that this is not a very specific programming question. I'm sort of just testing the waters to get my footing. Hopefully, once I get started on the project, I'll be able to come back and post more intelligent and relevant questions!
While your background would lend you toward C#, I recommend investigating something like this and using WPF for the media player. You can then control the media player using a background worker in order to stop the video or queue up the next one. Some other .NET concepts that will be of use to you are FileInfo and DirectoryInfo objects, to provide you with the necessary information about the files. I'm not sure if you've had experience with generic data structures in .NET, but the System.Collections.Generic namespace would be a good place to start to get a feel for data structure you want to keep your playlist in. WPF will also be able to help you with transitions between video clips.
Admittedly WPF is easier with an understanding of the MVVM or MVC design patterns, but I think you'll be able to get something working without having to delve too far into that right up front.

Overlay the word/number in the Windows game fullscreen (like in Fraps)

I think a lot of people used application "Fraps" for recording video from game. I use it for displaying FPS (frames per second) in the games. Fraps can show digits at the corner of screen when game runs.
I want to display core temperature of processor. The temperature I will find, but I need to khow, how can I display it in the game? (I need it for testing core temperatures in the game, because stress tests of Everest/AIDA64 doesn't much load the system).
Want to use C# (but can listen to all solutions, C++, Java)
Example games: Dirt2, Call of Duty 5 (DirectX)
P.S. This post was similar...
c# text/winForm overlay video games like xfire,PIX,steam,fraps etc
What you want to do is a bit more complex than you might think. There are different sources on the web about this, some might be a bit outdated. A good search Term is "Hook direct 3d", there are also other threads on stackoverflow about this topic. A good thread is also this.
One advice: You are changing the runtime code of the game, which can be detected by anti cheat mechanism and can cause banning if the game is a multiplayer game. It is even possible that widely known applications like fraps are on some sort of whitelist against these checks, but i'm not sure about that.
An alternative to what you want could be to make your form always stay on top (form.TopMost = true;). Then you can set the transparency color the same color as your form (by default it would be form.TransparencyKey = System.Drawing.SystemColors.Control;). After that you can remove the border of your form (form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;).
Be careful not to use the transparency color anywhere else (it'll make part of images transparent if it contains this color).
Make sure to have a way of closing the form. (and moving it if needed).

Categories

Resources