It depends on which Wizardry game you are talking about.
Wizardrty 1-3 and 5: You get either one SP per spell known, or, if you are currently in a spellcasting class, one SP per level the spell level has been available, whichever is greater. However, you are limited to 9 SP per spell level.
Wizardry 4: 9 SP per spell level. (Note that some of those levels are so difficult that 9 casts of DUMAPIC might not be enough in this game.)
Wizardry 6-7: To get SP by leveling up, you must be in a spellcasting class, and you must have some SP in the realm in question. I am not sure what stat affects SP gains. If your new level is less than the highest level that character has attained, I think you might only get 1 SP per school. Learning a spell via a spell book will not give you SP, and will not allow you to gain SP when you level up, so a character's first spell from a realm should not come from a spell book.
Wizardry 8: Immerhinque's post describes what's going on, but here are a few more points:
* Everything is retroactive; SP are a pure function of the variables involved. (This is unlike Wizardry 6 and 7.)
* It is character level, not class level or caster level, that affects SP. (That means that a former samurai who levels up as a fighter will continue to gain SP at each level up.)
* If a character has multiple spellbook skills (Bishop, for example), the highest one is the most important, and the other skills have a smaller impact. (Bishops would be even more powerful than they already are.) This factor caps at the amount that a single spellbook skill at 125 would cap.
* It is possible for current SP to drop below 0 (for example, if an attribute or skill decreases). In most cases, the game will display current SP as 0. The exception is if you cast Remove Curse from the inventory, the spell backfires, and the backfire reduces SP below 0; in this case, the game crashes with an assertion.
Edit: One thing of note: How much you cast spells before leveling up doesn't matter except if, in Wizardry 8, you want to qualify for higher level spells. Raising the skill after level up gives you the same SP than if you raised it before leveling up.
Also, Japanese Wizardry games tend to behave like Wizardry 1-3 and 5 in terms of SP.
Post edited September 01, 2018 by dtgreene