Skip to content

Grasia/experiments

 
 

Repository files navigation

Designing a geolocalized novel

This is a localized version of Monogatari regularly synchronized with the original work from Hyuchia. For instructions on how to work with Monogatari, check https://monogatari.io/

Grab a copy of the game engine

https://github.com/Grasia/experiments/tree/main/sample 

And start using the new functions. There are the following examples:

  • guerra: it reproduces places from the spanish civil war in the Universidad Complutense with geolocation
  • guerravirt: same as guerra but without gelocation
  • pabgob: history of the Pabellon de Gobierno building from the Universidad Complutense with geolocation
  • pabgobvirt:same as pabgob, but without geolocation
  • teruel: a guide through Teruel city that includes a survey to obtain high quality answers
  • teruelgeo: same as teruel but with geolocation

Basic Geolocation

The goal is to indicate in the novel that a location has to be visited to continue.

First, choose the locations in google maps. For each location, select "what's here" to get latitude and longitude. Copy those coordinates somewhere.

image

Then, in the file js/script.js of the release, proceed to the line where geolocation is defined. For each pair of coordinates, define a name and associate the coordinates to that name

monogatari.geolocations({ "place1":{latitude:40.437542, longitude:-3.724985}, "place2": {latitude:40.437912, longitude:-3.724768}, "berlin":{latitude:52.520007,longitude:13.404954} });

When defining the game. You can give the player 60 seconds to reach the destination with 100 meters precision.

{'ConditionalGeolocation':{ 'Condition':"geolocate place1 1 60 0.1", 'False':'nope, dude', 'True':'alright, you got there' }

The geolocation commmand has this format

geolocate LOCATION_NAME REFRESH_PERIOD_SECONDS TIMEOUT_SECONDS PRECISION_KM

It may be needed to give the player more time. To interact with the player in the meantime, this code can help:

function randomInt(min, max) { return min + Math.floor((max - min) * Math.random()); };

monogatari.script({"randommessage":[ {'Conditional': {

'Condition': function(){
    return randomInt(1,4)+"";
},
'1': 'move!!!',
'2': 'what are you waiting for?',
'3': 'do not be lazy',
'4': 'turtles are faster than you'

}},"return"]});

monogatari.script({"firstplace":[

{'ConditionalGeolocation':{
	'Condition':"geolocate place1 1 60 0.01",
	'False':"call randommessage",
	'True':'finally got here'}
},"call firstplace"]});

monogatari.script ({ 'Start': ["call firstplace", "you made it!!"]});

Advices: • Do not aim for precision lower than 50 m (0.05 km) • Do not set a too low timeout for reaching the destination. The GPS takes at least 2 to 5 seconds to get a position. • There maybe jumps in the GPS location. It is preconfigured a high precision gps location, but not all phones may achieve it • Try waypoints to be more than 100 meters away (0.1 km)

Forms

Forms are used to capture data from the user. It is useful to run surveys in the middle of the novel. monogatari.customForms({ "opinion":{ "schema": { "title":"User Feedback1", "description":"What do you think about Alpaca?", "type":"object", "properties": { "name": { "type":"string", "title":"Name" }, "ranking": { "type":"string", "title":"Ranking", "enum":['excellent','ok','so so'] } } }, "options": {"form":{ "buttons":{ "submit":{ "title": "Enviar" } } } }, "view" : "bootstrap-create" } }); monogatari.script ({ 'Start': [ "customform opinion", function(){ monogatari.setContentToSend(monogatari.getFormResult("opinion")); return true; }, "sendaction pabgob opinion", }); Sending data Data deliver to a server. The server is preconfigured. This helps to create checkpoints in the novel and determine where the user stopped following the story. "sendaction pabgob delivered", Characters Warning, move animation does not work. "show character sylvie normal at left with fadeIn end-fadeOut", Call/return

Monogatari adds basic goto functionality. To reuse pieces of your novel, this command enables to jump to labels and return back. For example, the following code issues a random message generated by a script. It reuses a label that has a choice within.

function randomInt(min, max) { return min + Math.floor((max - min) * Math.random()); }; monogatari.script({"randommessage":[ {'Conditional': {

'Condition': function(){
    return randomInt(1,4)+"";
},
'1': 'move now',
'2': 'what are you waiting for?',
'3': 'don't be lazy',
'4': 'a stone move way more than you'

}},"return"]});

monogatari.script ({ 'Start': ["call randommessage","first call", "call randommessage", "second call","end"]}); Panoramas These are 3D constructions that can be seen in an inmersive way with the movile. It uses Panolens. "panorama cubemap panorama/cube/dibu png -4774.9 474.16 -1375.02 waving.gif", {'ConditionalPanorama':{ 'Condition':"panorama equi panorama/pano png -4774.9 474.16 -1375.02 hand.png", 'False':"Has fallado", 'True': "Lo conseguiste"}},

Troubleshooting

The direction arrow moves and turns noticiably without moving it. This is a sign the device needs calibration. Go to the google maps app and open the manual calibration. It should at least say “medium” to have a reasonable quality. https://www.howtogeek.com/519142/how-to-calibrate-the-compass-on-android-to-improve-device-location-accuracy/#:~:text=Calibrating%20Your%20Android%20Compass%20in%20Google%20Maps&text=Open%20the%20Google%20Maps%20app%2C%20making%20sure%20that%20your%20blue,location%20icon%20is%20in%20view.&text=Tap%20on%20the%20location%20icon,up%20the%20compass%20calibration%20screen. A video ilustrating the process https://www.youtube.com/watch?v=cCMVQ5hxrRM

https://medium.com/@aramvr/8-javascript-tools-to-create-360-degree-photosphere-viewers-85261f86aeb3 https://github.com/bhautikj/vrProjector https://github.com/Xyene/cube2sphere

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.4%
  • CSS 1.6%
  • Other 1.0%