eezstreet Posted February 3, 2014 Posted February 3, 2014 (edited) So..I've been a bit quiet lately with the code updates. That's because I've shifted my attention over to weapons, and in general I've found weapons to be very frustrating in terms of what can be changed. I've decided to redo the system entirely and build a new weapons system in its place. First, I've changed the weapons.dat to be a .json formatted file. You can change which .json file you want to load for your weapons in your custom game by changing a cvar: g_weaponFile (by default, it's "default.json", how clever). These .json files have a variety of new properties, some of which have been ported from OpenJK (damage was not previously modifiable until OpenJK came along...) I'd like to touch on another subject...I know people will want to probably change weapon behavior for custom games. Perhaps they want to make a Real World custom game, or maybe replace the Flechette with a T21. So I've decided that the best approach here would be to integrate AngelScript into the project. AngelScript looks and feels very similar to C. In essence, your scripts will be almost directly tied to the game's code. If you haven't gotten a chance to pick up coding, this might be your chance to give it a shot, custom game creators. Some functions will be called directly from the code. Here's a test function that I wrote: void DEMP2Test(int numIterations) { // This is the entry point for the code for(int i = 0; i < numIterations; i++) { // Print X messages on the screen, where X is what the code (C++) specifies int random = Q_irand(0,2); // Generate a random number between 0 and 2, inclusive if(random == 0) { Com_Print("I CAN HOLD IT\n"); // Print this in the console } else if(random == 1) { Com_Print("IM RIGHT WITH YOU RED THREE\n"); } else if(random == 2) { Com_Print("RED SIX STANDING BY\n"); } } } For this example, the DEMP2's firing routine will call DEMP2Test (it won't in the final version, but you get the general idea) and print some messages to the console.I'll be providing some sort of documentation on this when it comes closer to release time. Also, here's default.json, so you can get the general idea for the formatting of this file:http://pastebin.com/zQZ8QjLV The JSON file will reference specific functions in AngelScript which will be called. tl;dr - custom games can also modify weapon behavior in a variety of awesome and interesting ways, through the use of scripts created by the CG's author. EDIT: Just to clarify, this isn't a replacement for ICARUS. Rather, it is a complementary scripting language used for specific things in the game's logic (such as weapons, possibly HUD stuff at some point, etc) Edited February 3, 2014 by eezstreet Stoiss, redsaurus, therfiles and 1 other like this
Stoiss Posted February 3, 2014 Posted February 3, 2014 Really nice job eez i sort of knew in a way you would do this as it was one of the best things there was for JKG it self
eezstreet Posted February 5, 2014 Author Posted February 5, 2014 Really nice job eez i sort of knew in a way you would do this as it was one of the best things there was for JKG it self Well, the idea behind this is a little bit different from that of JKG. JKG wanted to implement Lua as a form of level scripting and perhaps NPC AI, whereas I want to use it as a tool to extend weapon behavior. If there's a decent enough response to this, then I might implement more things being binded to Angelscript. My ultimate goal is to eliminate the need for people to create code mods for stuff, and instead provide a platform of sorts for people to create new campaigns and the like with amazing stuff going on, just by combining cvars and editing the scripts. I think people like @@therfiles are creative enough that they can create all kinds of softcoded workarounds for stuff that would usually be hardcoded. My point is that I'd like to see some more of these hardcodes worked around, and maybe people will choose JK2:HD as a platform for their campaigns. Though in all actuality, I do have to make a mod after all, and for that I'm going to be trying to crowdsource as much as I can. Some people such as @@Circa, @@Silverfang, @@Resuru, @@MoonDog and @@DT85 have come forward and put in some content for me to work on, and I'm gracious for their assistance. Maybe more people might be interested in helping me work on this based on what I can bring to the table for them to work with. Archangel35757, Stoiss, Circa and 3 others like this
therfiles Posted February 5, 2014 Posted February 5, 2014 This system really does look awesome. While it's true I'm able to soft-code a lot of features with ICARUS and such, I can't even touch game mechanics like weapons, force powers, etc. Any system that would simplify that process would be incredibly helpful. I think ICARUS is incredibly powerful, but It just doesn't have enough to make these big game play changes like you are saying (at least efficiently). Heck, even being able to edit any cvars you wanted in ICARUS would be a huge milestone. So having these two complementary scripting languages that work off each other would be really nice! If there is anything I can do to help, let me know.
eezstreet Posted February 5, 2014 Author Posted February 5, 2014 This system really does look awesome. While it's true I'm able to soft-code a lot of features with ICARUS and such, I can't even touch game mechanics like weapons, force powers, etc. Any system that would simplify that process would be incredibly helpful. I think ICARUS is incredibly powerful, but It just doesn't have enough to make these big game play changes like you are saying (at least efficiently). Heck, even being able to edit any cvars you wanted in ICARUS would be a huge milestone. So having these two complementary scripting languages that work off each other would be really nice! If there is anything I can do to help, let me know. Perhaps you could look over my Angelscript guide and make sure there's nothing there that's too confusing. I want to make it accessible to people with basically no scripting experience, but also make it a vigorous crash course. Also, good idea about force powers. I was thinking about putting HUD up there too, but I'd like to get weapons using base behavior first as that's going to be quite a task to recode.
therfiles Posted February 5, 2014 Posted February 5, 2014 Just read through it. I've had some...rudimentary computer science training, so I do already have that grasp on the basics, but I definitely learned a lot from it! I'm really excited by the concept of being able to do math, as well. But yeah, I really like the way you explained everything. Obviously it's just a start, but It gives the reader a pretty firm idea about whats going on. One thing that would be helpful, when you get to that point, is just write a simple test script that actually does something (like change the bowcaster's properties) just to see how it all works in relation to each other. But yeah, for a basic guide to coding conventions, I definitely got it and I think other people will too. Nice work! I'd love to be able to control the HUD (jail break), but even being able to define the health and ammo and armor and force as variables to be used would be amazing. So, I could code in a new element that would require the player to have at least 50 force, etc. That's obviously going to be a long way down the road.
eezstreet Posted February 5, 2014 Author Posted February 5, 2014 Just read through it. I've had some...rudimentary computer science training, so I do already have that grasp on the basics, but I definitely learned a lot from it! I'm really excited by the concept of being able to do math, as well. But yeah, I really like the way you explained everything. Obviously it's just a start, but It gives the reader a pretty firm idea about whats going on. One thing that would be helpful, when you get to that point, is just write a simple test script that actually does something (like change the bowcaster's properties) just to see how it all works in relation to each other. But yeah, for a basic guide to coding conventions, I definitely got it and I think other people will too. Nice work! I'd love to be able to control the HUD (jail break), but even being able to define the health and ammo and armor and force as variables to be used would be amazing. So, I could code in a new element that would require the player to have at least 50 force, etc. That's obviously going to be a long way down the road.Yeah, but even I haven't gotten there yet. Still getting some errors along the way. I plan on starting with the DEMP2 as there's some specific properties that I would like to alter with it for certain custom games that I'm working on (giving it a short-range chain effect, making it collide with water and bounce slightly on metal, etc) As for the HUD stuff, yeah, all that stuff is stored in gentity_t->gclient_t->playerState_t.stats[sTAT_HEALTH], STAT_ARMOR, and also gentity_t->gclient_t->fd.forcePower in C. I plan on exposing the entirety of this stuff in Angelscript (so to access the stuff there, i'm thinking something like player.ps.STAT_HEALTH or player.ps.STAT_ARMOR) therfiles likes this
Archangel35757 Posted February 7, 2014 Posted February 7, 2014 @@eezstreet -- so could your angelscript be used to append new character animations without having to recompile the entire original GLA? Example given: create a new standalone GLA called: "cockpit.GLA" and this new GLA obviously contains all related cockpit interaction anims... then when required, the game would look for this anim in the add-on GLA when needed? I think something like this (while preserving original GLA file) would greatly decrease complexity for the Artist to add new anims.
eezstreet Posted February 7, 2014 Author Posted February 7, 2014 No.This is purely for weapon, force power, and probably HUD stuff. No under-the-hood stuff is involved. The game can't possibly support that anyway, since a GLM is only bound to one GLA.And anyway, I don't understand how this would make anything simpler; GLAmerge does almost the exact same thing.
Archangel35757 Posted February 7, 2014 Posted February 7, 2014 Adding new animatons ( not simply replacing animations-- as done in the past ) requires you to recompile the GLA or yes, use GLAmerge... but you still then have to do a coding mod to get your new animations to play in-game, no?
eezstreet Posted February 7, 2014 Author Posted February 7, 2014 ...And that would be entirely irrelevant from this system.Not to mention impossible, like I mentioned above, even with a code mod.
Recommended Posts