Esteban Maldonado
Esteban Maldonado's blog

Follow

Esteban Maldonado's blog

Follow
Global Game Jam 2023! - Part 1

Global Game Jam 2023! - Part 1

Jamming for a 3rd year in a row!

Esteban Maldonado's photo
Esteban Maldonado
ยทFeb 11, 2023ยท

7 min read

Table of contents

  • Context
  • Day 1 - Jan. 30th
  • Day 2 - Jan. 31st
  • Lessons learned
  • Please let me know what you think!

Context

It's time for global game jam(GGJ) again!

For those who may not know, a game jam is when a group of people coordinates a specific date and time frame when they'll all get together and create games, usually with a particular theme in mind. Many organizations host these types of events, but GGJ is one of (if not, the most) world-famous non-profit organizations that host these game jams.

It's truly amazing when thousands of people in many cities around the world get together to celebrate creativity through game development(digital or board games).

GGJ - A global success!

As I mentioned, Global Game Jam is a worldwide event, and it's completely free to join. If you've never participated, I recommend that you do. It's simply awesome.

This year, GGJ had over 33K participants (known as jammers), in over 100 countries around the world! Please visit https://globalgamejam.org/status so that you can see and use this cool interactive map.

And out of all locations in the world, I decided (obviously) to join Puerto Rico's (๐ŸŽ‰my home, WEPA!!๐ŸŽ‰) jamming site for the 3rd time in a row! This site was prepared/hosted by the Puerto Rico Game Developers Association (PRGDA), which celebrated its 5th participation in GGJ, and it was quite a good online event full of support for all participants including mentors, guest speakers, progress sharing, and more! Just look at this awesome schedule:

As you can see above, the full event is 1 week long, but this is optional. The more traditional time frame is usually during the weekend. This means starting on Friday evening, and ending on Sunday evening. But other chapters allow jammers to start working on their projects on Monday, which is the case in the PR one.

During the next posts, I'll talk about the daily progress of this project, and how our team went from a simple idea to create as much as we could.

๐ŸŽธLet the jamming begin!!!

Meet Team #7!

Neftali Rodriguez - Designer

Dennis Santos - 3D Artist and Modeler

Sergio Quintero - Composer

Esteban Maldonado (Me! ๐Ÿ˜„) - Programmer

Fun fact, this is Neftali's 1st game jam ever! ๐ŸŽ‰๐ŸŽ‰

Day 1 - Jan. 30th

On the first day of a game jam, it's always good to come up with an idea based on the theme of the game jam. Usually, game jams have a particular word or phrase that defines the theme, which also means that all of the projects submitted will show an interpretation of that same theme.

This year's theme is a good one...

If you think about it, the word roots can have many interpretations:

  • Roots of your past

  • Literal roots

  • Cultural roots (music, theater, art, etc.)

We went with the direction of protecting your home, so we imagined this warrior that needs to fight off an invasion of enemies. Here's some of our concept art.

-Yep, it's not top-shelf quality, but if it helps you in bringing your vision to life, it's concept art! ๐Ÿ˜‚

And after starting to flesh out some details, we went in the direction of having a bunny that lives happily in a carrot house, but all of a sudden some carrot-hungry beetles come and try to eat the bunny's house! The player must defeat all of the Beatles before they eat the entire house.

Day 2 - Jan. 31st

At the beginning of the second day, I was already surprised by what the team had already done. There were some good mock-ups of game screens and how they would look like:

hello

Good structure and contains what we need, ship it!

And on the art side, I'll let you be the judge. It's only the second day and we already had this amazing world and some basic characters!

Adding the First Lines of Code!

Main character movement

At this point, we already had the necessary pieces to start using the unity editor and create some prefabs. I'll start with the main character, the bunny:

To get started with the code I decided to use a new tool called ChatGPT, from OpenAI. ChatGPT is like having a conversation with the Google search bar itself. You interface with the AI by actually writing a question into the text prompt and it'll react as if it was an actual assistant. This new tool has been making a lot of news. It makes things very different for lots of different fields from content management, copywriting, and even code creation.

I decided to use this tool as an exercise to see how powerful it was. To start things off with a very simple case, I asked if it could write a keyboard controller for the main character:

