Page 2 of 2 [ 23 posts ]  Go to page Previous  1, 2

kxmode
Supporting Member
Supporting Member

User avatar

Joined: 14 Oct 2007
Gender: Male
Posts: 2,613
Location: In your neighborhood, knocking on your door. :)

18 Aug 2011, 4:37 am

This project is dead. I wanted to organized the assets folder. There was 1.3 GB worth of stuff in there and it was becoming difficult to manage. I don't like the Asset folder inside Unity so I managed everything in Windows Explorer. This completely destroyed everything. I've VERY disappointed with Unity. They gave no warning about doing this, setting the files to read only, or something. I put about 19 hours into the project... all of it... gone in less than 2 hours. :(



Ambivalence
Veteran
Veteran

User avatar

Joined: 8 Nov 2008
Age: 47
Gender: Male
Posts: 3,613
Location: Peterlee (for Industry)

18 Aug 2011, 6:33 am

Ouch. :(


_________________
No one has gone missing or died.

The year is still young.


BrandonSP
Veteran
Veteran

User avatar

Joined: 5 Jul 2010
Age: 35
Gender: Male
Posts: 1,286
Location: Fallbrook, CA

18 Aug 2011, 11:25 am

That must be especially painful considering how much time and effort you put into it. And to think that I was considering playing with Unity myself!


_________________
Check out my art for sale over at Society6, dudes!


kxmode
Supporting Member
Supporting Member

User avatar

Joined: 14 Oct 2007
Gender: Male
Posts: 2,613
Location: In your neighborhood, knocking on your door. :)

18 Aug 2011, 3:06 pm

BrandonSP wrote:
That must be especially painful considering how much time and effort you put into it. And to think that I was considering playing with Unity myself!


It is REALLY painful but I wouldn't let my experience stop you. Stuff happens in any programs. For example Photoshop and Flash - two apps I am very comfortable with - will sometimes flip out on me and in the process corrupt the files I'm working on. I try to salvage them but it's too late. Do I think Photoshop or Flash are horrible? No way! The same is true with Unity.

Unity is an awesome tool, but it requires finesse and careful use. I'm going to learn from this painful mistake. Use my experience as a cautionary tale for your Unity project. Going forward the lesson learned is I won't touch the project's assets in Windows Explorer, and I'll be careful not to outright delete stuff. It could damage dependency and ultimately corrupt the Project.

On a plus side I still have the heightmap and ground textures. I just need to recreate the map.



kxmode
Supporting Member
Supporting Member

User avatar

Joined: 14 Oct 2007
Gender: Male
Posts: 2,613
Location: In your neighborhood, knocking on your door. :)

18 Aug 2011, 11:47 pm

I am working on a simple RPG. Here's a sample of the C# code for the Player's character. This is part of the large collection. So far there's Attribute.cs, BaseStat.cs, ModifiedStat.cs, PlayerCharacter.cs, Skill.cs, and Vital.cs. I'm currently working on the Character Generator UI for people to name their character and assign skills points.

Code:
using UnityEngine;
using System.Collections;
using System;             // access the enum class to assign attributes, vitals and skills

public class BaseCharacter : MonoBehaviour {
   
   private string _name; // underscores are used to denote private variables
   private int _level;
   private uint _freeExp; // ints are limited to a value of 2.6 billion whereas uint allow up to 4.6 billion;
   private float _defaultStatValue;

   private Attribute[] _primaryAttribute;
   private Vital[] _vital;
   private Skill[] _skill;
   
   // Happens before anything else in script
   public void Awake(){
      _name = string.Empty;
      _level = 0;
      _freeExp = 0;
      
      // Creates new attributes, vitals, and skills based on the size of those from Attribute.cs, Vitals.cs and Skill.cs
      _primaryAttribute = new Attribute[Enum.GetValues(typeof(AttributeName)).Length];
      _vital = new Vital[Enum.GetValues(typeof(VitalName)).Length];
      _skill = new Skill[Enum.GetValues(typeof(SkillName)).Length];
      
      SetupPrimaryAttribute();
      SetupVitals();
      SetupSkills();
   }
   
   #region Basic Setters and Getters
   // Get the stored values and set the values
   public string Name {
      get { return _name; }
      set { _name = value; }
   }

   public int Level {
      get { return _level; }
      set { _level = value; }
   }

   public uint FreeExp {
      get { return _freeExp; }
      set { _freeExp = value; }
   }
   #endregion
   
   // Adds XP to Player
   public void AddExp(uint exp) {
      _freeExp += exp;
      
      CalculateLevel();
   }
   
   // Take the average of all the Player's skills and assign that as the Player's level
   public void CalculateLevel() {

   }
   
   #region Setup Default Stats
   // Setup default attributes
   private void SetupPrimaryAttribute(){
      for (int cnt = 0; cnt < _primaryAttribute.Length; cnt++) { // assign the base value to the attributes
         _primaryAttribute[cnt] = new Attribute();
      }
   }
   
   // Setup default vitals
   private void SetupVitals() {
      for (int cnt = 0; cnt < _vital.Length; cnt++) { // assign the base value to the vitals
         _vital[cnt] = new Vital();
      }
   }
   
