• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
melloorr

Simple projects? (C#)

17 posts in this topic

Hello everyone, been a while since I was here but I want to get back into C# so I need some tasks/small projects that will allow me learn the basics again, and let me learn new things too.

Does anyone have any ideas please?

Thanks, melloorr.
0

Share this post


Link to post
Share on other sites
One fun relatively simple project I enjoyed was [url=http://www.gamedev.net/topic/457361-c-workshop---project-1-maze-generator/]the maze generator project[/url] from the C# Workshop.
1

Share this post


Link to post
Share on other sites
[quote name='SiCrane' timestamp='1325257297' post='4898155']
One fun relatively simple project I enjoyed was [url="http://www.gamedev.net/topic/457361-c-workshop---project-1-maze-generator/"]the maze generator project[/url] from the C# Workshop.
[/quote]
Wow, looks pretty complicated to be honest, should take me a few months to do [img]http://public.gamedev.net//public/style_emoticons/default/wacko.png[/img]

Would basic C# be enough for me to do it?
0

Share this post


Link to post
Share on other sites
That was the first project for the C# workshop. For about four or five weeks worth of lessons and a lot of people new to C# before the workshop managed to complete working programs. So yes, basic C# should be enough.

I will admit it probably looks a lot more intimidating because during one or other of the forum upgrades line breaks got stripped out of the post so you've got huge walls of text where it was broken up before.
0

Share this post


Link to post
Share on other sites
Yeah it is pretty hard to read to be honest, but I will at least attempt it, and if I cannot do it, I will go through some of the lessons then attempt it again.
0

Share this post


Link to post
Share on other sites
@SiCrane, I don't suppose you or any other mods can edit the post please?
If I take my eyes away for a second, I have to spend 5 mins trying to find where I was up to.

Thanks
0

Share this post


Link to post
Share on other sites
Actually, clicking on the edit button not only strips out line breaks but also manages to strip out [b]spaces[/b]. I'm almost positive that I'd do more damage than help if I tried editing the actual post. As an alternative, you could try cutting and pasting the post contents into a Word document (or whatever your favorite rich text editor is) and adding line breaks manually to that.
0

Share this post


Link to post
Share on other sites
I've edited it. Do you want me to PM it to you? So you can update the post (or not). I can post if here first if you like
0

Share this post


Link to post
Okay I'm not getting this. I cannot do it.

I just can't work out how to get one variable to another, method, class. I have the book Pro C# 2010, but it hardly has any information on it (despite the size of the it).

Are there any tutorials that can get me used to working with multiple classes, and methods?
0

Share this post


Link to post
Share on other sites
Could you show an example of what you're having trouble with? I'm not entirely sure what you're asking.
0

Share this post


Link to post
Share on other sites
Well, looking at some of their answers to the project, they have classes with[CODE]int width[/CODE] in them, but I do not know how to get int width, into a different class to use it with that class also.
0

Share this post


Link to post
Share on other sites
To access a member of a class instance you just use the . operator on that instance. So if you have a class Maze with a int member variable named width and you had a Maze instance named maze you could just use maze.width to get the width value for that particular maze.
0

Share this post


Link to post
Share on other sites
Hmm, still not quite getting it. I think I will do some more reading up on it, then maybe try a text based game first, then attempt that again.

Thanks for the help
0

Share this post


Link to post
Share on other sites
I would still like to help you get this point. Can you show a more complete example of what you're trying to do?
1

Share this post


Link to post
Share on other sites
[quote name='SiCrane' timestamp='1325353914' post='4898499']
I would still like to help you get this point. Can you show a more complete example of what you're trying to do?
[/quote]

This is the code that I currently have (not much):
[CODE]
using System;
class MazeGenerator
{
static void Main()
{

Console.Title = "Welcome to the Random Maze Generator for C#";
Console.WriteLine("Welcome to the Random Maze Generator for C#");
Console.WriteLine("Please press Enter to continue to the Generator");
MazeQuery();

Console.ReadLine();
}
static void MazeQuery()
{
int mazeWidth, mazeHeight, wall, numberOfRooms;
do
{
Console.Write("Please enter the number of columns: ");
mazeWidth = int.Parse(Console.ReadLine());
} while (mazeWidth < 2 || mazeWidth > 50);
do
{
Console.Write("Please enter the number of rows: ");
mazeHeight = int.Parse(Console.ReadLine());
} while (mazeHeight < 2 || mazeHeight > 50);
numberOfRooms = mazeWidth * mazeHeight;

wall = numberOfRooms * 2 - (mazeWidth + mazeHeight);
Console.ReadLine();
}
}
[/CODE]

I don't know how to get numberOfRooms or wall to a new method or class to calculate what walls I have to knock down.
0

Share this post


Link to post
Share on other sites
Perhaps if you see a code example you'll be able to put things together a little better.

Suppose you have the following:

[code]

public class Maze
{
public int width;
}
[/code]

Then the following code does the following: creates an instance of Maze and calls it myMaze, creates a variable called newWidth with value 32, and writes newWidth into the width variable of the Maze class instance (myMaze)

[code]
public class Maze
{
public int width;
}

public class Main
{
public static void Main(string[] arguments)
{
Maze myMaze = new Maze();
int newWidth = 32;
myMaze.width = newWidth;
}
}
[/code]

If you want to save the width variable into something else, say, the newWidth variable, you can do it like so:

[code]

public class Maze
{
public int width;
}

public class Main
{
public static void Main(string[] arguments)
{
Maze myMaze = new Maze();
int newWidth = myMaze.width;
}
}
[/code]

EDIT: you can create a Maze instance in Main() and pass it as an argument to the mazeQuery() function where you can save the data into its members.
0

Share this post


Link to post
Share on other sites
In this case you'd use a function parameter. So if you had
[code]
static void SomeFunction(int rooms) {
// stuff
}
[/code]
You could call it in MazeQuery() like:
[code]
SomeFunction(numberOfRooms);
[/code]
0

Share this post


Link to post
Share on other sites
I get it now, and if I wanted to get something from a class, I could also use something like this:
[CODE]
using System;
class SimpleClass
{
public static void Main()
{
Console.WriteLine(ThatClass.yes);
Console.ReadLine();
}
}
class ThatClass
{
public static int yes = 10;
}
[/CODE]
0

Share this post


Link to post
Share on other sites
That's correct. Since variable yes is static, you have no need to instantiate the class ThatClass before using it, you can just call it directly like you have above.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0