User:Xudojnik

From The Battle for Wesnoth Wiki
Revision as of 19:28, 2 September 2010 by Xudojnik (talk | contribs)

I know Wesnoth from version 1.1.2a. This is really perspective game not only as strategy, but as RPG too. Large world, filled by history, epic battles, heroes and factions, is perfect for creating RPG. It's not so hard because Wesnoth have simple language, what support wide variety of events, easy way to define dialogs, items, forum and Wiki, where always can be found answer for any question.

There are function, what are completed or close to it:

  1. Weapon vendor.
  2. Potion vendor.
  3. Home(place, where hero can change his weapons, take rest).
  4. Stable, where hero can buy horse.
  5. Mounting/dismounting on that horse. Two types of weapon: for mounted hero and foot.
  6. Talking to NPC's.
  7. NPC's shedule in one string.
  8. Spellcasting system (general-purpose examples of spells, what can be copied and changed later).
  9. Quest log now wait for content.
  10. Beneficial spell effects needs only more spells.
  11. Improved inventory, Spellbook.

There are in the future:

  1. Dog (taming, training, feeding).
  2. Levelling and customising character.



At the end of my work, I get unimaginable amount of lags, long and boring loading time and HUGE savegames. And I leave it. Now I wait for stable version of BfW 1.9. The only reason is implemented persistent variables. I will wrote here some basic terms of this project.

WesMMO

To play it (now only in theory):

  1. Design new character.
    • Download WesMMO era.
    • Download beginner's map, designed for WesMMO.
    • Create game in lobby.
    • Create an "account" and character on it.
    • Win beginner's scenario.
  2. Get fun.
    • Download some other playable map, designed for WesMMO.
    • Create game in lobby.
    • Map will automatically use your account. Now choose any existed character and play.
I planned to invent spell-system in this MMO, but not yet decide about mana and cooldowns.

Character is a "team" of three units. Each unit have own stats, small inventory and spellbook.

Stats should be simple
Stamina - increases your hitpoints by 2 (3?) per point.
Strength - increases your melee damage.
Speed - increases your movement points.
Agility - increase your defense on each type of terrain by 1 per point and ranged damage.
Intellect of Spell Power (or both)- increase magical potence of unit
Inventory contains
Healing Potion - number of them.
Mana Potions - number of them.
Melee Weapon - affects melee combat: strength_multiplier and number_of_strikes and possibly defenses.
Ranged Weapon - affects ranged combat: damage_from_agility_multiplier and number_of_strikes.
Amulet - affects base stats, magical resistances and magical potency of unit
Body Armor - affects base stats, all resistances and defenses.
Boots - affects base stats and have movement_multipier.
Helm - affects melee resistances and magical potency of unit.

Each item has it own's id. Data about it will be stored inside WesMMO era. That allows me to implement 'inventory slots'. Players will carry unused items in them.

Spellbook will contains information about direct spells and units's auras.

How does this work

There should be macro to refresh visible stats of hero (hp, damage e.t.c.) It should be called when unit change it's base stats.

List of variables
stat.stamina.base + it will contain base stats, what will only depends from the class of unit
stat.stamina.buffed
stat.stamina.total_modifier need this to implement debuffs like -50% hp, default "1"
stat.strength.base +
stat.strength.buffed
stat.strength.total_modifier
stat.speed.base +
stat.speed.buffed
stat.speed.total_modifier
stat.agility.base +
stat.agility.buffed
stat.agility.total_modifier
stat.damage_multiplier
inv.healing +
spb.aura_id +
spb.aura_id +
spb.aura_id +
spb.direct_id +
spb.direct_id +
spb.direct_id +

In perfect way, I should create some sort of database (TD).

1) It consist of tree parts. First parts should contain booleans to check "does item useful?". And second should contain one big macro, what will create variables for "useful items". There will be as much of this DB's as slots for items.

Comment: At the beginning, load whole Database of items to see how it eats PC's memory.

struct body{
 int stamina;
 int strength;
 int agility;
 int pierce;
 int blade;
 int blow;
 int arcane;
 int fire;
 int cold;
}

struct boots{
 int speed_multiplier; 
 int stamina;
 int strength;
 int agility;
}

struct head{
 int pierce;
 int blade;
 int blow;
}

struct melee{
 int strength_multiplier;
 int speed;
 int defense;
}

struct class{
 int stamina
 int strength
 int speed
 int agility
}

struct TD{
 struct body;
 struct boots;
 struct head;
 struct melee;
 struct ranged;
 struct class;
}

struct buffed{
 int stamina;
 int strength;
 int agility;
 int pierce;
 int blade;
 int blow;
 int arcane;
 int fire;
 int cold;
 int stamina_multiplier;
 int strength_multiplier;
 int agility_multiplier;
}

