Testing Dagon for Unity


#21

BTW would be great to know your thoughts about the new camera movement and cursor system :slight_smile:

Sent from my iPhone using Tapatalk


#22

The camera movement was fine and everything looks beautiful, though I got tearing when at full screen. The clouds moved. I could hear the wind sound and the footsteps, but no comments and not subtitles/text.

The cursor only appeared when there was a link or a look to be had. If this is as intended and not a glitch in the sample project, my first reaction is that I don’t like it. Is this the new Point-and-Use? The cursor was not where I thought the cursor should be as I moved the mouse and I missed the constant cursor swiveling as I moved.


#23

I’m aware of your thoughts on the series, but Myst 4 implemented almost exactly the same thing and I felt it did an excellent job. The only difference was that the hand was always present in a neutral state but animated into a pointer or picked up little magnifying glass where there was something actionable. Here’s a part of a play through that shows what I’m talking about: https://www.youtube.com/watch?v=XFTbSyRCUYE&list=PL61F4381BCBE9F402#t=556

I’m wondering if a little animation would go a long way with the Asylum hand.

The camera system feels so right, much better than before.


#24

I mostly spent the day inventorying the folders, especially the Games folder. I needed to know where things should go and in what size and format. Below is my inventory with some comments. As is, for now, but I thought it might prove useful to someone. Once I know more, I’ll revise and pretty it up.

FILES IN THE GAME FOLDER
Assets > Game > Data
Contains the file Data.json, which lists the categories within the Inventory, and Spots.json, which just says “{}”.


Assets > Game > Environment
Contains the clouds and sky sphere objects in FBX format.

Assets > Game > Environment > Materials
Contains the Unity mat files for the clouds and sky and the sperical panoram mats. For your own game, you’ll need to add your own clouds and panorama images to the Assets > Game > Environment > Textures folder and then create the your mats for them in Unity.
Note: clouds mat = nubes_test.mat; skydome mat = test_domo_cielo_esfera.mat

Assets > Game > Environment > Scenes
Contains the Environment.unity scene file. Double clicking this file will open Unity to this scene.
You must already have installed Unity 4.+ or higher.
If you are using the free version of Unity, you must edit the file - Assets > Dagon > Scripts > Controllers > SpotController.cs (Thanks to Finn for this essential tip!)
In a text editor, do this:
Go to line 118 (‘LoadAttachment’ method) and comment out the line:
// LoadVideo ( attachment );

In Unity, on your Scene window, you should see the camera and a light surrounded by a large cube, which in turn is surrounded by a large sphere and topped with a hemisphere. This is the basic set-up upon which your cubic panoramas and sky/clouds are projected.
You can hold down the right mouse button to look around in the Scene window or use the mouse wheel to move your view in or out of the scene.

If you navigate in Unity in the Hierarchy window to Dagon/ GameController / CurrentLocation /CurrentCanvas, you can click through the six sides of the cube. Rather than swap out the cube (or sky, etc.) object during game play, your Dagon scripts change the images projected on the same cube and sky spheres as play progresses. You’ll also see that the scene is encircled by eight cubes. These are the directional targets/triggers for linking to the next node. In Dagon/ GameController / CurrentLocation /CurrentLinks you can see that the eight cubes represent the cardinal directions used in the game. In clockwise order the cubes represent: N = ‘north’, NE = ‘north-east’, E = ‘east’, SE = ‘south-east’, S = ‘south’, SW = 'south-west, W = ‘west’, and NW = ‘north-west’

If you switch to the adjacent Game window tab and click the play arrow above it, you can look at the sample game. Click the “maximize on play” bar at the upper right of the Game window, if you want to run the game full screen.

Assets > Game > Environment > Scripts
Java scripts that control the lighting, sky sphere, sun, and cloud rotation, fog (in Unity pro only). Agustin mentioned that Dagon uses special shaders for the lighting so that the edges of the cubic panorama seams do not show.

In Unity, you can navigate to your assets in the Project window and view the contents of the script in the Inspector window with a single click on the script’s icon. I wouldn’t edit these scripts, but you can edit scripts in Unity’s included Mono by double clicking on the script’s icon.

Assets > Game > Environment > Shaders
Contains a single ColoredClouds.shader.
In Unity shaders are applied to materials, which are then applied to your objects. You can use textures in making materials and add a shader to alter the govern how the material reacts to light.
For a better explanation, read here - http://docs.unity3d.com/Manual/Materials.html

