If I’m a beginner with Unity, is a 1st-person adventure game a difficult project to start with?
I know the basics of scripting, such as variables, conditional branches, events-based (OnCollisionEnter, etc), after learning on-and-off for years. I’m also experienced in animation and 3D modelling.
The game would consist of these main features:
A camera that flew through the different rooms when clicking on doors. It would be static every other time.
When hovering some objects I’d need to create some kind of outline shader. onMouseClick they’d have to animate, or move to an inventory.
Inventory + GUI for it… I would guess this would be an array. I’ve not really done arrays before.
Are any of these difficult for a beginner?
EDIT - 18th Mar 2011
This is what I’ve come up with a few hours ago, and it’s a bit tragic.
I’m using an animation to move the camera, but that seems to have some problems. You can also play the zoom out anim half-way through the zoom in animation. I guess I could fix that with better variables.
I would have to make a new anim for each zoom to the objects. This code seems a bit long to be copy pasting then changing the animation name. Should I be using functions or something?
Any tips on where to go now? Should I move the camera on some kind of path instead?
using UnityEngine;
using System.Collections;
public class MouseHover : MonoBehaviour {
// =================================================================
// VARIABLES
// =================================================================
private bool itemZoomed = false;
private bool itemHovered = false;
void Update ()
{
// =================================================================
// IF LEFT-CLICKED ON OBJECT, AND itemZoomed=false, ZOOM IN
// =================================================================
if (Input.GetMouseButton(0) itemHovered) {
if (itemZoomed == false) {
// SET itemZoomed = true
itemZoomed = true;
Debug.Log("itemZoomed = TRUE");
// PLAY ZOOM IN ANIMATION
var myCamera = GameObject.Find("Camera1");
myCamera.animation.Play("AnimCubeCornerIn");
}
}
// =================================================================
// IF RIGHT-CLICKED, ZOOM OUT
// =================================================================
if (Input.GetMouseButton(1)) {
if (itemZoomed == true) {
// SET itemZoomed = false
itemZoomed = false;
Debug.Log("itemZoomed = FALSE");
// PLAY ZOOM OUT ANIMATION
var myCamera = GameObject.Find("Camera1");
myCamera.animation.Play("AnimCubeCornerOut");
}
}
// =================================================================
// IF MMB
// =================================================================
if (Input.GetMouseButton(2)) {
Debug.Log("MMB");
}
}
// =================================================================
// MOUSE HOVER. HIGHLIGHT.
// =================================================================
void OnMouseEnter ()
{
if (renderer.material.color != Color.red)
{
// Highlight
renderer.material.color = Color.red;
// Set itemHovered = true
itemHovered = true;
}
}
// =================================================================
// MOUSE EXIT. UN-HIGHLIGHT.
// =================================================================
void OnMouseExit ()
{
if (renderer.material.color == Color.red)
{
// Un-highlight
renderer.material.color = Color.white;
// Set itemHovered = false
itemHovered = false;
}
}
}
If we understand the same under the term adventure then the major part won’t be about Unity specific stuff at all. It will be about the story/riddle design/dialogues and therefore it doesn’t matter a lot how you visualise it.
Speaking of the graphics third person adventures are a lot more interesting to watch than first person adventures because the aquarium effect is bigger. First person stuff always has the potential to feel empty and sterile but also is less work.
It needs some talent in various fields(story telling, creating an atmosphere, writing dialogues, coming up with good riddles, …)/taste/experience to get something decent out here. There are genres which are easier than the adventure genre. If you have your strengths in those fields then i wouldn’t mind. If not then you better start with something else first.
I’m working on my first complete (hopefully, I will complete) game after doing a lot of simple starter things.
I’m doing everything myself except the scripting and have used some free graphics and audio,
though I do have a friend that does some sketches and have paid for one musical track, and expect to have more created.
It’s not the best looking game, the best modeling, probably not the best puzzles or even storyline but it’s mine.
I am not really very organized and started with some ideas and am developing from there.
I have no real time constraints other than the time I have/will work on it (mostly days off from my regular job).
I spent the first year “sketching” out five levels in Unity and have been working for about the last four months on one of the levels I hope to use as a demo or at least get some beta testing on, eventually.
That’s the plan right now.
If it never comes to anything at all at least I am enjoying it.
Oh yeah, it’s a first person puzzle/adventure game.
I predict that you’ll have more problems getting a good story and riddles for the game than to implement gameplay.
Of course if you only know the basics about coding – like me – your code will look very “hackish” and probably not very optimized, but as long as it works it’s a good start.
In my opinion, when working on a game alone or with a friend or two on your free time, the most important thing is that you are really sure you want to make that project, or else you’ll probably end up cancelling it at the first sign of trouble.
Also, arrays are easy, as long as you understand what they are you’ll be fine. If you don’t really know anything about them, I believe a couple of hours – maybe even minutes – reading some programming tutorials will help you (obviously, reading the part about arrays ).
I’m using an animation to move the camera, but that seems to have some problems. You can also play the zoom out anim half-way through the zoom in animation. I guess I could fix that with better variables.
I would have to make a new anim for each zoom to the objects. This code seems a bit long to be copy pasting then changing the animation name. Should I be using functions or something?
Any tips on where to go now? Should I move the camera on some kind of path instead?
using UnityEngine;
using System.Collections;
public class MouseHover : MonoBehaviour {
// =================================================================
// VARIABLES
// =================================================================
private bool itemZoomed = false;
private bool itemHovered = false;
void Update ()
{
// =================================================================
// IF LEFT-CLICKED ON OBJECT, AND itemZoomed=false, ZOOM IN
// =================================================================
if (Input.GetMouseButton(0) itemHovered) {
if (itemZoomed == false) {
// SET itemZoomed = true
itemZoomed = true;
Debug.Log("itemZoomed = TRUE");
// PLAY ZOOM IN ANIMATION
var myCamera = GameObject.Find("Camera1");
myCamera.animation.Play("AnimCubeCornerIn");
}
}
// =================================================================
// IF RIGHT-CLICKED, ZOOM OUT
// =================================================================
if (Input.GetMouseButton(1)) {
if (itemZoomed == true) {
// SET itemZoomed = false
itemZoomed = false;
Debug.Log("itemZoomed = FALSE");
// PLAY ZOOM OUT ANIMATION
var myCamera = GameObject.Find("Camera1");
myCamera.animation.Play("AnimCubeCornerOut");
}
}
// =================================================================
// IF MMB
// =================================================================
if (Input.GetMouseButton(2)) {
Debug.Log("MMB");
}
}
// =================================================================
// MOUSE HOVER. HIGHLIGHT.
// =================================================================
void OnMouseEnter ()
{
if (renderer.material.color != Color.red)
{
// Highlight
renderer.material.color = Color.red;
// Set itemHovered = true
itemHovered = true;
}
}
// =================================================================
// MOUSE EXIT. UN-HIGHLIGHT.
// =================================================================
void OnMouseExit ()
{
if (renderer.material.color == Color.red)
{
// Un-highlight
renderer.material.color = Color.white;
// Set itemHovered = false
itemHovered = false;
}
}
}