I don't know how interesting this is to the average reader, but I do feel like I should try to squeeze some Hamumu game development talk in between my scary scary podcasts. So let me tell you some technical biz going on with the new project!
The game was unplayable for a week or so and is now almost back to where it was before that. So what happened? Well, after implementing the first 15 or so skills, the code was already looking pretty hacky, with special cases all over - "If you get hit by a bullet, check to see if you are currently using Shell ability to block it, then if so, do you have points in the skill that lets Shell reflect bullets? Okay, reflect it". I could see a future of spaghetti stretching out before me. So there's only one solution to that (besides making a simpler game without tons of skills, and that's not me!): scripting!
By implementing scripts, all of that becomes cleaned up and the complexity lies in the scripts themselves (but that's not super complex either). It also opens the door to mods big-time. Anybody can edit these text files to create their own skills, abilities, and heroes. I'm not scripting everything because I don't want to make a super-detailed language that can do everything. For now at least, you're limited to the bullets and enemies that are built into the game (and there's no way - yet - to script your own game modes). But making skills is pretty fun!
For the curious, here's what the script for the Shell ability looks like:
Abilitydef:
"Shell"
"Become invulnerable for @1s."
16 ; icon
2400 ; cooldown
180 ; duration
180,0 ; value1, value2
1 ; charges
"Raising Shell","Reflective Plates","Regrowth","Regeneration","Juggernaut"
On_Hurt: If(AbilityDuration > 0) Cancel Endif End ; cancel makes hurt not occur
On_Render:
Set(T1,GameTime)
Mod(T1,2)
if(T1 = 0)
Draw(OverGuys,GuysPNG,48,16,32,32,0,1)
Endif
End
|
So that's pretty simple. If you know a bit about coding, you can interpret that fairly easily (the On_Render function is simply drawing a flickering shell over you, by drawing it every other frame). The five names in quotes are the skills attached to the ability. It's a bit of a cross between assembly language and C, whatever was easiest for me to implement! The Abilitydef section though is simply a bunch of data. It would've been pretty annoying if you had to actually script that part, like "Set_Name("Shell"); Set_Icon(16);", etc, etc.
And just for good measure, check out the reflect ability I mentioned!
Skilldef:
"Reflective Plates"
"While ~C1Shell~C0 is active, ricochet bullets for @1% of their damage."
10,3,
100,150,200
0,0,0
0,0,0
0,0,0
On_Hurt: If(AbilityDuration>0)
ReflectBullet(V1) ; multiplies the bullet's damage by this percentage
Cancel
Endif
End
|
As you can see, the more complex things are just simple functions you call (you don't even have to specify which bullet, it can only operate on the bullet that caused the hurt script to be called). So what you can do in scripts will be a bit limited, but since I'm going to use these scripts to make hundreds of skills myself, I'll eventually implement most things you could ever want to do! It's a fine line to walk between making it good for modding purposes and making it quickly so I can actually finish a game. The best for modding would be to script everything, right down to the bullets, but that's the opposite of best for getting the game done. Now I gotta get back in there and get the unimplemented skills back in action so I can finally move on to some new stuff!