ROBLOX Base Wars Weapons

ROBLOX Base Wars’ Low-lag Weapon Design

ROBLOX Base Wars Weapons

Last week, ROBLOX introduced version 1.0 of Base Wars FPS. As promised in the post, Luke Weber is spilling the beans on how he achieved its fast-paced, first-person-shooter feel using raycasting techniques and a couple crafty scripts.

Low-lag weapons

First-person shooters (FPS) rely on solid, responsive shooting. Before Luke even started constructing the weapons, he decided to take advantage of raycasting, which is the use of a function or algorithm to mathematically determine where a ray – or a weapon’s bullet, in Base Wars’ case – hits an object. Raycasting was the obvious choice for several reasons: it’s a quick, efficient and consistent alternative to the old method of firing a projectile, and it allows for instantaneous shooting (a trademark of most FPSs on the market). Better yet, raycasting gave him a foundation of code he could use for other weapons, only having to tweak certain variables to change the effect.

Since ROBLOX Base Wars was originally a paintball game, Luke considered segmenting the raycast to create the effect of a shot actually flying through the air. This ended up detracting from the game’s FPS feel, so he nixed the idea.

Implementation

Luke has scripted a lot of weapons for ROBLOX. He has access to his and the community’s pool of resources, meaning the equipped, unequipped, reloading and ammo-holding styles already existed. There wasn’t any obvious code for him to innovate or improve.

Base Wars Target Practice

Instead, he spent time experimenting with Base Wars’ weapons to find out whether they performed best when running on the user’s computer or the ROBLOX server. With everything running on the user’s computer (i.e., client-side), the weapons were smooth and exact. However, there were bugs that arose from the delay of information between players and the server. Players could shoot other players around corners, and we even noticed players shooting after they were killed.

Those are major problems, and two reasons why Luke decided to try running the weapons on the ROBLOX server (i.e., server-side) for the next test. That caused problems, too, including the one thing that’ll doom (get it?) any FPS: lag.

Luke’s solution was to split the duties between the user’s computer and the ROBLOX server for Base Wars 1.0.

“I finally decided on running the user interface on the user’s computer, and the raycasting on the game server,” Luke said. “I have a client-side script run everything but the raycast. The client-side script actually tells the server-side script to cast rays when needed.”

Base Wars Weapon Code SnippetTranslation?

The guns feel silky smooth. There’s a bit of trigger lag, since the server is processing the weapons, but it’s hardly perceivable. This solution makes the matches fair because there aren’t any weapon bugs to exploit, and the gameplay remains quick and responsive.

Since ROBLOX Base Wars is not copy-locked, advanced users can browse and potentially re-use Luke’s code. He does admit that it’s complicated, so you might only want to download and enter if you’re sure your coding skills are up to snuff.

About Andrew "blockhaak" Haak

Communications Manager at ROBLOX. blockhaak on ROBLOX; @andrewjhaak on Twitter.

