Nice and simple C# programs for beginners?

Started by
4 comments, last by Eck 9 years, 9 months ago

I'm reading through a rather extensive C# tutorial online, and I wrote the "Hello World" program, naturally. But they're throwing concepts at me, and I have no place to apply them. What are some simple program ideas to test the concepts I am learning? Or is this even a good idea?

Advertisement
It is always a good idea to program more. You won't learn unless you continue to challenge yourself.

As for simple programs to write, just pick a problem and aim to solve it. One idea for you: Create a pick a number game, then refactor and refine it unto a choose your own adventure game. Keep going until you've got a whole little SUD written.

You will need things like conditionals, loops, string parsing, and more as you continue to grow what started out as "hello world" into a fully fledged game.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

If you don't have any other programming experience I'd guess the language's basic constructs will help:

Variables. Loops. Calling methods. Calling methods with arguments. Make a simple class and use it. Put class instances in containers and access containers.

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

To add to my initial post:

Start with your basic hello world application. Then make it a "choose a number" game, where the program has a nice hard coded random number (lets use 42). Then once you've met System.Random, you can make it pick a random a random number every time the program starts. But, still, when you get it wrong the program exits.

So the next stage will be to make your pick a number game run until the user picks the correct number. This will involve loops. Once you've got the basic loop in place (this is your game loop), you now want to add some exit conditions, so that a player might quit the game at any time. Other things you will want to do is ask the player if they wish to play again, after successfully picking the right number.

Now we've got some basic conditions and loops out of the way, time to go a bit more complex. Write an Arena game. This is a game where the player picks a monster or difficulty and then enters an arena and fights the monster. They use simple commands to do so, in fact, your first time around you'll probably just make it "attack" or "retreat." Defeat is when the player's HP (which you need to track) reaches 0. Winning is when the monster's HP reaches 0.

An arena game has a HUGE amount of potential for growth. You can start adding complexity by allowing the players to earn XP every time they win, leveling up, increasing their damage. You can randomize the stats of the monsters (within certain ranges) so that each fight is different. You can start adding abilities and new choices (so its not just "attack" or "retreat"). You can grow this out quite a lot.

Once you've gotten this far, you have a basic game running. But you can go farther. So far we're dealing with things you can easily write into source code. Lets add another dimension and start driving it with data. We can start by storing player data in files and monster data in files. Now you can save your progress between games. Then we can refactor the arena game a bit further and now you have multiple rooms you have to traverse, and the rooms link to each other, and the monster can move between rooms. So now your monster needs to think a bit more. It no longer simply advances or attacks. It must now choose if it wants to flee or chase... etc. Now you're starting to get into the basics of a single user dungeon game.

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

Thank you Washu, that is exactly what I was looking for.

Very nice writeup Washu.

- Eck

EckTech Games - Games and Unity Assets I'm working on
Still Flying - My GameDev journal
The Shilwulf Dynasty - Campaign notes for my Rogue Trader RPG

This topic is closed to new replies.

Advertisement