jump to navigation

Weapon Scripting and Forums January 3, 2011

Posted by luciusdxl in Uncategorized.

I’m sorry to say that I missed the date of my goal – the Beta release has been delayed until later this week. So my last post was not the “Final Update Before Beta” after all.

Weapon Scripting

In the meantime I’ll talk about a feature that I decided to add earlier due to some issues I was having with the Beta.

When I was tweaking the weapons I began to realize that the way the weapons were being coded was a bit hard to work with, it was purely code driven rather then being data driven. I obviously needed to fix that, not only to get the Beta done – but also to make my life easier in the long run.

So I’ve spent part of the weekend implementing the weapon scripting system. So now, in addition to having the logic scripts (CoreLogics.as) you have weapon scripts (CoreWeapons.as). In the future, mods can provide their own script files that override the core scripts. This means that DarkXL mods will be able to have custom enemies, items and weapons. Very Happy

To create a weapon requires multiple steps:
1) Register a weapon at a specific index (which maps to the inventory items and keys).
Weapon_Register(1, “Bryar Pistol”);

2) Setup basic firing and projectile parameters. If this is a simple projectile, like the Bryar Pistol, Repeater or Fusion Cutter then you’re done with this part.
Weapon_IntParameter(WPARAM_START_FRAME, 0);
Weapon_IntParameter(WPARAM_MAX_FRAME, 3);
Weapon_IntParameter(WPARAM_FRAME_DELAY, 4);
….(more parameters)….
Weapon_StrParameter(WPARAM_SHOOT_SOUND, “PISTOL-1.VOC”);

You get the idea. You only set the parameters you need, everything else has a default of 0 or NULL. If this is a basic projectile weapon than the engine does all the heavy-lifting for you, using the parameters you’ve filled in to determine how much damage to do, which graphics to use, what sound effects to use, how fast the projectile travels, what type of ammo it uses and how much and so on.

3) Setup animation callbacks, that occur on animation frames or right as the animation finishes. This is needed for more complex or different behaviors that aren’t handled by simple projectiles. This includes fists (punching), thermal detonators, mines and so on. Most weapons don’t need these callbacks. Combining this with custom scripted projectile logics you can make totally new weapons – such as heat seeking missles, projectiles that circle around the player, trip wires and more.
This is the name of the function that exists somewhere in the script file. It can be any name you want.

4) Load render data – basically your weapon idle and animation frames.

5) Setup the Render Callback, which determines the final frame index and screen position of the weapon, given the current animation frame and firing state.

And to make things more convenient, you can reload the weapons scripts at any time from the in-game console. So you can make small tweaks and see them quickly in the game. The weapons now use this system, which is allowing me to remove the individual weapon-specific code out of the code-base.

For Outlaws and Blood being able to setup and adjust weapons while in-game will make the process much easier then it was for Dark Forces.


In addition, in preparation for the Blood and Outlaws work, I’ve started setting up new DarkXL forums. While DF-21 will remain the forum host for Dark Forces related discussion, a Dark Forces site isn’t the best place to be talking about Blood and Outlaws. The new forums will have a general DarkXL discussion area as well as areas to discuss game specific topics and DarkXL related issues. The Dark Forces category points back to the DF-21 forums, where I’ll continue to post news items and Dark Forces related items.

Source Code

I just want to reiterate here that the source code for DarkXL will be released with the Beta. Over the coming week I will be putting up the code on the DarkXL CodePlex site. You’ll note that I’ve already put up a couple of files and some directory structure, though I need to put the appropriate license information in those files – it is currently missing. I will be uploading code as I go through the files, put in the appropriate license information and organize the directory structure better. I plan on having the code fully uploaded this week, though some additional clean-up and optimization will still be required to get up to the quality that I want.

Thanks for being patient with the Beta release, it is in the final stretch. Hopefully this is really the last update before the Beta. 🙂



1. Ravo - January 3, 2011

This keeps getting better and better 🙂

2. Darrell - January 3, 2011

No Problem!

3. Adamant Consternation - January 4, 2011

Would it be okay if I called you Saint Lucius?

4. hannah - January 4, 2011

dude you suck! how could you do that to us!..ha ha ha just kidding!:)..take whatever time you need and as always, you are doing a great job, hope you had an amazing holiday.

5. TNoyce - January 4, 2011

I know the wait will be worth it Lucius.. Just happy that you are able to continue to make progress.

6. waiting4DF - January 15, 2011

Bummer, I thought I’d be playing the new version by now! Well you must have hit a snag or gotten busy. Good luck!

7. Zuzma - January 16, 2011

Here’s why it was delayed:


It’d be nice if he fixed the link to the forums, but no rush.

8. Zuzma - January 16, 2011

Ah oops I’m an idiot lol. Sorry, I should have read the whole post.

9. Zuzma - January 16, 2011

Yeah I’ve waited this long, no rush. I’m sure it’ll be good once it’s released. 😀

10. Phill - January 18, 2011

It would be so cool to celebrate the beta release with some multiplay party but i can be happy playing through the SP campaign since buying the original big box years ago.

Keep going lucius!!!!

11. PNTR - January 18, 2011

Keep up the good work and take your time!

12. WarFalci - January 25, 2011

Just so you know, the complete lack of a new update IS indeed killing me.

Please, real life, let Lucius come back to us with Beta 1 real soon, real fast!


13. Ravo - January 28, 2011

Actually, I’m really happy you haven’t finished the update cause I’ve had a lot of real-life stuff come up and the release of the newest build would have no doubt sabotaged my productivity, haha.

In any case, after everything Lucius has accomplished, I have no doubt he’ll deliver – even if his initial estimates were a little overzealous. Obviously he’s excited to finish this thing and in the end he will. We just need to be patient. Real life 1st.

14. Rex - February 12, 2011

I’ve had this page open as my first firefox tab since november, and still check it everyday, hoping… Good luck out there, Lucius!

15. Staffan - February 12, 2011

I am still exited over this project. 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: