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.
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.”
Translation?
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.




That raycasting script in the roblox wiki does not work on play mode
i like roblox
After reading this,I am DEFININENTLEY
gonna play this sometime (But Vinya’s guns are still better.)
So this is how a gun scipt works? Just add a tracer script and whala your own scripted, working gun :D
I like
I like is very cool
Epic
Boss.
So cool
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
WOW not only is the script the size of a pea its got nil lag and still simple
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.
Fastest*
official gun meshes? AWESOME!
For the shooting after killed there is a simple solution, make the users screen go black so they can’t aim
there are better options, like checking whether the player who fired is dead to avoid that
Play Our Easter Hunt game to collect badges and more
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.
I personally like Base War: the land and paintball! by daxter33 more than this. Make a gmae like them and I’m interested
*game
Currently, daxter is developing with StudioMM a FPS entitle Borderline. This is currently really more advanced scripting than this game!
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.
I agree with Paintball! is so much better than this, Roblox Base Wars needs weapon movement just like in Paintball! by daxter33.
This game is just a show room model to give the users a feel on what this could be used for.
This game, I believe is just meant as a showcase…
Awesome and Amazing and everything GOOD. ROBLOX is my fav game EVER. Amazing job I would like it more I had MEMBERSHIP!!!!
Very interesting..
Whoa. A good update in a few years
Hmm, VERY nice job.
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.
Luke, you are AMAZING
Agreed.
Thats not the real one, probably.
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.
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.
Maybe if I brush up on my building and scripting skills, I could use these to rival stickmasterluke. OYUS.
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
The epic admins do it again.
If only I could script like that…
Thanks to this, now I can learn to minimize my raycast-based weapons for good!
I WANT IT GIMMEGIMMEGIMMEGIMME GIMME!!!!!
That Luke Webster is something else! :D
Amazing..
luke webster is stick master luke you know…
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.
Are you sure that’s not just an infection script that is commonly found in free models?
It seems like What I builta long time ago the most simplest thing I have built
Where are those meshes. Must… RETEXTURE!
Awesome!
Coolio
Cool More Weapon Advantage=More Kills! >:D
ME LIKEY >:)
I am in FEAR and this may be a great place for them to train.
THIS GAME IS GOING TO BE FLIPPIN’ EPIC!!!!!!!!!!!!!!!!!
Ha, I get it…. DOOM the game on N64 and I think on some other platforms
Bah. I’ve seen better.
Sure. There are better. But this is efficient. umad?
:D
Lol rlly is hemad???? XD
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?
That seems like an incredibly easy scriptyou have on display there. :D
Nice script, stickmaster. If only I cared to script weapons…I prefer scripting GUIs.
nice
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.
Problem with client-side scripting is it’s more vulnerable to memory editing, either custom coded or using tools
Cool.
Whoah o.o
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
joing roblox right now
ftw!!
Awesome!
Well i need some help scripting so ill look at his scripts to help me.
Cool.
how do you put the quality higher?
SilentSwords has developed this earlier than Roblox.
WIJ best tech evar!
LOLNO
If everything but raycasting is client-sided, doesn’t that mean that a user could- I dare say -modify the code to cheat?
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. :)
Im gonna try.
Dude! So cool!
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!
..I don’t understand anything I just read..
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.
Wow that looks like pwnage
Very nice.
sweet is look cool
Are those MESHES? New MESHES? :D
i hate scripting
its sooooooooooooooooo hard
It’s sooooooo easy. :3
Show me how???
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 ._.
Its sooooo easy :D
RBLX.Lua is easiest to learn.
It’s only as hard as you make it
Then don’t script -_-
It’s soooo Medium-level for me.. :3
(I taught myself Basics, but need to be taught Advanced but can’t find a ‘teacher’)
I hate Lua, but not coding in general :)
Scripting is fun :3 Well as long as you know what you are doing.
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!
Wow, interesting design.