3DAPP:Template Guide

From Docs.kaneva.com
Jump to: navigation, search

Contents

Included Templates

The following is a list of the included templates and what specifically they are demonstrating in the 3D Application API. Choosing a template that best matches your goals as an application designer will greatly enhance your chances of creating a successful Kaneva 3D application.

To see all the templates and their source code, go to the default Kaneva directory C:\Program Files\Kaneva\Kaneva Platform\Templates.

Default Template


This app demonstrates a simple game with a variety of the viral APIs implemented. A basic HUD, game economy, level system, badges, leaderboards and more are included. It should be a simple task of removing the included game and creating your own.

Demonstrates

Friend invite system, premium items, gifting system, badges, leaderboard,
emotes, leveling system, toast system, App HUD, sound effects, shop

Default Template: Beginner's Guide
Default Template: Advanced Guide


Setup

The following will help you setup your App to be viewed by other peeps.

  • Create your 3D App
    • Open the 3D App Editor
    • Select App->New
    • Login and select "Create another 3D App"
    • Enter a 3D App name ("Preview" and "Tech Preview" are reserved)
    • Complete the setup process
  • Setup your KanevaWebHelper
    • Login to Kaneva2D and select the "My 3D Apps" tab
    • Select "Manage 3D App" next to your new 3D App
    • Click "Game Information"
    • Click "Create" to generate a Consumer Secret and Key
    • Open Windows Explorer
    • Navigate to Documents\My 3D Apps\YOUR APP NAME\GameFiles\ScriptServerScripts
    • Open 36.lua
    • Under function kgp_start(user), you'll see "setupWebHelper( ... , ... , true)"
    • Enter your Consumer Key and Secret respectively and save the file
  • Create a distribution
    • Open Start Menu
    • Click "All Programs"->"Kaneva"->"YOUR APP NAME"->"Create Distribution"
    • The 3D App Editor should open, do all the work for you and close on its own
  • Start your server
    • Open Start Menu
    • Click "All Programs"->"Kaneva"->"YOUR APP NAME"->"Run 3D App Server"
    • A command window should open with a bunch of scary text in it. It's your server running. Leave it be.
  • Login to Kaneva 3D and open your Dashboard
    • Click 3D Apps and select "Only My 3DApps"
    • Your new app should be shown
APIs Used

Sandbox Template


This app demonstrates a variety of new APIs. Useful to study to see what API's are available and how they get used. More advanced usage of API's appears in the Texas Holdem API's.

Demonstrates

Nearly every API available.

Setup

The following steps will show how to configure this app to use Kaneva Web APIs.

  • NOTE: If you have already started your server, please stop the server and complete the tutorial.
  • Create a new 3D App and install the template
  • Before you run the server do the following steps: (these steps are also outlined a menu when you go to your app)
    • Generate your 3D App OAuth key and add it to the scripts:
      • Navigate to My 3D Apps tab
      • Choose "Manage My 3D App" for the 3D App that you installed this template
      • Click the "Create" button just below the name of your 3D App in the '3DApp OAuth Key' section. Keep this page open so you can copy and paste from it later.
      • Now go to the folder on your server's computer where your 3D App is located (My Documents/My 3D Apps/Your App/)
      • Go to the Distribution/Server Files/ScriptServerScripts/SavedScripts folder
      • Open WebIds.lua
        • Copy and Paste your Consumer Secret from the web page to the variable 'gSecret2' in the lua file
        • Copy and Paste your Consumer Key from the web page to the variable 'gKey2' in the lua file