As you can see above, the results are quite impressive. not only did it give an actual script that compiles, it also gives you a small explanation of how it works.

It's not entirely perfect though, if you talk to any Unity developer they'll make some small changes to the script and this is what I've done below:

using UnityEngine;

public class KeyboardMovement3D : MonoBehaviour
{
    [SerializeField]
    [Range(2f, 20f)]
    private float speed = 10.0f;

    private Vector3 m_moveDirection = new(0f,0f,0f);

    void Update()
    {
        m_moveDirection.x = Input.GetAxis("Horizontal");
        m_moveDirection.z = Input.GetAxis("Vertical");

        transform.position += 
            m_moveDirection * (speed * Time.deltaTime);
    }
}

The modifications are really small but I changed the privacy on the speed variable, and I created a reusable m_moveDirection variable for the move Direction, instead of creating a new Vector3 on every frame. This might be a small issue now, but depending on the scale of your game, this is an issue that can build up and cause performance issues, if you repeat it enough.

One very impressive and particular feature about ChatGPT is that you can continue the conversation and it'll remember its previous answers! So you can ask for a modified version of the previous result. I asked to see if it could include some logic that will make the character rotate and always look forward:

And as you can see, even in the explanation of this new result, it acknowledges that it is a second response and a modified version of the script.

And of course, here's my modified version, applying the same reusable memory trick:

using UnityEngine;

public class KeyboardMovement3D : MonoBehaviour
{
    [SerializeField]
    [Range(2f, 20f)]
    private float speed = 10.0f;

    private Vector3 m_moveDirection = new(0f,0f,0f);
    private float m_speedTimesDeltaTime = 0f;

    private bool m_isRotationNonZero = false;

    void Update()
    {
        m_moveDirection.x = Input.GetAxis("Horizontal");
        m_moveDirection.z = Input.GetAxis("Vertical");

        m_speedTimesDeltaTime = speed * Time.deltaTime;

        transform.position += m_moveDirection * m_speedTimesDeltaTime;

        m_isRotationNonZero =
            m_moveDirection.x != 0f || m_moveDirection.z != 0f;

        if (m_isRotationNonZero)
        {
            transform.forward = m_moveDirection;
        }
    }
}

I applied this final script to the bunny character, and look at it move! It is quite responsive and easy to use, and it just took me seconds of work:

Main character attack

I then added a script to activate what would be the "hammer attack". For now, I'm just writing a basic script that just detects when a user presses the space bar or left-clicks on the mouse.

using Unity.VisualScripting;
using UnityEngine;

public class BunnyHammer : MonoBehaviour
{
    [SerializeField]
    [Range(.1f, 4f)]
    private float m_attackCooldownTimeSeconds = 1f;
    private float m_currentCooldownTime = 0f;

    private bool m_canAttack = true;

    void Update()
    {
        if (m_canAttack && UserWantsToAttack())
        {
            Debug.Log("Hammer Down");

            m_canAttack = false;

            m_currentCooldownTime = m_attackCooldownTimeSeconds;
        }

        else if (!m_canAttack)
        {
            m_currentCooldownTime -= Time.deltaTime;
            if(m_currentCooldownTime <= 0f)
            {
                m_canAttack = true;
            }
        }
    }

    private bool UserWantsToAttack()
    {
        return Input.GetMouseButtonDown((int)MouseButton.Left) ||
            Input.GetKeyDown(KeyCode.Space);
    }
}

And we'll not see anything happen, but we can see that the cooldown behavior works:

After that, I decided to focus on our first enemy character, the beetle:

But I'll continue this development story in the next post! ๐Ÿ˜„

Lessons learned

  • Chat GPT or AI in general can be a great tool for helping developers, but it will not fully replace an entire game development team.... well at least not yet.

  • Proven fact: A jammer will always have something to contribute to a project, regardless of skill level.

Please let me know what you think!

  • What do you think of game jams in general?

  • Did you participate in GGJ this year?

  • If you answered yes, What kind of game did you make?

๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰ Happy building! ๐ŸŽ‰๐ŸŽ‰๐ŸŽ‰

ย 
Share this