Microsoft XNA is a set of tools with a managed runtime environment provided by Microsoft that facilitates video game development and management. XNA attempts to free game developers from writing "repetitive boilerplate code" and to bring different aspects of game production into a single system.

The XNA toolset was announced March 24, 2004, at the Game Developers Conference in San Jose, California. A first Community Technology Preview of XNA Build was released on March 14, 2006. XNA Game Studio 2.0 was released in December 2007, followed by XNA Game Studio 3.0 on October 30, 2008. XNA Game Studio 4.0 was released on September 16, 2010 along with the Windows Phone 7 Development Tools.

XNA currently encompasses Microsoft's entire Game Development Sections, including the standard Xbox Development Kit and XNA Game Studio.

The name "XNA" originated out of the project's development name, Xbox New Architecture. Instead of being released under the Xbox name, the Xbox 360 was released (2005), and XNA came to stand for "XNA's Not Acronymed".

Post article RSS Related Articles

Hello everyone!

This entry turned out to be lengthy and pretty technical. Sorry about that, but last week was spent only on "under the hood" stuff. I did my best to make it interesting though ;) ! So the agenda is the item system which became really sophisticated, especially compared to the size of the game + the difficulty and pacing management.

I settled on the video format of the last entry, because EP 3 was the most pleasant recording experience and in my eyes it was the most enjoyable video so far. So from now on, I'm going for condensed and "scripted" logs focusing on the features and development of the game.

Items, loot



The plan for the game is to have a wast and diverse set of unique items (approx 100). Since no leveling will take place, the player will have to risk collecting as much loot as possible during the journey and focus on customizing the play-style by carefully picking which items to wear. So the technology behind the game has to support a great number of skills and excessive customization of the items, but also has to allow lightning fast iteration times, since I will be spending a significant amount of time during the upcoming 2 to 4 weeks with designing and balancing the possible loot.

Attribute bonuses


The easiest development was attribute bonuses on items. Adding the following piece to the descriptor of an item in the loot configuration file will provide the given bonus attributes to the player while equipped:

<Attributes>
	<Attack>1</Attack>
	<Defense>2</Defense>
	<Vitality>3</Vitality>
	<Speed>4</Speed>
	<Luck>5</Luck>
</Attributes>

I highly recommend calculating most of the final modifiers and attributes of a character in RPGs every time one is needed. The more caching you introduce into these systems, the more groundwork you lay for pesky bugs to occur, so keep it low! Usually these calculations are pretty simple (will never be a performance hit) and the hard-coded constant formulas will be really straight-forward to follow.

public class Attributes
{
	public int Attack;
	public int Defense;
	public int Vitality;
	public int Speed;
	public int Luck;
	
	// events ...
}

public class Player
{
	public Attributes Attributes;
	
	// handle pick-ups and other logic related to permanent attributes...
}

public class Inventory
{
	public Attributes Attributes;
	
	// handle item pick-ups and other logic related to item attribute bonuses...
}

The player data holds the permanent attributes of the character (starting attributes + permanent power-ups) and the inventory holds the sum of the attribute bonuses from the equipped items (only a tiny bit of caching) recalculated every time it is changed (e.g.: item pick-up, item swap etc...). The final value of an attribute is the sum from these two structures and the modifiers queried from the extra skills of the equipped items applied to it.

Skills, event system

For a high level of flexibility and to have a varied set of special skills I implemented an event system. I followed a similar but a bit more dynamic approach as the built-in event language feature of C#. Essentially an event is a string (the name of the occurred event) and a context holding additional data related to it and a skill is an event handler implementation.

Event systems can be implemented a number of ways each having their strengths and weaknesses, but all-in-all the following is pretty close to the my solution:
WARNING pseudo code incoming!

// Actual skills need implement this class:
public abstract class Skill
{
	public void HandleEvent(string name, EventContext context)
	{
		if (this.EventsHandled.Contains(name))
		{
			// Additional checks related to the context...
			
			TakeEffect(name, context);
		}
	}
	
	protected abstract void TakeEffect(string name, EventContext context);
	
	// Some helper methods...
	
	public HashSet<string> HandledEvents;
	
	// Additional requirements for the event & context...
}

// Special events extend this structure to "add" extra data to the event context:
public class EventContext
{
	// The creature whose action lead to the event:
	public Entity Creature;
}

The execution of the "TakeEffect" method can also be chance based (luck of event firing creature is taken into account). so a skill may only take effect with a given chance (e.g.: 10% chance to "XYZ" types).

An item can have a list of skills listening for events when equipped by a creature. Some events pass in an extension of the "EventContext" class with extra information, like the damage dealt, or the target creature attacked etc...

Few of the most common events in the game:

  • NextDungeonReached: the player reached the next level.
  • Attacking: a creature starts attacking.
  • OpenChest: the player just opened a chest.
  • Pickup: the player picks up a bonus item (e.g.: health potion, gold sack etc...)

Some of the existing skill implementations:

  • Attribute: grants a "bonus" for the upcoming trial (e.g.: +10 luck for the next luck trial).
  • Cripple: interrupts the next attack of the target.
  • Thorns: reflects a "bonus" amount of damage to the attacker.
  • Vampiric: a "bonus" amount of the damage dealt is healed to the attacker.

"bonus" == modifier applied to an integer value. Can be an integer like +/- 5 or a percentage like +/- 5%. The integer bonuses are applied first and the percentage modifiers afterwards.

Most of these events and skills took only a few lines of code to integrate and I have several more ready and working. Combing and configuring them to take effect on specific events with various chances is already an immensely versatile system to build items :) !

Tags

String tags can be added to a creature when describing it in a configuration file, like: undead, deamon, boss etc... The event system allows to define tag requirements for targets before a skill can take effect. A creature meets a given a requirement if it does not have any tags from its "can not have" set of tags and has all the tags from its "must have" set of tags. It is as simple as that.




This tiny addition allows skills which have real "character" to be made. Some cool examples would be monsters tagged as "undead" and a life-steal granting sword which does not work on them (pictured in the GIF), or a holy shield which grants enormous extra defense, but only when attacked by monsters tagged as "deamon". This also allows to disable certain skills against bosses which could make them too overpowered otherwise.

I'm still at the beginning when it comes to designing the concrete items, but with these systems in place I hope I'll have a pleasant experience while implementing the actual artifacts. As closing words for the loot topic, here is a rather complicated item description just to show how this is all put together in configuration files:

<!--
	Forearm armor:
		+1 Defense
		20% chance to cripple non "Boneless" enemies
-->
<ItemDescriptor>
	<Type>Forearms</Type>
	<Name>Vambraces</Name>
	<Sprite>Item22</Sprite>
	<Level>1</Level>
	<Attributes>
		<Defense>1</Defense>
	</Attributes>
	<Skills>
		<Skill>
			<Cripple>
				<EventHandled>InflictDamage</EventHandled>
				<ChanceBased>true</ChanceBased>
				<Chance>20</Chance>
				<TargetTags>
					<CantHave>
						<string>Boneless</string>
					</CantHave>
				</TargetTags>
			</Cripple>
		</Skill>
	</Skills>
</ItemDescriptor>

Difficulty, pacing

It's important to constantly introduce new content and to increase the difficulty curve so the player always finds a challenge while progressing deeper into the depths of the dungeon. I achieve this with a construct called "dungeon profile". For each level of the story (currently planning to have around 30) a profile will specify which tile-set to use, what kind of monsters can be spawned and what type of pick-ups, treasures and chests can be placed. Of course this data is read from asset files and it is fed into the dungeon generator after constructing the layout for a level. This gives fine control over the length, the pacing and the minute to minute difficulty changes of the whole game without modifying a single line of code.


Yep, last week was rather busy, though I'm behind my schedules once again :( . A little more than a week ago I was confident I will have some (even if not many) art assets done for the game by now. Sadly slipped a little. This is the next step though, so the following entry will have pretty sprites and screenshots ;) !