Instructions
  • Room 1
    • Upon entering the zone, the camera will move to a side view. The view will then be reset.
    • The names of the new APIs will be printed in the chat menu when they are executed behind the scenes.
    • Enter a new name in the Player Name box and press enter to change the name above the player's head.
    • Press Hide Player to hide the player. Press it again to unhide the player.
    • Press Hide Dog to hide the dog. Press it again to unhide it.
    • Press + under Player Size to increase the size of the player. Press - to decrease the size of the player. Press Save to reload this setting upon subsequent visits. Press Clear to remove the stored custom player size.
    • Press + under Dog Size to increase the size of the dog. Press - to decrease the size of the dog.
    • Press Attach Sound to Player to play a repeating sound that is attached to the player. The dog will turn towards the player (currently not working). Press it again to stop the sound.
    • Press Attach Sound to Dog to play a repeating sound that is attached to the dog. The player will turn towards the dog. The loudness of the sound will change based on your distance from the dog. Press it again to stop the sound.
    • If another player is in the zone. Pressing Spectate will cause your camera to follow that user.
    • Pressing Moon Walk will lower the gravity allowing the user to jump higher and fall slower. While in this state, you can jump through the portal to enter Room 3. If you press this button again, gravity will return to normal.
    • Pressing Wind will cause wind to blow, which will push the player if it is not moving. Pressing it again will turn the wind off.
    • Pressing Random Light Effect will randomize the effects and color of the light hitting the player. Each press will result in another random set of light values. To remove these effects, you have to leave and come back.
    • Pressing Fog will cause the zone to be filled with fog. The further the player moves away from the other objects, the more difficult the player will be able to see (assuming the camera has not been reset). If the camera has been reset, then the objects will become more difficult to see the further the player moves from them. To remove this effect you have to leave and come back.
    • Pressing Particle Effects on Player will cause a basic particle effect to originate from the player. Press it again to stop the particle effect.
    • When you join the zone for the first time, a playlist will be generated and will play automatically on the TV. If you click the TV again, the playlist information will be printed to the ScriptServer.log file. If you click it after that, it will play the next video in the list and will start again from the beginning once you reach the end of the list.
    • Click the door to join Room 2.
    • Click the portal to print out the its object data from the store.
    • Click 'Only You Can Hear It' to start a song that only the current player can hear. Press it again to stop the song.
  • Room 2
    • The globe should be spinning as a result of texture panning. If you click the globe, the particle effect will emit particles from the globe. Click it again to turn off the particle effect.
    • If you click the horse, a raycast will be cast (not visible) from the chest of the player. If the horse is in the path of this ray, then it will neigh and the distance to the horse will be printed in the chat window. If the horse is not in the path of the ray, then "Raycast missed" will be printed in the chat window.
    • If the click on the Fairy, it will start an event sequence that includes an animation, a sound, and a particle effect.
    • There should be a label above the fire pit that says "Click to start fire." If you click the fire, an ambient fire sound will play. Also, a fire particle effect with a poof effect will loop until you click the fire again.
    • If you click the floor, the player will teleport to the center of the table and sit. Then a sound will play and the player will start to do The Macarena.
  • Room 3
    • If you click play, you will hear the repeating sound of a rooster. If you press the button again the sound will stop.
    • You can use the slider to adjust the delay between the two sounds.
    • If you click on one of the TVs, a flash file will play. If you click a second time, it will stop.
APIs Used

Adventure

Battle!


The Battle! Template is currently one of the most popular templates available, and in this section is a number of helpful pages for modifying the template as you see fit; as well as general documentation.

Battle: Update Info

Battle: Custom Weapons

Battle: Events

Epic Battle


Create a diverse, multiplayer game full of weapons, powerUps, invites, gifts and everything you need to build a complete, exciting game!

Epic Battle: Release Info

Club


Create a unique Club experience, complete with dance floors, bartenders, gifts, badges and more.

Check out all the great content we've packed the template full of from our talented designers - Club: Content Credits

Club: Item Library

Game World


The Game World Template is designed to be an open-ended environment that empowers users to create a wide variety of Worlds with possible gameplay elements included. Gameplay is customized and added to the template through the use of Action Items. Check out the guide below to see how to use your Action Items in the Game World Template.

How To: Game World Action Items

