Xonotic is a free, open source (GPL) ultra-fast, first-person shooter


Follow Xonotic on

Post Reply 
A Garry's Mod / sandbox system
10-23-2011, 03:56 PM
Post: #1
A Garry's Mod / sandbox system
I've been planning to code something in this sense for a while. I got reminded of it today, and thought I should discuss it here before attempting to code anything.

Although I never had Garry's Mod and got Team Fortress 2 just a week ago, I've always been fascinated with how people mod the Source engine, even using it to create things like animations and movies (both with GM, HL2 and TF2). Youtube is full of films created using those projects, and all sorts of other things were done too. With Garry's Mod, I also found it fun for the ability to build things, which seemed like a very fun activity (similar to MineCraft in this sense).

Even back when we had Nexuiz, I planned to do something similar here. My initial idea (the one I wish to code in Xonotic presently) was to create a g_sandbox cvar (as mutator and not a gametype), which would allow players to spawn objects and edit their properties. This should be fairly easy to do, and I plan to do it the following way:

It would work just like g_lighteditor for rtlights. A player can open the console, type 'g_sandbox_spawn models/somefolder/themodel.md3', and spawn an entity with the given mesh in the spot they are looking at. Then, while looking at the model, they could edit its individual properties, such as physics (either static or ODE), if the object collides or is ghosted, change object colors (colormod and glowmod), and anything else that's safe to edit. For animated models, players could also set the animation keyframe of that model, same way you do it in misc_gamemodel. Later on, I would make a menu (similar to the team selection menu in functionality) which would allow doing all this through buttons and sliders.

This would be a basic sandbox system, which would enable building in-game using any model available on the server. That by itself however, would never allow the editing possibilities I seen in GM / TF2. Where players can apparently animate rigged models in real time, play with ragdolls (a feature given no importance in Xonotic), script objects, etc. Such will likely never be possible in Darkplaces and Xonotic to the same level, but I'd still like to code a sandbox feature to the extent possible. Characters in Source engine games also have facial expressions and mouths that can be lipsync-ed, which no one would likely put effort to do for Xonotic players.

In my opinion, it would be very fun regardless. People could spawn objects around, pick them up and carry them around, give them ODE physics and shoot them to watch them fly, build all sorts of architecture in real time, or just foolishly spawn weapons and do whatever they want with them. When you get bored of fighting or racing, this would be an awesome activity to have in Xonotic for relaxing Big Grin

Anyway, I wish to ask and discuss to what extent a sandbox / Garry's Mod system can be implemented in Xonotic, and if the head developers would accept and welcome such an idea. Also, is there any support for scripting entities (eg: LUA)? I don't know how to script, but still asking if it would work. If done properly, this could be a big attraction in Xonotic, and we'd also be offering an open source alternative to Garry's Mod. I'm rather excited about this idea, and hope others have positive thoughts and ideas about it too Smile

<spackObot> Congratulations to Samual and Taoki, your lovescore is 98.463%!
Samual (~dioteckte@...) quit #xonotic.pickup (gonna kill myself now)
Visit this user's website Find all posts by this user
Quote this message in a reply
10-25-2011, 10:39 AM
Post: #2
RE: A Garry's Mod / sandbox system
Awww... no replies to this? I already finished coding most of the basics Tongue If anyone is curious, see mirceakitsune/sandbox.

What we have so far: Models can be spawned, removed, and copied. Models can be grabbed and carried around, similar to the gravity gun in Half-Life 2 (using the drag system previously available with sv_cheats, see button8). There is also a menu which gives the basic sandbox tools, available just like the Team Select menu (F7 by default). Object editing comes next, and I'll probably get to that tonight. If we're lucky, ODE physics might not be as buggy as years ago, and will work also Big Grin

Also, I had a chat with LordHavoc about this. Apparently it's possible to pose rigged models from in-game, same way as in Garry's Mod! Big Grin Animations created that way can be saved and loaded to / from text files. No idea how to implement something that advanced however, nor how QC can manipulate bones at all. But that's a very good thing to know.

<spackObot> Congratulations to Samual and Taoki, your lovescore is 98.463%!
Samual (~dioteckte@...) quit #xonotic.pickup (gonna kill myself now)
Visit this user's website Find all posts by this user
Quote this message in a reply
10-25-2011, 10:52 AM
Post: #3
RE: A Garry's Mod / sandbox system
I haven't posted here as I'm following your progress in IRC.
I honestly don't know (yet) what I'd use this for, but I'm sure it won't be a bad thing to have this sandbox thingy too.
Keep up the good work!