Assets > Game > Environment > Textures
Contains the JPG images for use in making the environmental materials.
Image sizes:
Clouds_Diffuse.jpg - 2048 x 2048, 72 dpi, 24-bit RGB
Clouda_Alpha.jpg - 512 x 512, 72 dpi, 8-bit grayscale
*_Sky.jpg - 3,072 x 1,536, 72 dpi, 24-bit RGB, spherical panorama


Assets > Game > Interface
Assets > Game > Interface > Smart Cursor
Assets > Game > Interface > Smart Cursor > Cursors

The cursors image files in TGA format go here.
They are, normal, forward, backward, left, right, up, down, downleft, downright, upleft, upright, look, use, talk, dragging, and custom. The cursors provided depict hands. The look cursor holds a magnifying glass, talk holds a microphone, and custom is holding a pencil. Images are 128 x 182, 72 dpi, RGB, TGAs with transparency. In Unity, they appear as RGBA Compressed DXT5.

Assets > Game > Interface > Smart Cursor > Resources
Assets > Game > Interface > Smart Cursor > Resources > Animations

Contains *.anim foles for Hidden, Highlighted, PointerClose, and SmartCursor, but I’m not certain that this section is functional in the sample game.
Assets > Game > Interface > Smart Cursor > Resources > Prefabs
Contains a SmartCursor.prefab
Again, I’m not certain that this section is functional in the sample game.


Assets > Game > Resources
Assets > Game > Resources > Audio

Your ogg sound files go here.

Assets > Game > Resources > Languages
Contains your localization files for each language as a JSON text file. You feedback text for look/touch reactions goes in these files. In Dagon, the feedback/comments were in the English.lua file.

Assets > Game > Resources > Locations (make a separate folder per location in your game)
This is your old “Nodes” folder with the TGA cubic panorama sides converted to PNGs and includes your associated OGV video files. Your various areas/locations are separated into sub-folders. The name of each area’s sub-folder should correspond to each room/location lua file in the Assets > Game > Resources > Scripts > Locations folder.

Assets > Game > Resources > Locations > Yard (an example location)
Contains your cubic panorama images, patch images, slides images, and video files.

Note: In this folder, *.ogv files are labeled as “.ogm” The OGM Ogg Vorbis video files, contains audio and video stream in high-quality XVid, Theora, or DivX video format. OGM files will not play natively on computers. I get a very pixelated 8-bit color scheme when I try to play them with a double click in Windows Explorer.