struct unit{
 struct inv;
 struct spb;
 struct buffed;
}
void UpdateDatabase()
{
 for( int i = 0; i < NUMBER_OF_ITEMS; i ++ )
 {
  if( usefulness[i] )
   CreateVariablesOfItem( i );
  if( !usefulness[i] )
   ClearVariablesOfItem( i );
 }
}
unit Player;
StoreUnit( Player );
void UpdateStats( unit * Player )
{
 if( !usefulness[Player.inv.body.item_id] )
 {
  CreateVariablesOfItem( Player.inv.body.item_id );
  usefulness[Player.inv.body.item_id] = 1;
 }
 if( !usefulness[Player.inv.boots.item_id] )
 {
  CreateVariablesOfItem( Player.inv.boots.item_id );
  usefulness[Player.inv.boots.item_id] = 1;
 }
 Player.damage = ( TD.class[Player.class].strength + TD.body[Player.inv.body.item_id].strength + TD.boots[Player.inv.boots.item_id].strength + Player.buffed.strength ) *  TD.melee[Player.inv.melee.item_id].strength_multiplier * Player.buffed.strength_multiplier;
 //Each class of items have it's own list of possible stats. Thats why I call to each item, which can have such stats.
}
void TakeOffItem( int itemid, string itemtype, unit * Player )
{
 CancelStats( itemtype, Player );
 ClearVariablesOfItem( itemid );
 usefulness[itemid] = 0;
}
void PickUpItem( int itemid, string itemtype, unit * Player )
{
 CreateVariablesOfItem( new_item_id );
 Give Stats( new_item_id );
 usefulness[new_item_id] = 1;
}
void CancelStats(string itemtype, unit * Player)
{
 switch(itemtype)
 {
  case "body" : 
  {
   Player.inv.body.stamina = 0;
   Player.inv.body.strength = 0;
   Player.inv.body.agility = 0;
   Player.inv.body.pierce = 0;
   Player.inv.body.blade = 0;
   Player.inv.body.blow = 0;
   Player.inv.body.arcane = 0;
   Player.inv.body.fire = 0;
   Player.inv.body.cold = 0;
   Player.inv.body.item_id = 0;
  } break;

  case "boots" :
  {
   Player.inv.boots.speed_multiplier = 0; 
   Player.inv.boots.stamina = 0; 
   Player.inv.boots.strength = 0; 
   Player.inv.boots.agility = 0;
   Player.inv.boots.item_id = 0;
  } break;

  case "head" :
  {
   Player.inv.head.pierce = 0;
   Player.inv.head.blade = 0;
   Player.inv.head.blow = 0;
   Player.inv.head.item_id = 0;
  } break;

  case "melee" :
  {
   Player.inv.melee.strength_multiplier = 0;
   Player.inv.melee.speed = 0;
   Player.inv.melee.defense = 0;
   Player.inv.melee.item_id = 0;
  } break;

  case "ranged" :
  {
   Player.inv.ranged.agility_multiplier = 0;
   Player.inv.ranged.speed = 0;
   Player.inv.ranged.defense = 0;
   Player.inv.ranged.item_id = 0;
  } break;

  default :
  {
   ErrorMessage();
  }
 }
}
void GiveStats( int new_item_id, string itemtype, unit * Player )
{
 switch(itemtype)
 {
  case "body" : 
  {
   Player.inv.body.stamina = TD.body[new_item_id].stamina;
   Player.inv.body.strength = TD.body[new_item_id].strength;
   Player.inv.body.agility = TD.body[new_item_id].agility;
   Player.inv.body.pierce = TD.body[new_item_id].pierce;
   Player.inv.body.blade = TD.body[new_item_id].blade;
   Player.inv.body.blow = TD.body[new_item_id].blow;
   Player.inv.body.arcane = TD.body[new_item_id].arcane;
   Player.inv.body.fire = TD.body[new_item_id].fire;
   Player.inv.body.cold = TD.body[new_item_id].cold;
   Player.inv.body.item_id = new_item_id;
  } break;

  case "boots" :
  {
   Player.inv.boots.speed_multiplier = TD.boots[new_item_id].speed_multiplier; 
   Player.inv.boots.stamina = TD.boots[new_item_id].stamina;
   Player.inv.boots.strength = TD.boots[new_item_id].strength;
   Player.inv.boots.agility = TD.boots[new_item_id].agility;
   Player.inv.boots.item_id = new_item_id;
  } break;

  case "head" :
  {
   Player.inv.head.pierce = TD.head[new_item_id].pierce;
   Player.inv.head.blade = TD.head[new_item_id].blade;
   Player.inv.head.blow = TD.head[new_item_id].blow;
   Player.inv.head.item_id = new_item_id;
  } break;

  case "melee" :
  {
   Player.inv.melee.strength_multiplier = TD.melee[new_item_id].strength_multiplier;
   Player.inv.melee.speed = TD.melee[new_item_id].speed;
   Player.inv.melee.defense = TD.melee[new_item_id].defense;
   Player.inv.melee.item_id = new_item_id;
  } break;

  case "ranged" :
  {
   Player.inv.ranged.agility_multiplier = TD.ranged[new_item_id].agility_multiplier;
   Player.inv.ranged.speed = TD.ranged[new_item_id].speed;
   Player.inv.ranged.defense = TD.ranged[new_item_id].defense;
   Player.inv.ranged.item_id = new_item_id;
  } break;

  default :
  {
   ErrorMessage();
  }
 }
}