Simon 的个人资料Simons XNA Game Page照片日志列表更多 ![]() | 帮助 |
|
4月24日 Blur/Bloom Effect in 2DCheck out this great article by Jamezila on ZiggyWare! I threw it into my game and it works great! Check it! 4月22日 More Work on Zombie HighWell I spent all day today working on the game. The first level, and the alpha test is almost ready to be released. What I threw in today will help me a great deal in pumping out the levels. First, the whole level is described within an XML file. It describes things such as, where the enemies are positioned, what background images should be used (and their associated information), where the trigger for the boss is, and the bosses spawning location.
As for the boss, I did something special. I made an interface called IScriptable and gave it some methods to control an objects movement. Then, I created an interpreter for an XML file describing the bosses actions. In the XML, it tells how the boss should move, how long for each action. In essence, I created a small scripting language based off of the XML.
I threw in some sound effects today as well. Sounds for walking, attacking, and picking up items. I also threw in animations, so now everything is animated (minus the boss attack sequence).
I plan on finishing this up by this week so I can get some play testing done. 4月19日 XML SerializationI player around with the XML serialization in C# today and discovered something great. It's extremely easy to load an XML into a structure and then use the loaded values later on in the program. I am including the example below. First we define our Class that will hold all the specific game values. public class Settings { #region Map Specific Values public String MapName; public int MapSize; #endregion #region Player Information public struct PlayerInfo { public int X; public int Y; public PlayerInfo(int x, int y) { this.X = x; this.Y = y; } } //Some default values public PlayerInfo[] Players = new PlayerInfo[] { new PlayerInfo(0,0), new PlayerInfo(100,100), }; #endregion /// <summary> /// Loads the Settings structure with the values from XML. /// </summary> /// <param name="filename">Path to the XML file.</param> /// <returns></returns> public static Settings Load(String filename) { Stream stream = File.OpenRead(filename); XmlSerializer serializer = new XmlSerializer(typeof(Settings)); return (Settings)serializer.Deserialize(stream); } } This Settings Class must mirror the structure in the XML file. A static method is provided to load the XML file into the class object. Below is the XML file used. It is quite easy to see the correlation between the class and the XML. Notice that the ROOT node of the XML document has to match the name of the Class to hold the values. Each Element in the XML also corresponds to either a structure or a field (it's fairly easy to see this) <?xml version="1.0" encoding="utf-8" ?> <Settings> <MapName>Map 1</MapName> <MapSize>1024</MapSize> <Players> <PlayerInfo> <X>50</X> <Y>50</Y> </PlayerInfo> <PlayerInfo> <X>150</X> <Y>150</Y> </PlayerInfo> <PlayerInfo> <X>250</X> <Y>250</Y> </PlayerInfo> </Players> </Settings> As you can see it's quite easy to see the similarities in the structures. In order to use this XML file and load it into the Settings class, we simply pass in an instantiated Settings Class object and the path to the XML file. We are then free to print or do whatever we want with the loaded values. Below is the example I used to print out the values read from the file. public class Reader { public Reader() { } public void Read(String filename) { Settings settings = Settings.Load(filename); Console.WriteLine("Map Name: " + settings.MapName); Console.WriteLine("Map Size: " + settings.MapSize); foreach (Settings.PlayerInfo playerinfo in settings.Players) { Console.WriteLine("Player Info X: " + playerinfo.X + " Y: " + playerinfo.Y); } Console.ReadKey(); } } Should be useful if you want to modify your game without recompiling! 4月18日 Updates to Zombie HighI have completed more work on Zombie High. The game is coming along quite well and I am happy to report that I will be entering Alpha testing soon. Unfortunately, my artist Louis has more pressing matters in his personal life and as such cannot dedicate time to the game. So, I have been doing my own artwork to test things out. The images I will be posting with this blog.
I plan on implementing some interesting ideas into the game. For example, I will use XML to describe the level details such as enemy positions, object positions, level name, and the background images. Also, in that XML file, I will be able to describe what boss XML file to use for the level. The boss XML file will describe the bosses script sequence when first introduced (almost like a minor scripting language).
I have also thought about implementing a minor scripting language as part of the engine design, but don't know if I will be able to get that done before the dream-build-play contest is over. This may be a possible future enhancement.
Until then, enjoy the images. 4月4日 Visual Studio ShortcutsCryovat over on the creators club XNA forums posted a very useful link! Here is a PDF in colour and greyscale for the Visual Studio shortcuts. Very useful.
4月2日 Zombie State DiagramI did some more work on the Zombies Ate My Highschool game this past weekend. I am now ready to implement the AI. The thought process of this beast is really simplistic, but should give an overall hunted feeling to the game play. There are really only two modes where the player will be threatened. They are when the Zombie is 'Hunting' the player, or when the Zombie is 'Attacking' the player. In either case, the Zombie will not rest until the player is dead or vice-versa. |
|
|