Hey everyone I'm trying to develop a rpg game in php. I know horrible idea, but that aside I would like to ask for advice on a problem I'm facing. I want to implement a class system. Each class would have skills that would modify an attribute based on a percent. I want to be able to modify weapons(damage), character attributes, magic(mana cost, increase or decrease; damage, increase or decrease). My problem is tying the skills to each thing I want to have it modify. I'm using a database to create attributes so they can be added and deleted without editing files. The tables are like so:
create table attributes ( id int not null auto_incremet, title varchar(30) not null unique, # attribute name points int not null, # default point increase int not null, # amount to increase per level primary key(id) );
create table classes ( id int not null auto_increment, title varchar(30) not null unique, # class name description text not null, # class description icon varchar(128) not null, # url or path to icon logo varchar(128) not null, # url or path to logo active int not null, # usable 1 for yes, 0 for no primary key(id) );
create table skills ( id int not null auto_increment, title varchar(30) not null, # skill name description text not null, # what skill does amount int not null, # amount in percent to modify cost int not null, # number of skill points needed to unlock class int not null, # class skill belongs to modifies int not null, # attribute to modify modType int not null, # type of modification it does 1 for increase, 0 for decrease icon varchar(128) not null, # url or path to icon logo varchar(128) not null, # url or path to logo active int not null, # is skill usable, 1 for yes 0 for no primary key(id), foreign key(class) references classes(id), foreign key(modifies) references attributes(id) );
My original plan was to add attributes to weapons and magic so I can attach a skill to it and add a field that says where the attributes goes. The attributes for weapon would be damage, the attributes for magic would be cost(in mana, this is a problem for me tying this to mana) damage, speed, element( reduce or increase damage based on the element attribute). My goal is to create an interface in html, css, and jquery that allows the admin to build a weapon and magic.
My question: whats the best way to tie the concepts together so the skills can modify an attribute of a weapon and spell. Also how do I represent that a a user has unlocked a skill. Do I create a table that has the user id, skill id, and a field that shows it's been unlocked?
the attributes for the character would be something like this:
These would be stored in the database.
Edited by pein87, 16 April 2014 - 03:29 AM.