User:Xudojnik

From The Battle for Wesnoth Wiki
Revision as of 14:15, 4 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. This ID is the key to macro what will apply effect of item stats to unit structure. 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.

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

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 unit{
 struct inv{
  int body_item_id;
  int boots_item_id;
  int head_item_id;
  int melee_item_id;
  int ranged_item_id;
  int healing_potions;
  struct free_slot[6]{
   int item_id;
   string item_type;
  };
  struct body{
   int stamina;
   int strength;
   int agility;
   int pierce;
   int blade;
   int blow;
   int arcane;
   int fire;
   int cold;
  };
  struct boots{
   int speed;
   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 ranged
   int agility_multiplier;
   int speed;
   int defense;
  };
 };
 struct buffed{
  int stamina;
  int strength;
  int agility;
  int speed;
  int pierce;
  int blade;
  int blow;
  int arcane;
  int fire;
  int cold;
  int hitpoints_multiplier; //NOTE: There is no stamina_multiplier.
  int strength_multiplier;
  int agility_multiplier;
  int speed_multiplier;
 };
 struct class{
  int stamina;
  int strength;
  int speed;
  int agility;
  struct defense{
   int castle;
   int cave;
   int deep_water;
   int flat;
   int forest;
   int frozen;
   int fungus;
   int hills;
   int reef;
   int sand;
   int shallow_water;
   int swamp_water;
  };
  struct resistance{
   int arcane;
   int blade;
   int cold;
   int fire;
   int impact;
   int pierce;
  };
 };
 //standart WML values:
 int max_experience;
 int max_hitpoints;
 int max_moves;
 struct defense{
  int castle;
  int cave;
  int deep_water;
  int flat;
  int forest;
  int frozen;
  int fungus;
  int hills;
  int reef;
  int sand;
  int shallow_water;
  int swamp_water;
 };
 struct resistance{
  int arcane;
  int blade;
  int cold;
  int fire;
  int impact;
  int pierce;
 };
 struct attack[2]{
  int damage;
  int number;
  int type;
  int range;
 }; // 0 - melee, 1 - ranged
};

struct "inv" will be stored as persistent variable. Other structures will be forgotten, because there will be functions to calculate their content.

unit Player;
StoreUnit( Player );
//This function counts output values, what player will see on the right panel.
void UpdateStats( unit * Player )
{ 
 Player.damage = ( Player.class.strength + Player.inv.body.strength + Player.inv.boots.strength + Player.buffed.strength ) *  Player.inv.melee.strength_multiplier * Player.buffed.damage_multiplier;

 Temp = Player.max_hitpoints / Player.hitpoints;

 Player.max_hitpoints = ( Player.class.stamina + Player.inv.body.stamina + Player.inv.boots.stamina + Player.buffed.stamina ) * Player.buffed.hitpoints_multiplier;

 Player.hitpoints = Player.max_hitpoints / Temp;

 Player.max_moves = ( Player.class.speed + Player.inv.boots.speed + Player.buffed.speed ) * Player.inv.boots.speed_multiplier * Player.buffed.speed_multiplier;

 Player.defense.castle = Player.class.defense.castle + Player.buffed.defense.castle + Player.inv.melee.defense + ( Player.class.agility + Player.buffed.agility + Player.inv.body.agility + Player.inv.boots.agility ) * 5; // I can easily tweak it later.

 Player.defense.cave = Player.class.defense.cave + Player.buffed.defense.cave + Player.inv.melee.defense + ( Player.class.agility + Player.buffed.agility + Player.inv.body.agility + Player.inv.boots.agility ) * 5; // I can easily tweak it later.

 Player.defense.deep_water = Player.class.defense.deep_water + Player.buffed.defense.deep_water + Player.inv.melee.defense + ( Player.class.agility + Player.buffed.agility + Player.inv.body.agility + Player.inv.boots.agility ) * 5;

 Player.defense.flat = Player.class.defense.flat + Player.buffed.defense.flat + Player.inv.melee.defense + ( Player.class.agility + Player.buffed.agility + Player.inv.body.agility + Player.inv.boots.agility ) * 5;

 Player.defense.forest = Player.class.defense.forest + Player.buffed.defense.forest + Player.inv.melee.defense + ( Player.class.agility + Player.buffed.agility + Player.inv.body.agility + Player.inv.boots.agility ) * 5;

 Player.defense.frozen = Player.class.defense.frozen + Player.buffed.defense.frozen + Player.inv.melee.defense + ( Player.class.agility + Player.buffed.agility + Player.inv.body.agility + Player.inv.boots.agility ) * 5;

 Player.defense.fungus = Player.class.defense.fungus + Player.buffed.defense.fungus + Player.inv.melee.defense + ( Player.class.agility + Player.buffed.agility + Player.inv.body.agility + Player.inv.boots.agility ) * 5;

 Player.defense.hills = Player.class.defense.hills + Player.buffed.defense.hills + Player.inv.melee.defense + ( Player.class.agility + Player.buffed.agility + Player.inv.body.agility + Player.inv.boots.agility ) * 5;

 Player.defense.reef = Player.class.defense.reef + Player.buffed.defense.reef + Player.inv.melee.defense + ( Player.class.agility + Player.buffed.agility + Player.inv.body.agility + Player.inv.boots.agility ) * 5;

 Player.defense.sand = Player.class.defense.sand + Player.buffed.defense.sand + Player.inv.melee.defense + ( Player.class.agility + Player.buffed.agility + Player.inv.body.agility + Player.inv.boots.agility ) * 5;

 Player.defense.shallow_water = Player.class.defense.shallow_water + Player.buffed.defense.shallow_water + Player.inv.melee.defense + ( Player.class.agility + Player.buffed.agility + Player.inv.body.agility + Player.inv.boots.agility ) * 5;

 Player.defense.swamp_water = Player.class.defense.swamp_water + Player.buffed.defense.swamp_water + Player.inv.melee.defense + ( Player.class.agility + Player.buffed.agility + Player.inv.body.agility + Player.inv.boots.agility ) * 5;
}
UnstoreUnit();
void TakeOffItem( int itemid, string itemtype, unit * Player )
{
}
void PickUpItem( int itemid, string itemtype, unit * Player )
{
}
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 = 0;
   Player.inv.ranged.item_id = new_item_id;
  } break;

  default :
  {
   ErrorMessage();
  }
 }
}

TODO:
Add missed formulas to UpdateStats();.
Update PickUpItem();.
Update TakeOffItem();.
Implement free slots.
Make things clear about spells.
Make things clear about AMLA.
Make things clear about trade.
Implement loot tables from bosses and mobs.
Implement "Group Loot".