Author |
Topic  |
|
Gary Dallison
Great Reader
    
United Kingdom
6379 Posts |
Posted - 08 Jan 2014 : 19:44:59
|
I have long tinkered with the idea of learning programming just because I want to and I wanted to combine my two loves; programming and forgotten realms, so a simple ascii computer game seemed the way to go.
I got quite far with a basic game, there was a map and movement and a monster with hit points and an attack method.
However I am struggling on the best way to resolve several things specific to DnD rules (3.5 ish edition) and I was wondering if anyone had any advice on the best way to accomplish things.
Just for the record I am a novice at this programming thing and I am using c++ because its the language I have most books on.
So the problems I have are as follows with some thoughts of mine on a solution but I would love to know if anyone has tried anything like this before and if so how.
1 - Classes: So in 3rd edition you can have as many classes as you want of as many levels as you want. I was thinking of a 2 dimensional vector array holding the class and its level.
2 - Levelling Up: This is a tricky one. I figure I could have a c++ class for classes and every class have a level method which would add a number of special abilities (such as sneak attack) to the character depending on what class level they have reached. I should note that I have eliminated accumulating xp (its now sacrifice xp like basic dnd) and there are no level based bonuses to attack and saving throws so classes are all about the special abilities they grant.
3 - Feats: This one again I'm thinking of c++ class for feats. Each feat has a Use method or something like that which is called whenever the feat is used and it does its business. Of course on the character these feats would be held in a vector array that would hold the pointer to the use method.
4 - Combat Flow: This is the hard bit. There are so many variables and bits that can interrupt the flow of combat that I am having trouble deciding how to implement it. I was thinking of categorising the various combat actions. So for instance a melee attack would be categorised as "attack", "melee", then get various categories from the weapon used such as "slashing", "critical" etc. Casting a spell at someone would be "attack", "spell", "Fortitude" or "Reflex" or "Willpower" or "AC". Then I could either hard code in what to do with certain feats and special abilities, so if a character has improved sunder then do x. Or if I coded it right to iterate through all the use methods on the abilities and feats that matched the various categories and apply their bonuses etc.
5 - Bonuses: In 3rd edition there are bonuses up the Khyber for various random bits, feat bonuses of different types, spell bonuses of different types, class and race bonuses to every primary and secondary statistic on a character. Deciding what to do with them and how to build them is a nightmare. I have first eliminated the various types. You can have one feat bonus, one class bonus, one race bonus, one magic item bonus, and one spell bonus to any one ability score (highest applies). However building and keeping track of these bonuses is proving to be a nightmare since feats can be removed, classes and levels removed, templates added and removed, even race changed. So do I have an add/remove method on every single feat, spell, class etc. Or should I build a check method into the program to check the bonuses on a score are correct every time they do anything.
Oh and if anyone is interested in collaborating on creating a game or learning programming with me then by all means let me know. As I said I'm a novice at this and would love the help. Although I know the 3rd edition rules inside out and have largely reworked them to make them balanced and fairer and sensible, I just need to translate that into computer code. If anyone has figured out how to use classes and inheritance and constructor and destructor and pointers then I take my hat off to you because it boggles my brain.
|
Forgotten Realms Alternate Dimensions Candlekeep Archive Forgotten Realms Alternate Dimensions: Issue 1 Forgotten Realms Alternate Dimensions: Issue 2 Forgotten Realms Alternate Dimensions: Issue 3 Forgotten Realms Alternate Dimensions: Issue 4 Forgotten Realms Alternate Dimensions: Issue 5 Forgotten Realms Alternate Dimensions: Issue 6 Forgotten Realms Alternate Dimensions: Issue 7 Forgotten Realms Alternate Dimensions: Issue 8 Forgotten Realms Alternate Dimensions: Issue 9
Alternate Realms Site |
|
Ayrik
Great Reader
    
Canada
7989 Posts |
Posted - 08 Jan 2014 : 22:46:28
|
Your class/level array method seems workable enough, especially since you already understand how you intend to implement it. It has some drawbacks: you‘ll need to make each class/level permutation a separate entry (Fighter 1, Fighter 2, Fighter 3, etc), it won‘t easily allow multiclass combinations (unless these are also explicitly defined), and it may be very cumbersome to enter or modify all your class/level/feat/etc data.
I would suggest using a record data structure, naming each class as part of an array within it, and perhaps using binary set variables to indicate the presence/absence of each feat/etc.
You could use a database engine (Access, dBase, etc) to do this a bit more easily, but exporting such data into actual programs would be more challenging.
This isn‘t really the best forum to ask about tech stuff ... I‘d recommend googling “open source programming“ or “team programming forum“ to find a more suitable venue.
You might be surprised at how many public domain D&D applications are out there, sourcecode and all. Most tend to be written in BASIC or Java, but many are done in various flavours of C. I can almost guarantee you‘ll find a few things very similar to what you‘re trying to design. |
[/Ayrik] |
 |
|
The Sage
Procrastinator Most High
    
Australia
31799 Posts |
Posted - 09 Jan 2014 : 02:35:42
|
Ayrik pretty much covered what I would have already said, myself.
Two bits I would add, however, is that you might also try Python. I've seem some pretty cool D&D applications written in that particular language. Or even LISP. I know it can be a difficult language to program for, but the actual proglang conceptualisation of lists really does benefit working with a lot of D&D statistical-related information.
Second bit, I'm more than happy to help out where and when I can with this. While I am a proficient programmer by trade, I don't have a lot of experience working with D&D programs written in code. So this would be a learning experience for both of us, I think. |
Candlekeep Forums Moderator
Candlekeep - The Library of Forgotten Realms Lore http://www.candlekeep.com -- Candlekeep Forum Code of Conduct
Scribe for the Candlekeep Compendium -- Volume IX now available (Oct 2007)
"So Saith Ed" -- the collected Candlekeep replies of Ed Greenwood
Zhoth'ilam Folio -- The Electronic Misadventures of a Rambling Sage |
 |
|
Gary Dallison
Great Reader
    
United Kingdom
6379 Posts |
|
Gary Dallison
Great Reader
    
United Kingdom
6379 Posts |
|
The Sage
Procrastinator Most High
    
Australia
31799 Posts |
|
Gary Dallison
Great Reader
    
United Kingdom
6379 Posts |
|
The Sage
Procrastinator Most High
    
Australia
31799 Posts |
|
Caolin
Senior Scribe
  
769 Posts |
Posted - 11 Jan 2014 : 08:27:53
|
So you've got a very VERY large project on your hands. It's impossible to simply encapsulate all of the DnD rules into a handful of lines of code. I'm not saying you are trying to, but most people don't understand the rabbit hole you fall into when going down this road. Trust me, I thought of this while I was in college and I got quickly overwhelmed.
With that being said, it's a great way to learn programming and a great way to get yourself into game development. My first advice would be to abandon C++. Its not a language for beginners and it's overkill for doing an ascii game. I'd advise taking up Python. It costs you nothing, it's very easy to learn and understand, and you can run your game in a web browser. You still get all of the advantages of object oriented programming. If you want a good intorduction to python I'd check out one of these two sites:
http://www.codecademy.com/ http://www.learnstreet.com/
They both do a very good job of introducing you to programming. The second thing I would do is find some literature on object oriented programming. It will be essential to understand if you seriously want to replicate the DnD rules.
http://www.amazon.com/Object-Oriented-Thought-Process-Edition-Developers/dp/0321861272/ref=sr_1_1?ie=UTF8&qid=1389428546&sr=8-1&keywords=object+oriented+programming
I'm going to keep my advice to that. Just explaining this is it's own rabbit hole. The last thing I'll say is use this project as motivation in your quest to learn how to code. Take it slow and don't get frustrated. |
 |
|
Gary Dallison
Great Reader
    
United Kingdom
6379 Posts |
|
Caolin
Senior Scribe
  
769 Posts |
Posted - 12 Jan 2014 : 21:06:09
|
It's definitely possible, there are games that prove it. But I would suggest making a very basic game with very basic rules first. Maybe create a game where a fighter with a sword fights an orc with an axe. Break down the logic in order to create your objects and their methods. Most of the objects will have their own objects. Like Character would be the master class with things like Class, Race, Weapons, Attributes, being inherited classes. Then you create objects that have characters fighting each other. A basic back and forth attack defend structure would be good. Once you get a basic frame work you can easily start to build upon it.
The key is not to bite off more than you can chew. You'll quickly get swamped. |
 |
|
Gary Dallison
Great Reader
    
United Kingdom
6379 Posts |
|
Ayrik
Great Reader
    
Canada
7989 Posts |
Posted - 13 Jan 2014 : 22:40:58
|
Yes, start with the basics, just make it work, no matter how simplistic and ugly. Then add complexity, make sure each piece works. When all the rules seem to work you can shift your focus onto making it pretty.
Same as any other middly-size project. D&D doesn‘t really have an insurmountable number of formal rules. Don‘t try to tackle it all at once unless you‘re confident you have the code savvy, just reduce it to a number of intercompatible simple mini-projects. |
[/Ayrik] |
 |
|
|
Topic  |
|