98 thoughts on “ROBLOX Base Wars’ Low-lag Weapon Design

  1. yumyum2

    After reading this,I am DEFININENTLEY
    gonna play this sometime (But Vinya’s guns are still better.)

  2. ThePizzanator

    So this is how a gun scipt works? Just add a tracer script and whala your own scripted, working gun :D

    1. sneed26

      ya its actualy pretty cool and that the fact that theyre making new weapons i think we should come up with weapons and include different stuff like that

  3. Nick642

    This game is Great! I really love the FPS feel to the game, and it’s the faster shooting games I’ve played on ROBLOX. You guys did a great job on this.

  4. Anonymous

    For the shooting after killed there is a simple solution, make the users screen go black so they can’t aim

    1. RA2lover

      there are better options, like checking whether the player who fired is dead to avoid that

  5. BrandonFireflower

    Hmm… spitting the work between client and server side? Genius! Glad this game out, it’s a great concept for any MMO that allows some sort of user content. Having the server run the functions for the mechanics stops exploiters, because they’d have to modify the server itself, giving the ability to everyone, while allowing smooth transitions client side. Thanks for to concept.

  6. TheComputerNinja101

    I personally like Base War: the land and paintball! by daxter33 more than this. Make a gmae like them and I’m interested

      1. TheGamerTest

        Currently, daxter is developing with StudioMM a FPS entitle Borderline. This is currently really more advanced scripting than this game!

    1. Samaxis

      Daxter33 is not a “them”, he is an individual. And this is not to gain interest in roblox, it is just a test, in essence, on what roblox could imporve on and how much juice roblox currently has. And no, I do not mean HiC.

    2. sergantbloxxer

      I agree with Paintball! is so much better than this, Roblox Base Wars needs weapon movement just like in Paintball! by daxter33.

      1. Colorshy

        This game is just a show room model to give the users a feel on what this could be used for.

  7. ad2m15

    Awesome and Amazing and everything GOOD. ROBLOX is my fav game EVER. Amazing job I would like it more I had MEMBERSHIP!!!!

  8. Stickmasterluke

    Thank you guys for all thinking this about the raycasting. I find it very efficent and I hope you do to! It only takes a little bit of scripting but if you aren’t up for the job, then this isn’t a project for you.

    1. Anonymous

      Very good, btw it would be nice to allow players to import and animate their own meshes, im sure people would love to have user meshes back.

      1. Samaxis

        Meshes are not animated. They are just 3d objects. A rig(virtually a virtual skeleton, with set joints at elbows/such), in programs such as Cinema4D, is animated, and a “mesh”, or 3D object, is tied to that, thus making it move with the rig.

    2. stix619

      Maybe if I brush up on my building and scripting skills, I could use these to rival stickmasterluke. OYUS.

    3. TheComputerNinja101

      It’s a very good game, but certain areas, such as the gun not moving up/down wen looking up. otherwise its still a good game

  9. DriftRacer14

    There’s a part in every brick called a fire. When disabled it’s just sitting there being a mini lag bomb. When enabled it sets fire to the whole server evntually because of the Spread part and causes 10X MORE lag. Best way to reduce lag in any game? Open every part and delete the fire. Or for you scripters out there you can script it out.

  10. powerminer1885

    It seems like What I builta long time ago the most simplest thing I have built

    1. FireThundra

      I am in FEAR and this may be a great place for them to train.

      THIS GAME IS GOING TO BE FLIPPIN’ EPIC!!!!!!!!!!!!!!!!!

  11. Strider97

    wow, its a good script, thats for sure. and guys dont harp on him for not having it as good, this was one of the prodigys for the fps style or Roblox, id like to see YOU come up with a script like that on your own.
    all in all, very well scripted, besides the lag part, unless i misread, but who cares?

  12. bballer13sn

    Nice script, stickmaster. If only I cared to script weapons…I prefer scripting GUIs.

  13. Rukiryo

    You can simulate a projectile by casting a ray, then set a mesh where the ray went, scale it down based on how long the ray was then use offset to move it, with magnitude for player detection. Easy.

  14. Anon

    Problem with client-side scripting is it’s more vulnerable to memory editing, either custom coded or using tools

  15. whabthesmasher

    Please if there is a roblox update just write it in the news and what it is i dont know what this update did plaese do that

  16. DrAgonmoray

    If everything but raycasting is client-sided, doesn’t that mean that a user could- I dare say -modify the code to cheat?

    1. Marioh10

      It sends from server to the client all the lua code… Lawl, how do I know that? The scripts run on the server… Been in test server mode before. Been there, done that. :)

  17. Anonymous

    Glad he posted the scripts, I’v been trying to tweak my guns to make my guns have ray-cast, But couldnt… Thanks for the help!

  18. Regi8401

    I think you guys could’ve done better and still made it not lag. If users are able to make better gun scripts without any lag problems, you guys can too. On the plus side though, the meshes aren’t bad.

      1. "-

        its easy if you copy and paste but that would make it lukes version so theres no point of veiwing it cause its basicly Free Models ._.

    1. Sonicya100

      It’s soooo Medium-level for me.. :3
      (I taught myself Basics, but need to be taught Advanced but can’t find a ‘teacher’)

    2. einsteinK

      Without scripting you couldn’t even use the most simple(-looking) things like the in-game Menu and leaderboard!
      I know almost every instance, function, method, property and event , abling me to script almost everything! Person’s (popular) Admin commands are made of simple codes, but a good scripter could make more commands, make it more efficient, or like I did a toolgui that becomes created by the script itself when you say “toolgui”. Scripting is the base of the game, base of current tools and a lot more models, and base of the future!
      Since the update of 5 april you can manipulate the camera so much tnat you make it spin, auto-zoom, move from your character away and A LOT more! If you hate scripting, you hate roblox!

Comments are closed.