Game Development
In the last article, we discussed creating a database manager to handle our abstracted data layer. Today, we will discuss how to use Reflection on a .Net class object's properties tied to custom attributes so we can build SQL statements on the fly.
Part I - Database Abstraction
Part II - Database Manager
Part III - Reflection and Custom Attributes for SQL Generation
In my previous article, I discussed database abstraction and provided code to connect to various SQL database types such as Microsoft SQL Server (and SQL Compact), MySQL, and SQLite. Today I'm going to go over how to connect to those classes with a nice and easy database manager class which will manage accessing our database (which-ever that might be).
Part I - Database Abstraction
Part II - Database Manager
Part III - Reflection and Custom Attributes for SQL Generation
There comes a time when building applications, whether it's a game project, a business app, or a web app, that one needs to store data in a database. Websites (such as this) use databases extensively. Stand-alone applications have their choice on how they store information. Some just use Binary files and write data to them, others use a more complex XML schema for cross application compatibility. Others use SQL databases.
Today, we are going to focus on the SQL database approach. In game development, this is a must for anyone wishing to write a robust server that players can connect to and play.
Part I - Database Abstraction
Part II - Database Manager
Part III - Reflection and Custom Attributes for SQL Generation
using System; namespace YourFavouriteNamespace { public static class Easing { // Adapted from source : http://www.robertpenner.com/easing/ public static float Ease(double linearStep, float acceleration, EasingType type) { float easedStep = acceleration > 0 ? EaseIn(linearStep, type) : acceleration < 0 ? EaseOut(linearStep, type) : (float) linearStep; return MathHelper.Lerp(linearStep, easedStep, Math.Abs(acceleration)); } public static float EaseIn(double linearStep, EasingType type) { switch (type) { case EasingType.Step: return linearStep < 0.5 ? 0 : 1; case EasingType.Linear: return (float)linearStep; case EasingType.Sine: return Sine.EaseIn(linearStep);







