• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
pein87

game implementation advice

2 posts in this topic

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:

 

attributes table

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)
);

class table

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)
);

skill table

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:

 

  • Attack
  • Speed
  • Mana
  • Perception
  • Agility
  • Intelligence
  • Stamina
  • Defense

Weapon:

  • damage

Spell

  • element
  • power
  • speed
  • cost

These would be stored in the database.

Edited by pein87
0

Share this post


Link to post
Share on other sites

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?

 

Use relationships and pivot tables. It's easier if you see tables as classes, and columns as attributes in object oriented programming. You can make a table which defines a class of objects and its basic attributes, and these attributes can be a reference to another class of objects (another table). For example, you can define a weapon table, and it has:

weapon:

id, name, weapon_type, weight, attack_range, damage, price, other_attributes

And an element table:

element:

id, name, other, attributes, goes, here

To assign an element to a weapon, you can make a pivot table which stores the relation between a weapon and its elements. We use a pivot table because a weapon can have more than one elements (ex: fire, wind). Just name this table weapon_elements.

weapon_elements:

id, weapon_id, element_id

Here, weapon_id is an integer which refers to a weapon's id (weapon.id), and element_id refers to an id of an element from the element table. You can insert some rows which define the relations of a weapon to several elements, like:

id | weapon_id | element_id
1  | 1         | 1
2  | 1         | 3
3  | 2         | 4
 
Say weapon 1 is a sword with fire and wind element, and weapon 2 is an axe with earth element. You can get a list of weapon 1 elements by making a query to this table with only the weapon's id, or you can try to find out if weapon 2 has a fire element or not. It can be applied on the case where you want to see if a skill is unlocked already on a character, or in other word, if a character already has that particular skill. If it returns no result, then the character simply hasn't got that skill yet. It's much better than making the weapon table like:
 
id, name, type, weight, attack_range, damage, price, element_one, element_two, element_three, element...

If it's just a one-to-one relationship, where an attribute refers to only an object of another class, you don't need a pivot table. For example, a weapon only has one type. A weapon can't be a sword and a bow at the same time, can it? That's why type in in the weapon table refers to a weapon_type table which defines the types of weapons available in the game.

weapon_type:

id, name, other, attributes, that, defines, a_type, of_weapons

Be creative with the rest.

 

P.S. I hate formatting.

1

Share this post


Link to post
Share on other sites

Thanks. What I did was create a base class for modifiers and sub-classes for each modifier type. the stats now belong to a specific type so the modifiers can modify the stats in their own class. I added conditions to the spells and tie ins so the character mana stat is used to pay the mana cost of spells. I added a universal modifier for items so it can mod any stat from any stat type. I will use the pivot table idea though. Thank you for the advice.

Edited by pein87
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0