PDA

View Full Version : What is this?



kung foo man
18th May 2018, 14:40
Yo all,

I prepared this project for several months behind the scenes and now finally put this slowly into public. Even back in the CoD2 modding times years ago I always dreamed about a technology to let people play in servers just by sending them a link. Back then it was barely possible, you only had shitty Adobe Flash and some JavaScript etc... but times have changed.

Every modern browser nowadays is a full blown near-native 3d renderer. The two buzzwords are WebGL and WebAssembly.

So what is libwebgame? I ported the ioquake3 engine over to web (it still works on PC for local development in Visual Studio). Since it is/was only a bunch of C code, it was mostly just modded by some diehard C coders. And even if you are good in C, you might simply not wanna do it, because C is aids when you quickly want to prototype stuff. So I worked hard to nicely integrate the Julia scripting language. I added some constructs to it so it feels nearly like CoDScript.

For example, if you want to create a guided rocket, this is easily possible via some Julia code:

https://github.com/KILLTUBE/libwebgame_julia/blob/master/callbacks/rocket.jl



function ControlMissile(player::Player, rocket::Entity)::Void
log(console, rocket, "start control for", player)
while inuse(player) && inuse(rocket)
posPlayer = getEye(player)
posRocket = pos(rocket)
distancePlayerRocket = distance(posPlayer, posRocket)
targetDirection = Float32(100.0)
if useButtonPressed(player)
targetDirection = Float32(-100.0)
end
rocketDistanceForward = posPlayer + forward(player) * (distancePlayerRocket + targetDirection)
movetoVelocity!(rocket, rocketDistanceForward, Float32(400))
threadwait(0.05)
end
log(console, rocket, "stop control for", player)
nothing
end


Julia feels somewhat like CoDScript, just with a way better type system and being more dynamic. E.g. you can edit/update your mod while your players are immersed in your gametype. And best of all, Julia is JIT-compiled, meaning your source code is competing with C/C++ performance (you can still write shitty source code, than you are competing with Python performance lol).

Currently there are still some rough edges to get your own website and mods running, but I will work to ease all of it