Stay tuned!

Cavern Crumblers Releases to Steam Greenlight
Cavern Crumblers

Cavern Crumblers Releases to Steam Greenlight

Cavern Crumblers

Asymptotic Games releases their first game, Cavern Crumblers, to Steam Greenlight. A local multiplayer shooter with destructible terrain. Vote now!

Super Lumi Live - New Seasons and Release Date!
Super Lumi Live

Super Lumi Live - New Seasons and Release Date!

Super Lumi Live

Super Lumi Live finally has a release date! The first two Seasons containing 17 levels will be available for purchase on March 14th!

I am overburdened, monsters and mods
I am overburdened

I am overburdened, monsters and mods

I am overburdened

Small update this time. Been working on wrapping up all the remaining core features, but got a bit sidetracked so I'm going to write a little about level...

Dark Stars DX available on Android!
Dark Stars

Dark Stars DX available on Android!

Dark Stars 1 comment

The weird, challenging action game Dark Stars DX is now available for free on Android phones on Google Play!

Add game Games
Flotilla WWII

Flotilla WWII

Turn Based Strategy

A WWII naval TBS game inspired by the 90's games of the same theme. Build factories, ports and airfields in the Pacific, bring in ships and aircraft...

Super Lumi Live

Super Lumi Live

Platformer

Super Lumi Live is a love letter for 2D platformers. Set in a futuristic reality TV show, Super Lumi Live is focused on having fun speedrun levels with...

I am overburdened

I am overburdened

Roguelike

I am overburdened is a small "arcadey" rogue-like with a fun twist to the tried and true classical formula. The player takes the role of a hero, who has...

Cavern Crumblers

Cavern Crumblers

Arcade

A competitive, single-screen, local multiplayer shooter for 2-4 players with destructible terrain that focuses on a platformer-like feel with simple yet...

The Wishgranter

The Wishgranter

Roguelike

Action Roguelike inspired by Classic Legend of Zelda and traditional Roguelikes.

Dark Stars

Dark Stars

Arcade

A challenging "anti-shmup" featuring unique weaponless combat.

Yellow Desire

Yellow Desire

Platformer

The game is based on a platform game, and my main character is called Rheiz, which is a furry character and his story before the game is simple to understand...

Imagine Earth

Imagine Earth

Futuristic Sim

As a space colony manager your aim is to explore and populate distant planets. Build up thriving and profitable colonies on a global scale without destroying...

Collect or Die

Collect or Die

Platformer

Collect or Die is a hardcore retro platformer with dynamic ragdoll physics & dismemberment. The goal is simple, help stickman collect every coin in each...

Graveyard March

Graveyard March

Arcade

Graveyard March is a retro-inspired mobile game that mixes side-scrolling action with strategic approach by indirect control. Take the role of a baron...

Comments  (0 - 10 of 33)
Jdawgg25
Jdawgg25

I have uploaded some open-source XNA 4.0 projects on my downloads page here: Indiedb.com

I will be uploading more projects there later over time. Happy Coding :-D

Reply Good karma Bad karma+1 vote
Jdawgg25
Jdawgg25

Finally! MonoGame is coming to Xbox One. MonoGame implements XNA 4.0 and allows developers to port their games to other platforms besides the default platforms supported already by the XNA 4.0 Framework. Link: Twitter.com

Also, I need to correct myself on an older post. Unity has Mono built into it, not MonoGame. So if you are eager to finish your XNA game, with some work, it is possible to import your XNA or MonoGame project into Unity. Mono is a cross-platform open source implementation of Microsoft's .NET Framework. It is based on the ECMA standards for C# and the Common Language Runtime.

Reply Good karma Bad karma+1 vote
Jdawgg25
Jdawgg25