[Image: 561.png]
"One should strive to achieve; not sit in bitter regret."
Visit this user's website Find all posts by this user
Quote this message in a reply
10-25-2011, 06:26 PM
Post: #4
RE: A Garry's Mod / sandbox system
Thanks! It would clearly have its uses. One is just building for fun, like you would in MineCraft or Second Life (more limited than there though). And if we manage to get the pose system working later on, it could even work for creating animated movies with rigged meshes (eg: the player models). That's dreaming a bit too far, but who knows?

<spackObot> Congratulations to Samual and Taoki, your lovescore is 98.463%!
Samual (~dioteckte@...) quit #xonotic.pickup (gonna kill myself now)
Visit this user's website Find all posts by this user
Quote this message in a reply
10-26-2011, 06:01 AM
Post: #5
RE: A Garry's Mod / sandbox system
One question. Why ODE? It has not even been updated for several years. What's wrong with, lets say, Bullet engine?

·Nekomimi·

:: q3map2 x64 for Windows
Find all posts by this user
Quote this message in a reply
10-26-2011, 06:13 AM
Post: #6
RE: A Garry's Mod / sandbox system
(10-26-2011 06:01 AM)Lord Canistra Wrote:  One question. Why ODE? It has not even been updated for several years. What's wrong with, lets say, Bullet engine?

Don't know, as I haven't worked on implementing ODE in the engine. I just know it's the physics that was chosen at that time, and it was easier to implement than Bullet. Personally, I think Bullet might be better too... but who will do the work of implementing an entirely new physics system in the engine?

Also: I tried ODE last night with my objects. They fell through the floor lol.

<spackObot> Congratulations to Samual and Taoki, your lovescore is 98.463%!
Samual (~dioteckte@...) quit #xonotic.pickup (gonna kill myself now)
Visit this user's website Find all posts by this user
Quote this message in a reply
10-26-2011, 12:24 PM
Post: #7
RE: A Garry's Mod / sandbox system
First video preview of the sandbox system. Also a screenshot of the tools menu.




Please do not embed images from pics.nexuizninjaz.com! Click here to attempt to see the image anyway.

<spackObot> Congratulations to Samual and Taoki, your lovescore is 98.463%!
Samual (~dioteckte@...) quit #xonotic.pickup (gonna kill myself now)
Visit this user's website Find all posts by this user
Quote this message in a reply
10-27-2011, 05:53 AM (This post was last modified: 10-27-2011 05:54 AM by Lord Canistra.)
Post: #8
RE: A Garry's Mod / sandbox system
Seems wonderful so far! Now add some facial vertex animations so we can has faces like this :3

·Nekomimi·

:: q3map2 x64 for Windows
Find all posts by this user
Quote this message in a reply
10-27-2011, 11:24 AM
Post: #9
RE: A Garry's Mod / sandbox system
(10-27-2011 05:53 AM)Lord Canistra Wrote:  Seems wonderful so far! Now add some facial vertex animations so we can has faces like this :3

That would be epic, but sadly hard to do in Xonotic. People would need to add additional bones to the faces of most characters... which wouldn't be the hardest part either, as then we'd need to either animate all facial expressions (in which case Xonotic would need animation blending) or make bones possible to pose from in-game (which is already planned).

Anyway, I worked more on the sandbox today, and did some nice things. I added particles to material collisions, as well as support for object-to-object attachments. You can mark an object for attachment, then select another object to attach it to. Note that objects cannot be edited while attached, but can be detached and put back again. Attaching to bones is also supported.




Please do not embed images from pics.nexuizninjaz.com! Click here to attempt to see the image anyway.

<spackObot> Congratulations to Samual and Taoki, your lovescore is 98.463%!
Samual (~dioteckte@...) quit #xonotic.pickup (gonna kill myself now)
Visit this user's website Find all posts by this user
Quote this message in a reply
10-27-2011, 12:19 PM
Post: #10
RE: A Garry's Mod / sandbox system
Do you have that uploaded to git? I'd like to see it in action, although I'm not quite sure how to do it.
And if I'm to try and modify some stuff, how should I create my branch? With the "all" script, or manually with some git commands?

·Nekomimi·

