Site icon Dan Reut

From Hello World to First Steps in NPC Dialogues

First Program

When you first start learning programming, your journey inevitably begins with a simple “Hello World.” It’s not just a tradition but a symbol of embarking on something new. For me, though, that wasn’t enough—I decided to take it a step further.

https://danreut.com/wp-content/uploads/2024/12/Untitled-video.mp4

A Small Step for Me, but a Giant Leap for NPCs

Recently, I wrote a small piece of code that adds a touch of interactivity. Instead of simply displaying text, I created the beginnings of a dialogue system for an NPC (non-player character). What does it do? The NPC greets the player, asks for their name, and even responds! It might look simple, but for me, as a beginner developer, this was a meaningful step forward.

using System;
using System.Text;
using System.Threading;

namespace CSLight
{
    internal class Program
    {
        static void Main()
        {
            Console.WriteLine("Hello World!");
            Console.ReadKey();

            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Loading...");
            Thread.Sleep(1000);
            Console.WriteLine("Hi, I am alive");
            Thread.Sleep(1000);
            Console.WriteLine("What is your name?");
            Console.ForegroundColor = ConsoleColor.Magenta;
            string name = Console.ReadLine();
            Thread.Sleep(1000);
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine($"Hi {name}, it is my pleasure to meet you.");
        }
    }
}

Why Does This Matter?

For me, this simple program became a bridge between my current level of knowledge and my dream of creating a fully-fledged game. The code isn’t perfect, but it shows how basic C# concepts can be used to create something interactive.

Lessons Learned

What’s Next?

I plan to continue building my knowledge base: learning C#, experimenting with Unity, and, of course, creating new scenarios for NPCs. There will be plenty of falls and mistakes ahead, but that’s the whole point of learning.

Exit mobile version