Theme “Only 1 inventory slot”
First thoughts: I have no idea. All my plans involved no inventory at all. I was hoping for the dice and was planning a board game in my mind. Or for example upgrade your enemies or choose your loot, I had the kind of infinite shooter styled game. Now I had to start with nothing at all.
What if… stay awhile and listen… Time traveling.
What does time traveling have to do with Only one inventory slot? In sci fi we always get to choose the rules of time travel. In Terminator you only travel nude and in Futurama you could do the nasty in the pasty.
Let’s put the idea in a few lines:
Story:
Man installs Brend Macro AV software to BjörneBorg Particle collider facility. This causes catastrophic disaster ending the world. Time traveler is sent to fix it.
What do I need to learn? I am a beginner Unity learner. So basically everything. I have a vague understanding this can be done with scriptable objects.
Oh dear, I think I took too big a piece of cake this time. If only I could travel in time.
Where to start. The core mechanism is moving between scenes. I need to make a few scenes and see how I can manipulate the objects. Build on that. Also I need to alternate scenes when something major has happened. Like you kill the “plant” designer and on your return the disaster has already happened. Game over.
Submissions due in 13 days 21 hours 8 minutes 52 seconds
Goals:
3D FPS Controller. We will be doing it FPS style. 3rd person would be cooler or even 2.5D would fit in a game like this. But since I got so many other new things to learn I decided to go with the style I already know. This is the tutorial I’ve previously used for basic movement https://www.youtube.com/watch?v=_QajrabyTJc
Selectable objects. This is something I haven’t done in Unity. However I have done shooting mechanisms. So we could cast a ray or perhaps sphere ray continuously to see if there is an interactable object ahead. Instead of a weapon we can cast the ray from the camera (eyes).
https://docs.unity3d.com/ScriptReference/Physics.Raycast.html
Once the ray hits something inside our cast distance we will show a function image on the screen. (Hand for pickup, Tool for fix etc. If I have time I could use the image of the item used)
Interactable object
Items:
I should make them all scriptable objects so I could use a proper inventory and picking up things. But I’m trying to sneak a fast one and simply store the item states in static gamedata class. A mistake that will surely come back and bite in the butt at some point.
We will store all the items you pick up in a list
List<string> inventoryItems = new List<string>();
We then simply have a static variable called itemInHand that we set. This will stay in our hand as we time jump
public void setItemInHand(string itemName)
{
StaticValues.itemInHand = itemName;
}
Now we don’t want to have that item left in the time we jump
if (currentYear.Equals("2024"))
{
StaticValues.item2024[StaticValues.itemInHand] = false;
} else if (currentYear.Equals("1982"))
{
StaticValues.item1982[StaticValues.itemInHand] = false;
}
Once we land to the new time we simply add the item in hand to player inventory that is again empty. Thus filling the theme Only one inventory slot.
// we want to put the item take from different time to inventory
if (!gameData.itemInHand.Equals(""))
{
inventoryItems.Add(gameData.itemInHand);
}
Rule items picked up, but not taken in time return to the original location. Uuh I am already regretting the item system. Lore there: is a janitor Martti who cleans after you.
Test time travel mechanism. Do 2 sandbox scenes where once is past and the other is current day. Things done in the past should have an effect on the future, but not the other way round.
For now I simply made scene switch that hops between two “years”
private void InitLoadScene()
{
if (gameData.goIntoYear.Equals("1982"))
{
gameData.goIntoYear = "2024";
} else if (gameData.goIntoYear.Equals("2024"))
{
gameData.goIntoYear = "1982";
}
Invoke("LoadScene", 5f);
}
public void LoadScene()
{
Debug.Log("sceneName to load: SplashScreen");
SceneManager.LoadScene("SplashScreen");
}
I can later just replace the logic on what year we will be moving to.
Why is there a SplashScreen in between scenes? In future I might want to make a highlight scene showing what changed. For now it just says what year we jumped and then loads the scene.
Submissions due in 12 days 19 hour 23 minutes 34 seconds
MIDSUMMER FESTIVAL!!!
HAPPY JUHANNUS!!!
Let’s create some room objects
Massive ring room where what ever this palace does, happens.
Submissions due in 9 days 23 hours 17 minutes 45 seconds
I quickly use cubes to carve out the rooms.
I need to get one mission done.
Task 1: Replace the fuse. You can find one in the past.
Interaction with the game items is done with an inheritable class where I can set up all the items the way I want. All the items still have their own functions.
public class Interactable : MonoBehaviour
{
protected void assistAwake(Item item)
{
GM gM = (GM)FindObjectOfType(typeof(GM));
string currentYear = gM.getCurrentYear();
if (currentYear.Equals("1982"))
{
gameObject.SetActive(StaticValues.item1982[item.itemName]);
} else if (currentYear.Equals("2024"))
{
gameObject.SetActive(StaticValues.item2024[item.itemName]);
}
}
public virtual void Interact()
{
}
}
We can now create interact functions that can do the item specific event for example update task status.
Creating tasks
public string taskName;
public string taskDescription;
public bool completed = false;
[SerializeField] List<Item> questItems = new List<Item>();
Task simply has a list of questItems that need to be in a correct state. In the case of changing the fuse this will simply have the fuse box as an item. Later the tasks get more complex and have more items in them.
How to make them all come together
What I should have learned is a state machine for the game. Instead I created a monster called GameManager. Collection of functions that other game objects can call to interact with another.
Creating NPC Martti
Making Martti talk
I added a simple trigger collider to spam some words on the screen.
Creating the time machine. First time using animation in both Blender and unity.
We can now call the TimeJump animation from script.
Using Adobe Mixamo to help posing the NPCs
Using beards to differentiate time
Does the character look familiar? It’s based on a tutorial by Grant Abbitt. List of tutorials used below.
You end up with something like this
Creating the UI
Task list is simply panel with a Textmesh pro textbox over it
GameManager simply adds [X] when task completed.
Movement tutorial by Brackeys
https://www.youtube.com/watch?v=_QajrabyTJc
Interaction by Brackeys
https://www.youtube.com/watch?v=9tePzyL6dgc
Items by Brackeys
https://www.youtube.com/watch?v=HQNl3Ff2Lpo
How to store data between scenes by Max O'Didily
https://www.youtube.com/watch?v=QG5i6DL7-to
Unity animation tutorials by Jayanam
https://www.youtube.com/watch?v=uWexElqDcaA
https://www.youtube.com/watch?v=tveRasxUabo
How to create Earth in Blender by blenderian
https://www.youtube.com/watch?v=xQnSewc9-v4
Tutorials by GameDev.tv (used before GameJam)
Low Poly Characters in Blender by Grant Abbitt
Blender Low Poly Landscapes: Model Your Own Stylized Landscapes! by Grant Abbitt
Textures for earth and mars https://www.solarsystemscope.com/textures/
Used on Attribution 4.0 international license
Music
7- Dark Fantasy Studio- Down (seamless) composer Nicolas Jeudy / DARK FANTASY STUDIO
License purchased through Humble Big Royalty-Free Music Bundle
Did you like this post? Tell us