With MonoGame 3.4 (which is the continuation of XNA 4.0) for Visual Studio 2015, it is now possible to create a game for Universal Windows Platform (UWP). This also makes it possible to get your XNA project to run on Windows 10 with UWP. Since the Xbox One dev kit supports UWP, it might also be possible to get a MonoGame project running on it.

Reply Good karma Bad karma+1 vote
CakeKing64
CakeKing64

Awesome :P

Reply Good karma Bad karma+1 vote
Jdawgg25
Jdawgg25

If anyone is curious, it is possible to integrate your XNA Game Project into Unity, but it might take a little extra work. This is a proof of concept showing the Platformer XNA starter kit running inside Unity3D. Zero code changes have been made to the original game code. Using a mixture of new code and some code from MonoGame, the author has implemented XNA emulation. They did so by having a game object with a script attached run an XNA game performing updates and drawing.

Check out this link below for the source code:
Github.com

Reply Good karma Bad karma+3 votes
Arethrid
Arethrid

Interesting but what about the performance? I persume it would drop radically under such conditions.

Reply Good karma Bad karma+1 vote
Jdawgg25
Jdawgg25

My apologies for replying back so late. Under such conditions, it is possible for the frame-rate to drop. By performance, are you referring to graphics specifically? I sometimes rarely hear people speak of physics performance or audio performance. Honestly it depends how the XNA game was coded prior to being imported into Unity. It would be best to fix garbage collection issues in your XNA game project before importing it into Unity. There are many ways to help increase performance in your XNA project prior to importing it into Unity. Its a question of whether or not you are CPU or GPU bound. Using the CLR Profiler can help you find out. Things like changing foreach loops to for, multi-threading, using StringBuilder instead of String, and using DrawUserPrimitives are just some ways to help the frame-rate. In my game constructor, I set the following to false: IsFixedTimeStep = false; and graphics.Synchr

Reply Good karma Bad karma+1 vote
Arethrid
Arethrid

(Sorry for the double post. I didn't realize that I was logged out)

No problem. Yes, I was referring to the graphics performance.
You mentioned DrawUserPrimitives(). So far I have only used it in 3D with Vector3. Do you use DrawUserPrimitives in 2D as well? If so are you still using a Vector3 and just projecting 3D data on an orthographic view? Do you know if vector2 can be used with vertecies and triangles?
Thanks.

Reply Good karma Bad karma+1 vote
Jdawgg25
Jdawgg25

For drawing primitives in 2D, you really just need to know what to tell the system to make it work. Check out this great tutorial for more information. I hope it will further answer your questions as it has helped me.

Bit-101.com

Reply Good karma Bad karma+1 vote
Arethrid
Arethrid

I checked the link you posted, after seeing it I remembered that I checked the same blog long ago (might be a couple of years ago). Turns out the author is talking about what I was refering in my comment. Projecting Vector3 vertecies on an orthographic view. It was good to read it again. Thanks a lot for the reply and the link.
Cheers!

Reply Good karma Bad karma+1 vote
Guest
Guest

This comment is currently awaiting admin approval, join now to view.

DonBre
DonBre

nice! :D

Reply Good karma Bad karma+1 vote
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Follow Report Profile
Platforms
Windows, Mobile, X360
Contact
Send Message
Licence
Public Domain
Release date
Engine watch
Follow
Share
Community Rating

Average

8.9

52 votes submitted.

You Say

-

Ratings closed.

Highest Rated (2 agree) 9/10

It's not an engine, its a framework basically a template to directX. I really like it because it allows you to develop for 3 Microsoft platforms and can port them easily.

Jul 14 2012 by atsebak

Embed Buttons
Link to XNA by selecting a button and using the embed code provided more...
XNA
Statistics
Rank
144 of 862
Last Update
Watchers
110 members
Games
511
Files
288
Articles
982
Reviews
12
You may also like
EDuke32
EDuke32 GPL
Unity
Unity Commercial
IW Engine
IW Engine Commercial
Quake Engine
Quake Engine GPL
id Tech 4
id Tech 4 Commercial
WOLF RPG Editor
WOLF RPG Editor GPL