   // Setup default skills
   private void SetupSkills() {
      for (int cnt = 0; cnt < _skill.Length; cnt++) { // assign the base value to the skills
         _skill[cnt] = new Skill();
      }
   }
   #endregion
   
   #region Stat Setters and Getters
   public Attribute GetPrimaryAttribute(int index) {
      return _primaryAttribute[index];
   }

   public Vital GetVital(int index) {
      return _vital[index];
   }

   public Skill GetSkill(int index) {
      return _skill[index];
   }
   #endregion
   
   #region Value modifiers for Health, Energy and Mana
   // Setup value modifiers for Health, Energy and Mana
   private void SetupVitalModifiers() {
      // Health is typecasted to an int then a modifier the value of Constitution is added to health
      GetVital((int)VitalName.Health).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Constitution), .5f));
      
      // Energy is typecasted to an int then a modifier the value of Constitution is added to energy
      GetVital((int)VitalName.Energy).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Constitution), 1));

      // Mana is typecasted to an int then a modifier the value of Willpower is added to mana
      GetVital((int)VitalName.Mana).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Willpower), 1));
   }
   #endregion
   
   #region Value modifiers for Skills
   // Setup value modifiers for Skills
   private void SetupSkillModifiers() {
      _defaultStatValue = .33f;
      
      // Add Modifier to stat
      
      // Melee offense
      GetSkill((int)SkillName.Melee_Offense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Might), _defaultStatValue));
      GetSkill((int)SkillName.Melee_Offense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Nimbleness), _defaultStatValue));
      
      // Melee defense
      GetSkill((int)SkillName.Melee_Offense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Speed), _defaultStatValue));
      GetSkill((int)SkillName.Melee_Defense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Constitution), _defaultStatValue));
      
      // Magic offense
      GetSkill((int)SkillName.Magic_Offense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Concentration), _defaultStatValue));
      GetSkill((int)SkillName.Magic_Offense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Willpower), _defaultStatValue));
      
      // Magic defense
      GetSkill((int)SkillName.Magic_Defense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Concentration), _defaultStatValue));
      GetSkill((int)SkillName.Magic_Defense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Willpower), _defaultStatValue));
      
      // Ranged offense
      GetSkill((int)SkillName.Ranged_Offense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Concentration), _defaultStatValue));
      GetSkill((int)SkillName.Ranged_Offense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Speed), _defaultStatValue));
      
      // Ranged defense
      GetSkill((int)SkillName.Ranged_Defense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Speed), _defaultStatValue));
      GetSkill((int)SkillName.Ranged_Defense).AddModifier(new ModifyingAttribute(GetPrimaryAttribute((int)AttributeName.Nimbleness), _defaultStatValue));
   }
   #endregion
   
   // Actually update the stats
   public void StatUpdate() {
      for(int cnt = 0; cnt < _vital.Length; cnt++)
         _vital[cnt].Update();

      for(int cnt = 0; cnt < _skill.Length; cnt++)
         _skill[cnt].Update();
   }
}



URtheALIEN
Sea Gull
Sea Gull

User avatar

Joined: 9 Aug 2011
Age: 51
Gender: Male
Posts: 211
Location: SW PA USA

19 Aug 2011, 9:10 am

Kxmode, I wish I was a programmer to understand all that was going on in that thread! I am however a game designer, what stats are you using? I have studied a lot of different systems and they all of their perks and sux.... interested in what you decided to go with.


_________________
I'm not angry, this is just my face.


kxmode
Supporting Member
Supporting Member

User avatar

Joined: 14 Oct 2007
Gender: Male
Posts: 2,613
Location: In your neighborhood, knocking on your door. :)

19 Aug 2011, 10:50 pm

Character attributes are:
Might,
Constitution,
Nimbleness,
Speed,
Concentration,
Willpower,
Charisma

Vitals are:
Health,
Energy,
Mana

Skills are:
Melee Offense,
Melee Defense,
Ranged Offense,
Ranged Defense,
Magic Offense,
Magic Defense

As you saw in the scripts above under the methods SetupVitalModifiers() and SetupSkillModifiers() the formula for modifiers are as follows:

A half point of Constitution is added to Health
A full point of Constitution is added to Energy
A full point of Willpower is added to Mana

A third of a point of Might and Nimbleness is added to Melee Offense
A third of a point of Speed and Constitution is added to Melee Defense
A third of a point of Concentration and Willpower is added to Magic Offense
A third of a point of Concentration and Willpower is added to Magic Defense
A third of a point of Concentration and Speed is added to Ranged Offense
A third of a point of Speed and Nimbleness is added to Ranged Defense

Nothing effects Charisma. Players manually assign points directly to this attribute.

To be honest I am not entirely doing this by myself. I am using a series of step-by-step Youtube videos from BurgZergArcade. He's posted his 244th video two days ago. For anyone interested in a thorough and exhaustive how-to series on Unity development I very much recommend his. I also recommend TornadoTwins (YouTube) and GRID Lab's 7 part video on terrain creation.

Also I am at some point going to delete Mana and Magic from the stats for religious reasons. I'll keep them for now so that I'm in sync with BurgZerg, but at the first chance I get they're gone.