:: q3map2 x64 for Windows
Find all posts by this user
Quote this message in a reply
10-27-2011, 12:23 PM
Post: #11
RE: A Garry's Mod / sandbox system
(10-27-2011 12:19 PM)Lord Canistra Wrote:  Do you have that uploaded to git? I'd like to see it in action, although I'm not quite sure how to do it.
And if I'm to try and modify some stuff, how should I create my branch? With the "all" script, or manually with some git commands?

Sure, the branch is mirceakitsune/sandbox. Switch to that and compile the game code, then in-game press F7 for the sandbox menu, and use the v key to grab objects.

As for making changes, I wouldn't recommend that for now, to avoid code conflicts. I use Tortoise GIT here, and don't know the GIT commands too well.

<spackObot> Congratulations to Samual and Taoki, your lovescore is 98.463%!
Samual (~dioteckte@...) quit #xonotic.pickup (gonna kill myself now)
Visit this user's website Find all posts by this user
Quote this message in a reply
10-27-2011, 01:38 PM
Post: #12
RE: A Garry's Mod / sandbox system
No, I mean not modifying or adding to your code, I'm talking about general branch creation.
Well, I'll try that Tortoise GUI as well.

·Nekomimi·

:: q3map2 x64 for Windows
Find all posts by this user
Quote this message in a reply
10-27-2011, 01:41 PM
Post: #13
RE: A Garry's Mod / sandbox system
./all branch myname/mybranch
for code you only say y to xonotic-data when asked.
Find all posts by this user
Quote this message in a reply
10-27-2011, 02:28 PM
Post: #14
RE: A Garry's Mod / sandbox system
(10-27-2011 01:38 PM)Lord Canistra Wrote:  No, I mean not modifying or adding to your code, I'm talking about general branch creation.
Well, I'll try that Tortoise GUI as well.

Of course, you can do that if you wish. But if you want your code to be included as well, I don't recommend doing that now. Since if we both work on the same code at the same time, the risk of code conflicts maximum. And if the GIT conflicts get too much, I cannot promise solving them and integrating the branch, and the code might get lost.

<spackObot> Congratulations to Samual and Taoki, your lovescore is 98.463%!
Samual (~dioteckte@...) quit #xonotic.pickup (gonna kill myself now)
Visit this user's website Find all posts by this user
Quote this message in a reply
10-27-2011, 03:12 PM
Post: #15
RE: A Garry's Mod / sandbox system
Alright, the whole thing works wonderfully ingame. Except for, maybe, small inconvenience when spawning playermodels - they default to animation set 0, which is death anim, and when you try to spawn one looking at the floor, they end up beneath it. Setting different default animation for player models and/or making simple undo operation not to spam world with those would fix this nicely. Otherwise, great job!

·Nekomimi·

:: q3map2 x64 for Windows
Find all posts by this user
Quote this message in a reply
10-27-2011, 05:41 PM
Post: #16
RE: A Garry's Mod / sandbox system
(10-27-2011 03:12 PM)Lord Canistra Wrote:  Alright, the whole thing works wonderfully ingame. Except for, maybe, small inconvenience when spawning playermodels - they default to animation set 0, which is death anim, and when you try to spawn one looking at the floor, they end up beneath it. Setting different default animation for player models and/or making simple undo operation not to spam world with those would fix this nicely. Otherwise, great job!

Falling through the floor should normally not happen. Sounds like a bounding box bug to me, and not the animation. Either way, frame 0 is the default. I don't agree with hard coding methods to identify models and default animation based on that, as anyone could put a custom model anywhere. On the bright side, the menu remembers the last animation keyframe you selected.

Anyway, I'm done coding for tonight. Since my last post, I added support for persisting object owners, by using player UID instead of owner entity (ID's are used in CTS). Note that if you don't have a player UID, anyone can edit your objects. I also un-hardcoded the materials. You can specify materials as strings, and sounds / particles are automatically fetched. This allows server admins to create their own materials without having to recompile, by only adding new sounds and particles.

<spackObot> Congratulations to Samual and Taoki, your lovescore is 98.463%!
Samual (~dioteckte@...) quit #xonotic.pickup (gonna kill myself now)
Visit this user's website Find all posts by this user
Quote this message in a reply
10-29-2011, 04:43 PM (This post was last modified: 10-29-2011 04:53 PM by MirceaKitsune.)
Post: #17
RE: A Garry's Mod / sandbox system
More changes done today. Database storage and copying / pasting now works with attachments. You can attach objects to other objects on any bone, and the storage + clipboard will re-create the whole set. Attachments are persisted in the same text line as the main object, and separated by a ; symbol. Please note that you cannot do chain attachments (attaching to other attachments), as they would be incompatible with the sandbox for many reasons.