The cubic panoramas are in six separate images named, MyLocation_001 = front/north, MyLocation_002 = right/east, MyLocation_003 = back/south, MyLocation_004 = left/west, MyLocation_005 = up, and MyLocation_006 = down. Cube sides = 2048 x 2048, 72 dpi, 24-bit RGB.
Cube face image size: 2048 x 2048, 72 dpi, RGB with transparency. In Unity, they are compressed to DXT5. (Note: According to Wikipedia, DXT5 converts a 4×4 block of pixels to a 64-bit or 128-bit quantity, resulting in compression ratios of 6:1 with 24-bit RGB input data or 4:1 with 32-bit RGBA input data. S3TC is a lossy compression algorithm, resulting in image quality degradation, an effect which is minimized by the ability to increase texture resolutions while maintaining the same memory requirements. Hand-drawn cartoon-like images do not compress well, nor do normal map data, both of which usually generate artifacts. http://en.wikipedia.org/wiki/S3_Texture_Compression)

I’m making a guess that the images for patches and slides also go into these folders, thus dividing up the Dagon image folder. The slides were 1920 x 1200 pixels, 24-bit RGB PNG files. I assume that images for Dagon modules that use overlays such as the intros, splash screens, inventory, and other HUD elements will need to be done with Unity’s GUI system or an add-on component from the Asset Store.

Assets > Game > Resources > Scripts >
Contains the Main.lua file, which is a very abbreviated version of Dagon’s main game.lua file (the Asylum.lua file in the old demo).
It requires/initializes the Dagon modules legacy and standard files and specifies your first room and node. The sample file also plays the background audio at start-up. Also contains the asset file for the Main.lua. I’m not sure what this is.

Assets > Game > Resources > Scripts > Locations
Your location files go here in LUA format. These are the same as the Dagon room files and contain most of the interaction in the game, including links between the nodes and locations. A location file first calls the Dummy.lua, which is a blank template. Dagon called each of the location/room files that were accessed from this room by link, door, or function and I assume that Dagonity requires this as well. The location file contains the list of nodes in the room, the links between them and other locations/rooms, the doors, audio (footsteps and background music or ambience), spots (hotspots), videos, and interactions (functions and things).

A room is just a collection of nodes. It can contain just the nodes in a single room in a house or all of the nodes in the entire house. It just depends on how much information needs to be managed in the file. When the file become unweildy, it is best to split it into two or more room/location files.

Note: The name of the LUA file for a location/room should correspond exactly to the area’s sub-folder in the Assets > Game > Resources > Locations folder, which contains the cubic panorama images and video files associated with the area.

Assets > Game > Resources > Scripts > Modules
This folder currently only contains the module for Tools. This contains directional info and basic code for door links. The Dagon tools module contained more functionality, including controls for camera speed, snapshots, and gamma levels.

Note: Only for of the cardinal directions are listed in tools (NORTH = ‘front’, SOUTH = ‘back’, EAST = ‘right’, and WEST = ‘left’).
I assume this is an oversight and that the four other cardinal directions should have been included as well?


Assets > Game > Scenes
An empty folder. Perhaps a place for 3D object files, since the Scene file is in the Environment folder.


#25

Thanks! Very helpful. Do you have any hints on why the sample doesn’t appear to work properly when you try and compile it? The realtime preview was being weird with the mouse controls.


#26

I think you need to load the nodes first. I did that and it compiled properly.

Load the environment scene first by double clicking. Then choose Dagon --> GameController. In the inspector menu there should be a Load option under Reload Game Data. When you do that it you can see the node in the editor too.


#27
Load the environment scene first by double clicking. Then choose Dagon --> GameController. In the inspector menu there should be a Load option under Reload Game Data. When you do that it you can see the node in the editor too.

That worked! Might be worth noting that the “load” option only seems to appear after you’ve tried running the game in the realtime player first.


#28

Sorry, I’ve not tried to compile. I had to use Finn’s excellent suggestion about the video and then to delete all of the meta files, before it would load without a lot of errors. I think that’s mostly because of the fact that I’m using free Unity and not Unity Pro. I’m pretty sure the missing comments are due to that as well.

I’m working on porting my game to Dagonity, which i think is going to take some doing since I was fairly far into it. Will report back soon.

Thanks to Agustin, Francisco, Pablo, and the rest of the Senscape team for getting this to us when they are otherwise so busy.


#29

Wow, Imari, terrific job documenting the hierarchy of folders! This is definitely wiki material :nod:

A few general comments:

  • I suggest commenting the game script rather than the engine code. Fiddling with *.cs can break things. The problem with missing interactions is surely related to videos not working. I’ll try to upload a sample with normal spots later.

  • Some names of materials are wrong because Unity always insists in reimporting them. So nubes_test.mat and test_domo_cielo_esfera.mat aren’t used.

  • We don’t need shaders to hide the seams in the cubemap, but rather import the textures with “clamp” tiling. You’ll want to make sure you use at least bilinear filtering to avoid an annoying moire effect.

  • The atmosphere scene is actually part of the Asylum code, so it’s not “official” Dagonity. Our plans is to ship the standalone plugin and allow you, the users, to integrate Dagon with your Unity scene by simply dragging the Dagon prefab into it. We still might add a helper scene to get you started, similar to this DagonitySample.

  • The cursors also belong to Asylum and the SmartCursor is already operational (it’s the “look and click” system).

  • Using compressed textures in Unity is equivalent to the former TEX format in Dagon++.

  • I suggest including image patches inside the subfolder of a location (as you’ve guessed, locations would replace the previous rooms objects in Dagon++).

  • I explained a bit what the .asset files are in the readme of the repo. This is a necessary evil to turn text scripts into “resources” for Unity. No way around.

  • WARNING! The new syntax is subject to change. We’re still doing improvements and polishing, especially as the inclusion of Things changed the way Spots are handled. I’m going to document the new API and note the differences since Dagon++ as soon as I can. I’d suggest you wait before migrating loads of code to Dagonity.

As always, you need to ask yourself if Dagonity is worth the effort for your game. We ARE planning to maintain script compatibility with Dagon++ after all :slight_smile:


#30

It’s planned! Very easy to do with Unity now.

The camera system feels so right, much better than before.
Glad you like it :)

#31

Thanks for the reply, Agustin.