Texas Hold'Em Poker


This template is a multiplayer texas holdem poker game. It is designed after a regular cash poker game where players can leave and come as they wish. In the zone there is a large table with 9 chairs surrounding the table. Each chair has a script attached to it which manages a players chip stack. There is also a script that manages the main pot's chip stack.

Template Tutorial

The following steps will show how to configure this app to use Kaneva Web APIs, create Badges, and create Leaderboards.

  • NOTE: If you have already started your server, please stop the server and complete the tutorial.
  • Create a new 3D App and install the template
  • Before you run the server do the following steps: (these steps are also outlined a menu when you go to your app)
    • Generate your 3D App OAuth key and add it to the scripts:
      • Navigate to My 3D Apps tab
      • Choose "Manage My 3D App" for the 3D App that you installed this template
      • Click the "Create" button just below the name of your 3D App in the '3DApp OAuth Key' section. Keep this page open so you can copy and paste from it later.
      • Now go to the folder on your server's computer where your 3D App is located (My Documents/My 3D Apps/Your App/)
      • Go to the Distribution/Server Files/ScriptServerScripts/SavedScripts folder
      • Open WebIds.lua
        • Copy and Paste your Consumer Secret from the web page to the variable 'gSecret2' in the lua file
        • Copy and Paste your Consumer Key from the web page to the variable 'gKey2' in the lua file
    • Add the poker Badges to your 3D App.
      • Go to the Distribution/Server Files/ScriptServerScripts/SavedScripts folder
      • Open HoldEmBadges.lua. You will see a list of Badge names (e.g. BADGE.FRIEND_FIEND = "Friend Fiend"). Keep this list open so you can copy and paste from it later.
      • Navigate to My 3D Apps tab on the web page
      • Choose "Manage My 3D App" for the 3D App that you installed this template
      • Choose "Badges"
      • Add all of the badges to the app:
        • Click "Add New Item"
        • Copy the badge name from the lua file (In the above example, the name would be "Friend Fiend")
        • Description and Points can be anything. (For all the accurate descriptions of each badge, go to www.kaneva.com/channel/KanevaPoker.channel and click on badges)
        • Do this for all the listed badges in the lua file.
    • Create a Leaderboard
      • Navigate to My 3D Apps tab on the web page
      • Choose "Manage My 3D App" for the 3D App that you installed this template
      • Choose "Leaderboard"
      • The Name of your leaderboard should be "Chips" and the Label should also be "Chips". Choose 'Currency' for Type and 'Descending' for Sort.
      • Click Save
  • Run the 3D App Server for the first time. NOTE: The first run may take some time to start up so it may not show up in the 3D App list immediately.
    • At this point, when you teleport to your app, you should be automatically sent to a Poker room and all functionality should work. Good luck!
Demonstrates

Multiplayer gameplay, Script to script communication, multiple menu loading, custom menu textures
object generation, object deletion, custom texturing on objects, saving/loading player data(chips)
poker logic, using tables in Lua to maintain game objects, timed events


APIs Used

Scarecrow


This template includes a tower defense game example. Your goal is to position and spawn your towers in strategic locations and when the scarecrows come see how many you can stop from reaching the other side of the field.

Demonstrates

Collision, generating objects, object movement, click handling, timers Menus loading other menus Custom menu events


APIs Used

Monster Meltdown


This template includes a puzzle zone and your goal is to prevent the mainframe from a meltdown within ten minutes. Initially you are tasked with turning on four switches to get elevators to start working, once these elevators are on you can then gain access to the upper level. On the upper level you must find and turn on four more switches that open a door that gains you access to the mainframe. At the mainframe you must press four buttons to complete the circuit and raise the mainframe main control panel. Once the panel is accessible you have to press the off switch to prevent the mainframe from having a "Monster Meltdown".

Demonstrates

Custom menu events, sequenced actions, moving objects, clicking objects, multiplayer state
Multiple scripts in a zone
Script to script communication


