View Single Post
Old September 13, 2015, 22:19   #2
debo's Avatar
Join Date: Oct 2011
Location: Toronto, Canada
Posts: 2,389
debo is on a distinguished road
Originally Posted by TricksterWolf View Post
This is a thread where I will dump questions I have while I am reworking the entire magic system.

I have a situation where I want characters to have racial and class-based magic, with potential overlap between the two, and access to more than one realm of magic. The caster armor weight limit and mana stat will be determined by class.

I'm pulling all the magic information into the "books" themselves and front-loading all of it with a spell parser and a "book" parser instead of saving it with the player's class data. Each "book" will have a realm, and outside of a "book" the language will be generalized to "item", "magical feat", etc. The player will have the caster armor limit, mana stat, lowest-level "spell", total "spells" possible, and list of "spells" they can "cast" in a single struct.

I don't think it will be hard to calculate and cache the lowest-level "spell" a character can perform or the total number of "spells" a character can have: I should be able to min and sum those at birth.

It currently looks like there's a hard limit of 98 spells total in the game. Is that because it's using a signed byte? Is 'byte' a signed or unsigned byte? I'd like to pump that sucker up above 255 if possible, so would changing spell_order to a u16b* be sufficient, as I suspect...? Breaking savefiles is (obviously) not a problem.
Haven't looked at source but usually people #define 'byte' to be 'unsigned char', which tells the compiler to make things basically behave like a bitpattern iirc. You should be able to find it in whatever .h file is the "here's all my shared crap".

This means that you should have up to 255, unless 'byte' is for some reason 'signed char'. If it's just 'char' I think you're also sort of fine but that type is really only intended to store data that is read via some encoding (e.g. ascii), iirc.

There doesn't seem much reason in 2015 to not have this be some sort of integer type, so your plan sounds reasonable

Edit: Even if it's a "signed byte" (a ridiculous concept), you still have up to 127.
Glaurung, Father of the Dragons says, 'You cannot avoid the ballyhack.'
debo is offline   Reply With Quote