I'm making good headway through reading the C# 4.0 in a Nutshell book; some might say that it's not really a front-to-back book, especially in the later chapters where it's definitely reference information, but I find it a good way to get a sense of the capabilities of a system/API/library to go right through.
I'm loving C# 4.0. It has some really good advanced features of "modern" languages that make it very powerful, such as delegates, lambdas, generics, operator overloading, dynamic lookup, named parameters, variance... yes, I'm aware some of these features existed in C# before 4.0. And many of these features are available in other languages, but not usually ALL of them. Having some of my favorites from C++, Java and Lua, all bundled together, makes for a delightful language. Many of these features go very well with the way MUDs/MMOs work, with the idea of object trees, feature inheritance, scripting events and the like: if you "use" an object, the engine just has to call the object's use() function; if it doesn't have one, then nothing happens, and if it does have one, it just gets called. No having to check the object type, no need to check for member availability, no need to cast -- no need for the engine to ask "is this a useable object" at all. But now I'm encroaching on the content of my other blog.
I've just finished the first step of the asset-stripping project; I can now pull out a terrain tile and save it to file. This is something that was much quicker to do in Lua and Go, mainly because of fighting with the build environment. Even though I have access to C# via Visual Studio, I'm a die-hard command-line coder, and am much happier (and much more productive) when using emacs and make. Thus, instead of just writing the code that I've got in ten minutes and having it work, I've been fighting with getting Mono, the free implementation of C#/.NET, working for me. Some of the problems were on installation, and some were on CLR usage that looked like installation issues until Google saved the day.
In the end, though, having the full .NET library available makes things so much easier. In Lua, I ended up dumping the sprite rendering onto ImageMagick, instead of trying to find a decent PNG library. In Go, PNG support was provided with the libraries, but all of the explicit typecasting really made for an unenjoyable programming experience. In C#, once I got around the compilation issues, it was nearly trivial, with zero-indexed arrays (unlike Lua), and natural type conversions.
My next step is to get Mono to display the graphic for me, instead of just dumping it to a file; this will be the first step into writing an InsideUO clone, and my first step towards being ready to write a test game client for MMORF.
Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts
Sunday, March 14, 2010
Wednesday, February 17, 2010
See sharp
I got my copy of C# 4.0 in a Nutshell yesterday, so today I start my first C# mid-sized C# project as a way to learn the language.
The reason I'm learning C# is to use it as the main language for my MMORF project. I chose C# because... well, it's similar enough to Java as to make it not completely foreign, as well as to leverage a mass of .NET libraries. Why .NET? Because it's about time I learn it. Why not Java instead? Because it's about time I learn to program for Windows. Why not Java instead? Yes, yes, Java programming can be "programming for Windows", but it's about time I really learn how to program for Windows. Besides, C#/.NET is still useful, via Mono, on other platforms, so it's not like I'm abandoning the rest of my environments.
The mid-sized project I'll be writing will be an asset grabber from the Ultima Online 2d asset files. Pulling out assets for the newer Stygian Abyss 3d-style assets would also be interesting, but I'm not aware of any documentation on those file formats (not that I've really looked), but I am quite aware of documentation on the original datafiles, thanks to the early work of Ultima Online hackers like Heptazane/Alazane, Cironian and others.
This project is one I've written twice before, first in Lua to learn that language (for eventual use in Metaplace, mainly), and also to learn Google's Go language. An asset grabber requires you to learn file access, and random access at that, as well as binary data manipulation, low-level data structures, buffer management, data merging and image generation, all the while working/fighting with the language's underlying type system. Lua was NOT the language for such a project, so it was very educational in making it work; Go was better suited, but the project greatly highlighted Go's strong type system, especially when coming from Lua.
The reason why I choose to write this project, yet again, is because I plan to take it a little further than I have in the past. Previously, it ended up as a cobble of command-line tools for stripping out specific sprites, animations and map data. Since I'm taking on this whole Windows programming thing, I think it's about time I get out of my command-line world and start making pretty graphics and windows and such, something that I haven't done for a long time, and even then, with trepidation under Java. Learning the Windows way of doing things is long overdue, so beyond just an extractor, I plan to make it a viewer as well, akin to the InsideUO tool written by Alazane.
And, of course, the end result -- the purloined UO assets -- are really good placeholders when developing a rudimentary client for MMORF; in fact, if you've read that project's blog, you'll know that UO is a large inspiration for me, and one of the targets that MMORF aims for: the ability to replicate that environment. That will include handling a map like UO's, and thus pulling out that map data -- for test purposes only! -- will be necessary.
As part of this C# education, I also plan on taking a look at the XNA development environment, which seems even to me to be odd, given that I own a PS2, Wii, PS3 and PC, but no Xbox/Xbox360 nor a Zune. Of course, there are also runtimes for Windows, and XNA looks to be a good platform for pretty rapid development of some pretty indepth graphical clients. Of course, many will wonder why I don't use Unity instead, and I'm not really sure, except that perhaps it's getting TOO much attention lately, and I'd hate to jump aboard only because everyone else is. Then again, it might be so popular because it IS the better way to go. We'll see.
None of my previous incarnations of the UO asset grabber ever made it beyond my own harddrive, so here's for hoping that this iteration becomes something useable enough that I might actually post the code somewhere.
The reason I'm learning C# is to use it as the main language for my MMORF project. I chose C# because... well, it's similar enough to Java as to make it not completely foreign, as well as to leverage a mass of .NET libraries. Why .NET? Because it's about time I learn it. Why not Java instead? Because it's about time I learn to program for Windows. Why not Java instead? Yes, yes, Java programming can be "programming for Windows", but it's about time I really learn how to program for Windows. Besides, C#/.NET is still useful, via Mono, on other platforms, so it's not like I'm abandoning the rest of my environments.
The mid-sized project I'll be writing will be an asset grabber from the Ultima Online 2d asset files. Pulling out assets for the newer Stygian Abyss 3d-style assets would also be interesting, but I'm not aware of any documentation on those file formats (not that I've really looked), but I am quite aware of documentation on the original datafiles, thanks to the early work of Ultima Online hackers like Heptazane/Alazane, Cironian and others.
This project is one I've written twice before, first in Lua to learn that language (for eventual use in Metaplace, mainly), and also to learn Google's Go language. An asset grabber requires you to learn file access, and random access at that, as well as binary data manipulation, low-level data structures, buffer management, data merging and image generation, all the while working/fighting with the language's underlying type system. Lua was NOT the language for such a project, so it was very educational in making it work; Go was better suited, but the project greatly highlighted Go's strong type system, especially when coming from Lua.
The reason why I choose to write this project, yet again, is because I plan to take it a little further than I have in the past. Previously, it ended up as a cobble of command-line tools for stripping out specific sprites, animations and map data. Since I'm taking on this whole Windows programming thing, I think it's about time I get out of my command-line world and start making pretty graphics and windows and such, something that I haven't done for a long time, and even then, with trepidation under Java. Learning the Windows way of doing things is long overdue, so beyond just an extractor, I plan to make it a viewer as well, akin to the InsideUO tool written by Alazane.
And, of course, the end result -- the purloined UO assets -- are really good placeholders when developing a rudimentary client for MMORF; in fact, if you've read that project's blog, you'll know that UO is a large inspiration for me, and one of the targets that MMORF aims for: the ability to replicate that environment. That will include handling a map like UO's, and thus pulling out that map data -- for test purposes only! -- will be necessary.
As part of this C# education, I also plan on taking a look at the XNA development environment, which seems even to me to be odd, given that I own a PS2, Wii, PS3 and PC, but no Xbox/Xbox360 nor a Zune. Of course, there are also runtimes for Windows, and XNA looks to be a good platform for pretty rapid development of some pretty indepth graphical clients. Of course, many will wonder why I don't use Unity instead, and I'm not really sure, except that perhaps it's getting TOO much attention lately, and I'd hate to jump aboard only because everyone else is. Then again, it might be so popular because it IS the better way to go. We'll see.
None of my previous incarnations of the UO asset grabber ever made it beyond my own harddrive, so here's for hoping that this iteration becomes something useable enough that I might actually post the code somewhere.
Labels:
C#,
game assets,
game client,
Ultima Online,
Unity,
XNA
Subscribe to:
Posts (Atom)