I think that I’ve almost got it working for a small test area. (The whole game was just too unwieldy. ???). I have my sky and cursors working fine. I had to rename my cube sides from *0001. to *_front, before they would show up at all. Before I changed the names, I just had a sky and no cube visible. The cube faces are showing now, but they are separated. They are 2048 x 2048 PNGs. Here’s a screenshot to show what’s happening - https://www.dropbox.com/s/xd6ob8bj6kw0wnc/Screenshot%202015-01-11%2012.03.04.png?dl=0

Other than to do Finn’s video fix, I haven’t touched the cs or java files. I’ve tried removing all the meta files and also replaced the engine files for fresh starts, but without fixing the problem. Suggestions?

EDIT: Sorry, guys, I’m an idiot. I got so caught up in getting Dagonity to work that I forgot Unity. :-[ I just needed to make the Max Size of my cube faces 2048. Unity had reduced them by half.

For anyone having the same problem, just select all of your cube face images in the Project window, then change the Max Size to 2048, and hit Apply. :sorry:


#32

Agustin, I hesitate to post this, because I have not gotten my test game to work in Dagonity [ :retard:], but I’ve been writing things up as I worked. So, here are the steps that I’ve used to get this far. (Fellow testers, follow this at your own risk. I’ll revise, if I finally figure out how too get things up and running.]

[b]DAGON ASSETS INTO DAGONITY:

STEP 1 - SET-UP[/b]
1. Download and unzip the Dagon-Unity Master (engine) and the DagonitySampleProject zips from Github. (Access must be granted by Agustin.)

2. Make a folder for your game. I called mine - !Adamantus-Dagonity

3. Copy the contents of the DagonitySample folder (the Assets, Library, & ProjectSettings folders) into your game folder.

4. Move the contents of the Dagon-Unity master folder into the Assets > Dagon folder.

5. At this point you can begin replacing the sample games assets with your assets.

Note: If you have already installed Unity Pro 4.0 or higher and want to test out the Dagonity Sample game, you can do that now. Navigate to the Assets > Game > Environment > Scenes folder and double click the Environment.unity scene file.

If you are using the free version of Unity, you must edit the file - Assets > Dagon > Scripts > Controllers > SpotController.cs (Thanks to Finn for this essential tip!)
In a text editor, do this:
Go to line 118 (‘LoadAttachment’ method) and comment out the line:
// LoadVideo ( attachment );

Note to the Note: Agustin says that the CS files should not be touched as they are part of the engine itself. It’s better to make fixes in the LUA files. However, Finn’s fix worked for me for now. :stuck_out_tongue:

Edit: Even with reimporting all files to Unity, I did not see my own assets employed until I started fresh with all *.meta files deleted from the DagonitySample project and from the Dagon-Unity master file. (Unity will make new meta files when it imports your project and this step helps to prevent errors.) However, Agustin says that this is not necessary and may even break Dagonity.

STEP 2 - ADD YOUR ASSETS
You must add your images, room scripts, videos, etc. into the game folder, replacing the sample game’s assets. When you open Unity, it will import your files and make meta files automatically.

Your game content goes in the Assets > folder as follows -
1. Put your font files in the Assets > Dagon > Resources > Fonts folder.

2. Put your images for clouds and cubic panoramas in the Assets > Game > Environment > Textures folder.

3. Replace the cursors in the Assets > Game > Interface > Smart Cursor > Cursors with your own cursor images.

4. Put your OGG audio files in Assets > Game > Resources > Audio.

5. Your old English.lua module file, which contained textual feedback/comments for touchable/useable items or spots should be converted to a localized language file in
JSON format file and placed in Assets > Game > Resources > Languages. The sample game contains an English file that can be used as a model, en-US.json. (As the comments didn’t work for me in free Unity in the sample game, I’ve left the file included in the sample “as is” for now.)

6. In the Assets > Game > Resources > Locations > folder, make a sub-folder for each of your locations/rooms. Make sure each sub-folder is named exactly the same as each location’s LUA file.

7. Place your cubic panorama images, patches, slides, and videos for each location in the corresponding sub-folder. The images needed for each node are the six sides of the cubic panorama and for Dagonity should be in 2048 x 2048 pixel JPGs or PNGs. You’ll need to use PNGs with transparency, if you want the movable sky and clouds to show. If you are converting from Dagon to Dagonity, you’ll need to delete your old TEX files and the nodes folder and convert your original TGA files into PNG or JPG format. (I had to rename my cube faces to be front, right, back, etc. instead of 0001, 0002, 0003 before Dagonity recognized them.)

The slides in Dagon are 1920 x 1200 pixels, 24-bit RGB PNG files. Divide up your videos and place them in the corresponding sub-folders as well.

8. The “main.lua” in Assets > Game > Resources > Scripts > needs some changes. Change the ambient sound or music at start-up to one of your choosing and change the starting location and node to the first node of your game.

9. Place your location LUA files in the Assets > Game > Resources > Scripts > Locations folder. These are the files in the Dagon Rooms folder and contain most of the interaction in the game, including links between the nodes and locations. (Agustin says that most of the old room files should work in Dagonity. Pray it’s so.)

10. Modules go in the Assets > Game > Resources > Scripts > Modules folder. Currently, this only includes the tools.lua module.

Note: I assume that the modules relating to overlays, inventory, intro, journal, splash screens, etc. will need to be in a separate GUI folder and sub-folders. I think those HUD-like elements could be made to work with Dagonity now, perhaps with the aid of an add-on component from the Asset Store, if one were proficient with Unity, but the functions of the old modules are not a part of the current sample game. I assume that the images, sounds, custom cursors, etc. related to the HUD elements will require a separate GUI folder and sub-folders within the Game > Assets folder.

I assume that there will also be a folder for any 3D objects and characters.

There’s a Games > Scene folder, that’s empty for now. It might be useful if you wanted to make a separate scene for a mini game, puzzle, or “live” cut-scene.


#33

Fantastic write-ups Imari!! So much useful info in there. :nod:

Unfortunately been too busy to delve much further this weekend but hope to get a bit of time over the next few days so this info will be really useful.

Agustín, it would probably be useful to have a fallback for attempts to attach videos (and any other Unity Pro-only features). When the LoadVideo method is called in SpotController.cs, detect if video is available in the version of Unity being used. If video isn’t supported, bypass any video-specific code and output a debug warning to the console. That way, at least the rest of the code would execute OK with erroring out. Better still, fall back to a non-video alternative (e.g. default spot) - that way, any interactions could still be applied.

With regards to camera movement and icons:

[ul][li]The way the camera moves exactly with the mouse movement is perfect - this is definitely my preference for how it should work (as opposed to ‘pushing’ the camera when at the screen edge as before).[/li]
[li]As for the icons, can definitely see the appeal and they’re quite innovative. They are probably the best approach for touchscreen devices. I’m not 100% sure for desktop, though. Personally, part of the fun in adventure games is finding interactive areas without them being signposted (it’s like a mini reward). Like I said, this is personal preference (makes the game last longer!) and others might prefer the icon signposting. It’s not that I dislike the icon approach - it’s more that it feels a bit too easy, I guess. Maybe playing the backer demo will give a more solid opinion one way or another. Would be nice if there was an option to turn icons on/off and the option to have the permanent cursor at the centre of the screen - that way everyone would be satisfied.[/li][/ul]


#34

It’s certainly and interesting twist, but I felt a bit disoriented without a constant cursor. Perhaps I’d get used to it, but when the cursor did appear, my imagined hand was always away from it and usually well to the left of it.


#35

Interesting, it shouldn’t be necessary to delete all the .meta files. In fact, that could be breaking things, but if you say it works! :stuck_out_tongue:

Finn, regarding the new cursor making things easier, keep in mind that Asylum is so big and there’s so much stuff to investigate, that I believe such a helper is a must. Let’s see what other backers of the project have to say about it, though.


#36

Yo! We have a wiki. Check it out :slight_smile:


#37

the same as before? I don’t see anything other than the Asylum and Dagon projects under Senscape on Github. (looking for the wiki)


#38

No, new one. What was your GitHub username?


#39

Nice start to the wiki, guys.

We have all 16 cardinal directions available now? Nice! That should save a lot of typing of coordinates.

Question: Has the naming convention for for cube faces been switched back to _front, _back, _left, etc. instead of Dagon’s 0001, 0003, 0004, etc.? My test nodes didn’t show up until I changed the names of the cube faces. Honestly, I was trying to test only one change at a time, but in fiddling I may have changed something else at the same time and that made them show up.


#40

Ah yes, we thought it would make managing assets easier if we just use the actual English name of each face :slight_smile:

I’m working on the new syntax, writing the wrappers that extend the engine functionality to Lua. Since we all seem to be migrating functionality to the new standard (Things, new spot system, etc), I’m going to break compatibility with older scripts for now (that “require ‘dagon/legacy’” line won’t work anymore).

Everything will be documented, and I will provide a cheat sheet that compares the differences between old Dagon and new Dagon.