xna keyboard freetype function

Been working on a function to simulate all keyboard events and return pressed keys in XNA.

public string GetPressedKey()
{
Keys[] keysDown = CurrentKeyboardStates[0].GetPressedKeys();

if (keysDown.Length == 1 && CurrentKeyboardStates[0] != LastKeyboardStates[0])
foreach (ggFramework.Symbols item in symbols)
if (item.index == (byte)keysDown[0])
return item.symbol.ToString();
return string.Empty;
}

Create an array of pressed keys and get a list of pressed keys.
If 1 key is down and the current key state is not equal to the previous state then do; for each symbol in a list of expected symbols we expect to see, check whether the key down’s byte value is equal to the expected value you want to detect. By this I mean, have an array containing  objects, each with it’s own decimal value related ascii symbol.

I use an xml file containing my data and I load that into my array.

public class Symbols
{
public byte index;
public char symbol;
}

If the keyDown is recognized as one of the keys listed in the array, it will return the char.

ggFw 1.0

ggFramework 1.0

Features:

        • GameObject class with great ease of use. Also allows for animation and AI (still being worked on).
  • KeyboardState predefined functions which break away from the traditional keyboardState functionality.
  • MouseState predefined functions for Clicking or hovering over rectangles, or GameObjects.
  • Particle Engine which manages multiple textures and is semi versicle.
  • SoundManager contains a list of sounds, instances and track titles, allowing for easy sound management. Also contains predefined functions.
  • XMLManager which is currently only used for uploading textures featuring multiple images.

Vindiginal

In life everything comes in pairs and there is no exception. You may need to think outside the box for some answers but it’s really not something you should need to question.

My question is ‘What do I want to do with my life?’.

Well, I want to change the world for the better; and now you may say ‘Well, who doesn’t?’ and while this is true; we in life reap what we sow.

Okay. So the next question is how are you going to change the world? Doing what I love. Teaching ethics and philosophy through computer games. An instruction manual with an entertainment mechanic.

Game Mechanics

  • Customization. Players can change 7 color properties to customize their character’s clothes.
  • Random levels. Levels are generated at the start of the server, when all players have finished the area or are dead (requires at least 1 finishing player).
  • Food. All items are made of materials; some of these materials are edible. Upon taking turns, your food counter decreases. Reaching 0 food will decrease a fat layer. The fewer fat layers you have, the lower your stat potential is and the faster your food meter will drop in future. Maintaining a high food meter over a long duration will increase your fat layer.
  • Item Materials. For non-food like items, the material is a factor in the base stats of the item.
    Materials include, from worst to best: Fruit, Pork, Wooden, Leather, Studded Leather, Iron Chainmail, Steel Chainmail, Steel Plate. Some unique materials exist such as Ham and Elemental.
  • Item Quality. Factor used in determining the overal power of an item.
  • Stat potential is the percent of your stats you can use. If you have 20 strength but only 50% stat potential, you essentially only have 10 strength.
  • Water. Throughout levels you will find wells and springs. Some of these you’ll be able to extract water from using tools.
  • Tools. While adventuring you’ll come across a range of tools. Bucket (collecting water). needs more thought…
  • Speed. Characters have a speed property which determines how many actions they make take during a turn. Actions such as attacking, moving a tile, resting (skipping turn to gradually regenerate life), and generally performing basic tasks.
  • Locked Doors. Some areas contain keys or puzzles for opening doors.
  • Attribute points. Upon leveling up the player is rewarded with few attribute points. Attributes include Strength, Agility and Intelligence.
  • Strength affects life regen, total life and base damage, but slightly increases food drain.
  • Agility affects speed and evasion. Increases maximum stat potential (above 100%).
  • Intelligence affects perception (helps see items), spirit regeneration and total spirit (mana).
  • Spirit. Used in mind-based abilities.
  • Karma. Effects how some NPC’s will react around you.
  • Praying. Shrines to Gods pop up now and then, you can pray to them for spirit gain and positive karma, or sacrifice it for negative karma. Some evil gods will reward you for having negative karma randomly during turns. Rewards are optional.
  • Negative Karma Rewards. Extinct a species (if you can answer a riddle). Summon an item (If you can defeat a boss). Turn a player undead at the cost of your life.
  • Undead. Being undead halves your stat potential and removes food drain. Additionally you cannot pray to, or sacrifice alters. The gods abandon you. Your karma is stuck at 0 as the cursor (the player who made you undead) died for your sins. Being undead is permanent.
  • Death. Permanent. Unless the player holds an Ankh in their inventory the player will die. Dying with an ankh puts you at full life and stat potential.

Dungeon Gen

 

Original gen. Small rooms separated by 2×1 corridors. Rooms didn’t always link up and levels as a whole didn’t feel unique enough.

dayum

New gen. Changed walls to whole blocks due to the way walls are now generated. Still occasional areas that are unreachable, but the path finding algorithm will hopefully stop the game from generating levels with unreachable terrain.

Levels are generated by the server upon launch and when entering a new area.

Upon connecting (LOGIN) to the server, the player is sent level object’s.

When moving, it the server-side checks whether there is a wall in the location the player is trying to move… so, server-side collision.

dayum x2

Top-down dungeon crawler, multiplayer game

I’ve been thinking how I’m going to turn the existing game into a multiplayer game.
When the server is hosted, the game difficulty is determined by the host’s character’s level.When people join this game, they spawn in a random room on the same floor as the host player,
regardless of their character’s level.

Levels are made up of 10×10 areas. Each area contains a 3×3 floor space. Areas are connected by a simple 1×2 path.
Currently the game generates an array of these objects all around the level at random, then we declare that if, for example, area[ x + 1, y ] exists, then area[ x, y ] has a bridge (a path) leading east, and area[ x + 1, y ] has a bridge leading west. A random floor tile in the level is transformed into the staircase leading up, and another leading down.
GameObjects are either WALKABLE, or NOT_WALKABLE.

Things I plan to add:(x = priority)

  • Inventory. Dropping and Picking up items on floor.(6)
  • Character data saved onto server (2)
  • Stat development over real-time (not affected by turn based movement) (7)
  • Chat box (3)
  • Event box (4)
  • Turn based movement (5)
  • Path finding to determine level is completable (1)