APIs Used

Trivia


This template is a trivia game that multiple players can play. It will simulate playing against a large number of players while randomly answering for them.


Demonstrates

Custom menu events, multiple menus and menu scripts, timed events
Multiplayer gameplay
Using tables in Lua to maintain game objects


APIs Used

Word Challenge


This template consists of a large arena overlooking a giant playing board. Multiple players score points by forming words from individual lettered tiles on the game board marked with a 15-by-15 grid.

Demonstrates

Multiplayer gameplay, using custom textures for menus, generating objects, custom textures on generated objects, removing generated objects
storing/loading player data to the database, storing/loading game data to the database, using tables in Lua to maintain game objects, timers


APIs Used

Geo Space Wars


This game demonstrates a more complex game scripted with just one script. It implements a large variety of the available APIs.

Demonstrates

Multiplayer gameplay, object generation, object deletion, object speed/movement calculations
custom menus, custom textures, developing a game with multiple menus. Locking game instances.

Items required to use script. (Global Id's)
1076, 1840, 1841, 3346
1847, 1848, 1849, 1850
1065, 4752, 4753, 2868


APIs Used

Pathfinding Example


This app demonstrates an implementation of the A* pathfinding algorithm, a map editor and a forest environment.

Demonstrates

Using a menu to send data to a script; Changing menu elements visibility based on mouse input; Dynamically creating menu elements;
Loading and saving map data configured within a menu to the database; dynamically setting a script onto a generated object; sending messages to the new script;
Moving an object along a path over a set period of time; controlling the path of movement by using the A* search algorithm;

Setup

The following steps will show how to configure this app to use a faster timer (for making your units move quicker).

  • NOTE: If you have already started your server, please stop the server and complete the tutorial.
  • Create a new 3D App and install the template
  • Before you run the server do the following steps:
    • Go to the folder on your server's computer where your 3D App is located (My Documents/My 3D Apps/Your App/)
    • Open the ScriptServerEngine.xml file
      • Find the entry named TimerPeriod
      • Modify the value within the TimerPeriod tags from 1000 to 100
      • Save the ScriptServerEngine.xml file
    • Create a new distribution
Instructions
  • Click the cloud in the sky above your head to see the pathfinding map editor menu
  • Click one of the radio buttons named "Wall", "Unit" or "Empty"
  • Click one of the boxes within the grid to set the node type
  • Walls will appear in black, units appear in red and empty nodes are white
  • Click the "Load" button to see the configuration within the zone
  • If you want to change the placement of the wall or the units within the grid
    • Click the "Unload" button
    • Change the walls or the units
    • Click the "Load" button
  • If you want to modify the location that the grid starts at:
    • Click the "Unload" button
    • Change the X,Y,Z location on the right side of the menu
    • Click the "Load" button
  • Click the "Start" button while the configuration is loaded, to start your units moving
    • Move your avatar within the loaded grid and your units will follow you
    • Click the "Stop" button to stop the units
  • Type in a name for your configuration and click the "Save" button
  • This configuration will be stored within the database until you delete it with the "Delete" button
  • Click the "Play" button to load the units without any grid visualization
  • After clicking "Play", click the "Start" button to start the units moving
  • Click the "Attack" button near one of your units to make it disappear
Exercises
  • Switch the A* heuristic from diagonal distance to manhattan distance
    • The maps.lua script has a global variable called g_useDiagonals
    • Modify the menu and the maps.lua script to set the g_useDiagonals boolean to false when the checkbox is not selected
    • Hint: Modify the kgp_menuevent function within maps.lua
  • Modify the astar.lua script to make your units rotate towards your avatar
    • The astar.lua script contains a function named get_rotation_vectors
    • This function is called when the unit is moving within the kgp_timer function
    • Hint: Modify the kgp_timer function within astar.lua
APIs Used
Personal tools
World Of Kaneva
Builders