I also added a neat new feature. The object clipboard is no longer stored in a server string, but set to / from a client cvar (cl_sandbox_clipboard by default). This allows some great possibilities... such as having multiple clipboards, client-defined object presets (spawning a given object with a shortcut anytime anywhere), being able to export your objects and post them online as a simple line of text (like forums or twitter), and best of all you can copy and paste between servers.

Say you find an object you like on a sandbox enabled server, and have the right to copy it. You want to put it on your own server, or bind it to a key and spawn it anytime. With the new cvar clipboard, you simply walk to it and copy it like before, press F11 to disconnect, go to your server (or any server you wish), and hit the paste button. Your object and its attachments will be pasted there, exactly like you copied them Big Grin

Further more, real men can use the paste command to create objects from the console. If you don't specify a cvar, you can write each object property by hand. For that however, you need some insane skills and patience. Still, the challenge can be taken Wink

Here's an example. The line below is an erebus holding a pink-glowing rocket launcher. Simply set cl_sandbox_clipboard to this line (careful with the quotation marks, they can be tricky) and click the Paste button in the sandbox menu. If all goes well, he should appear there. Let me know if this worked for you if you give it a try, since I'd like to hear Smile

Code:
\"models/player/erebus.iqm\" 0 0 \"0 0 0\" \"0 0 0\" 7 0 6 1 \"metal\" ; \"bip01 r hand\" \"models/weapons/v_rl.md3\" 0 0 \"0 0 0\" \"0.995895028 0.135713995 1\" 0 0 6 1 - ;

<spackObot> Congratulations to Samual and Taoki, your lovescore is 98.463%!
Samual (~dioteckte@...) quit #xonotic.pickup (gonna kill myself now)
Visit this user's website Find all posts by this user
Quote this message in a reply
11-23-2011, 04:22 AM
Post: #18
RE: A Garry's Mod / sandbox system
(10-23-2011 03:56 PM)MirceaKitsune Wrote:  ...

Hello Mircea and congrat`s for the idea; it sounds good to me. When its all done can give me an small interview for the romanian readers of my blog ?
Visit this user's website Find all posts by this user
Quote this message in a reply
11-23-2011, 06:14 AM
Post: #19
RE: A Garry's Mod / sandbox system
(11-23-2011 04:22 AM)Creation Wrote:  Hello Mircea and congrat`s for the idea; it sounds good to me. When its all done can give me an small interview for the romanian readers of my blog ?

Thanks. And possibly Smile I'm usually shy on voice, but I can try... I think that would be fun.

Also: This code has been ready for a merge for weeks, and also on my test server. divVerent is waiting for some input, and to know if anyone found any problems. Please test! http://dev.xonotic.org/issues/805

<spackObot> Congratulations to Samual and Taoki, your lovescore is 98.463%!
Samual (~dioteckte@...) quit #xonotic.pickup (gonna kill myself now)
Visit this user's website Find all posts by this user
Quote this message in a reply
11-24-2011, 04:59 PM
Post: #20
RE: A Garry's Mod / sandbox system
just gotta say that this looks awesome!
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
Lightbulb Easy to configure *map* balance system Samual 8 2,732 11-17-2012 04:14 AM
Last Post: Mr. Bougo
  Bone based damage system (feature vote and debate) MirceaKitsune 42 5,733 05-17-2012 01:29 AM
Last Post: CuBe0wL
  How do I use the newer 48 slot weapon system? May Epper 1 709 04-20-2012 01:28 AM
Last Post: Mr. Bougo
  Automated build system update Nitroxis 1 1,079 06-11-2011 02:18 PM
Last Post: Cortez666
  Automated Xonotic Git build system Mr. Bougo 72 25,645 01-27-2011 08:20 PM
Last Post: Samual
  "Global player stats tracking system, supporting anonymous player as well" atheros 30 8,895 06-18-2010 03:57 PM
Last Post: unfa
  Automatic Bot Waypoint System Odin 16 7,199 05-01-2010 07:06 PM
Last Post: GT_Gene

Forum Jump: