• 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.
  • entries
    625
  • comments
    1446
  • views
    1006464

Learning C#. Whee.

Sign in to follow this  
Followers 0
ApochPiQ

151 views

This afternoon I got back from Quiznos and decided to slack off for a bit before going back to work. (On a totally unrelated note, walking a 3 mile round trip and getting a sandwich out of the deal is absolutely awesome. Do it often if you at all possibly can.)

So about 1:25 I decided to have a shot at this whole C#/Habanero thing. Got to start somewhere, right? So I fire up my trusty Visual Studio 2005 and create a new Windows project in C#.

The first thing I notice is that the IDE has created a form for me. This is familiar from my glory days doing applications programming in VB. They still call the thing "Form1" for no apparently good reason, which has bugged me all the way back to VB3. I swear, VC++'s wizard is so much nicer: it asks you what you want to call your classes. Why they've never done that in VB, and now C#, is totally beyond me.

Anyways, that's just an idle curiosity, and easy to get past. I blow away the form since I'll want to dynamically create my render windows on the fly. If I need prefab forms later for config UI and such, I'll build them - but for now I'm going with pure code.

Goal #1: Get a message box on the screen
I figure this is a good place to start: really trivial, but probably different enough from the stuff I'm used to to provide a learning experience. Sure enough, I fumble around for about 10 minutes trying different magic incantations involving System.Windows.Form.MessageBox. I try treating a MessageBox as an object and statically allocating one. I try dynamically allocating one. For kicks I poke around in IntelliSense for a second and fail to find what I'm after.

Finally I break down and just Google "C# messagebox" and wham, there's the answer: MessageBox.Show(). Duhh. I guess this .Net stuff is going to be more of a mental paradigm shift than I thought [grin]

So, drawing on my highly limited and utterly broken Spanish, I proudly accomplish Goal #1:

Hello, world! ... sort of.


Current time: 1:39 PM. Yayy.


Goal #2: Get a dynamic window displayed
This is my second big test. Judging from experience with C and C++, this is probably going to take a while, so I mentally steel myself for going back to work as soon as I'm done on this phase.

When I tore out the prefab form from my new project's code, I noticed the Application.Run() call, which apparently is .Net's ready-made message pump loop. It can take an object of type System.Windows.Forms.Form. So I poke things a little bit, slap together some code, and produce this:

Form foo;
foo = new Form();
foo.Text = "Habanero";
foo.SetBounds(0, 0, 225, 150, BoundsSpecified.Size);

Application.Run(foo);


It takes a few seconds of juggling IntelliSense to figure out the correct parameters, but this time I get by without needing to touch Google or even MSDN. It literally takes more time to write this paragraph documenting my attempt than it took to write the code.

My dynamic window in action


Current time: 1:51 PM.



Hot damn... now that's what I call rapid development. I think me and C# are going to get along very nicely.

This brings back my (very happy) memories of whipping up GUI tools in a matter of minutes in VB, back in the day. In fact, I still use VB fairly regularly to do quickie tools, like one-off file parsing/mangling utilities. It's a great thing to have in the toolkit, and I find the visual GUI design tools more than justify the fact that it's VB and not, say, Python. I've still got a very soft spot in my heart for VB; even though it supposedly teaches all these bad programming habits, my opinion is that bad programming is the fault of the programmer, not the language. I've seen some truly elegant and beautiful code produced in VB - although, admittedly, not very much.

C# though... I sort of feel like a dirty tramp for even saying this, but I think it's going to replace VB (even VB.Net) as my personal RAD tool of choice. The syntax very closely resembles the C++ and KC code I spend my time thinking in, and I'm not smart enough to deal with massive syntax shifts on a regular basis. When I do use VB or other languages I find my muscle memory putting semicolons and curly braces all over the place, which naturally causes some havoc.

C# also has delegates, which are just plain hot. I can already see entire aspects of my planned engine structure getting reduced to extremely simple, clean pieces of code by the mere power of delegates. I wrote a 500-line hacked imitation of delegate behavior for a customized callback system in C++ for the last Habanero attempt; it used multiple inheritance to do its work. With delegates I get all that power, plus more, without any code overhead of my own. I also get anonymous delegates, which make me want to jump around and giggle like a schoolgirl on crack.


So there we go... 35 minutes and I've finished a passable dynamic window dummy program, and written a journal entry about it. If I had any doubts before about this decision, they've been totally blown away.

This is going to be a whole heck of a lot of fun.

0
Sign in to follow this  
Followers 0


0 Comments


There are no comments to display.

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