Mod questions, D3 SDK

For all coding issues - MODers and programmers, HTML and more.

Moderators: Jeff250, fliptw

Post Reply
User avatar
Foil
DBB Material Defender
DBB Material Defender
Posts: 4900
Joined: Tue Nov 23, 2004 3:31 pm
Location: Denver, Colorado, USA

Mod questions, D3 SDK

Post by Foil » Wed Jul 12, 2006 1:33 pm

I'm working on a new two-team multiplayer gametype for Descent 3, and just wanted to ask a couple of questions, as I know there are some experienced mod-coders here who have worked with the D3 SDK before.

I don't want to give away the specifics of the new gametype until I have a Beta version ready, but this is my first attempt at something of this nature, so I would appreciate any support or tips.

I'm developing it using the Descent 3 SDK, in Visual C++ 6.0 with the most recent service pack. (I tried it in Visual Studio 2005, but C++ doesn't allow default-arguments on function pointer prototypes anymore, so it was easier just to go back to VC++6.) I'm using the \"Anarchy\" code as a base template, and grabbing code from the Assault and Entropy projects as needed. So far, it compiles and plays fine, but I've only been making minor adjustments, and haven't yet gotten to the biggest of the changes I want to make.

So here are my main questions:

1. I'm going to build a \"trigger\" event into the mod, so that a player can activate something (for example, some kind of switch to activate a door somewhere else in the level). I want it to be relatively simple for level designers to implement, so I was thinking about like having a \"shoot\" or \"fly-through\" switch by creating a custom flag for rooms or faces. Or is there a better way to do this?

2. I'm also going to have two types of spawn points for each team (it's a 2-team gametype). Levels will have regular team spawn points, as well as \"custom\" spawn points where I want players to respawn under certain conditions. Are there any potential problems with this that I'm not seeing?

3. I may want to have \"friendly-damage\" active. Are there any things I'll need to consider beyond kill/death events by friendly fire?

I appreciate any help anyone can give, thank you! :D


P.S.: Many thanks to DCrazy for his earlier threads in this section about compiling the .d3m; I would have wasted a long time figuring out how do it otherwise.
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy » Wed Jul 12, 2006 3:28 pm

You can't create custom face types; you can only use the hardcoded flags provided (S1-S6 for rooms, \"special\" for faces -- i.e. \"paint this face\"). They're in the room struct I believe (I don't have the D3SDK installed anymore, and lost all the Olympia Gold 3 code a long time ago).

Attempting to implement custom spawn points has all sorts of problems, not the least of which is that there's no \"respawned\" notification available to your code. The best I could do in OG3 was to check every frame to see if the player had died, and set a flag. Then check the flag and clear it if the player was no longer \"dead\". There are a few problems with this though (it introduces a race condition IIRC) and the teleportation, while it usually works, can potentially cause game crashes if a player teleports on top of another player. Not likely but it did happen to us. At first we tried using waypoint objects, but D3 does not inform your mod if a player collides with a waypoint. Eventually we used S1-S6 to emulate waypoints: S1 was the start of the track, S6 was the end of the track (tracks were required to be circular), and S3 - S5 were waypoints along the way. D3 does let you know when a player has changed rooms/terrain segments.

You'll have to make up for D3's poor tracking of who shot what. Also, you'll have to handle every collision event as you need to check for players colliding as well as weapons colliding with players.

And this is why OG3 took forever just to be abandoned. :P
User avatar
Foil
DBB Material Defender
DBB Material Defender
Posts: 4900
Joined: Tue Nov 23, 2004 3:31 pm
Location: Denver, Colorado, USA

Post by Foil » Wed Jul 12, 2006 4:15 pm

Thanks for the information; I would have probably run into the same issues with custom spawnpoints. Looks like I need to figure out alternative ways of doing things.

For example: Since it's a two-team gametype, my mod will be using the built-in Blue and Red team spawnpoints normally. Could I use the Yellow and Green team spawnpoints as the \"custom\" spawnpoints? In other words, under conditions where I want a red player to spawn in a certain room, I can use the yellow spawnpoints by changing them to the yellow team temporarily (similarly for blue players, using green).

Also: instead of using fly-through faces, do you happen to know if there's any way I can use \"switch\" objects to trigger events in my code, or would that need to be scripted on the level side? I didn't see anything obvious in the code that would allow it.

Anyway, thanks for the help, DCrazy. If nothing else, your experience with OG3 is benefitting fledgling D3 mod-coders like me! :D
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy » Wed Jul 12, 2006 4:27 pm

Anything that does actual level scripting stuff has to be handled through DALLAS/OSIRIS. You could fudge a lot of stuff, but you would have to be really careful and make sure that all clients are notified of any changes. For example, I don't think it's possible to blow out windows using anything but DALLAS/OSIRIS, but if you were to say turn those windows into custom objects, you could try to handle on the server-side whatever event should blow those windows out and then kill the objects. Just make sure that the object is killed on all clients -- this might involve creating a custom packet and manually notifying clients.

As far as actually replacing the concept of fly-through faces, you could create a custom object that had a large collision radius, but that would introduce a lot of inaccuracies.

Changing a player's team wouldn't work as it forces a respawn. SetObjectPosition (or whatever it's called) would be the only way to do it.
User avatar
Foil
DBB Material Defender
DBB Material Defender
Posts: 4900
Joined: Tue Nov 23, 2004 3:31 pm
Location: Denver, Colorado, USA

Post by Foil » Wed Jul 12, 2006 5:57 pm

Hmmm, you're right.

Looks like I'm going to have to rely on level designers to use DALLAS/OSIRIS level scripting to accomplish the effect of providing a switch to open a door. I was hoping to be able to code it in such a way that would only allow one team to use the switch (one switch for each team), but that's not a huge deal.

As far as the spawnpoint issue, here's what I'm trying to do:

I'm going to have two custom rooms, one for each team. The first time a player joins (or when the level recycles), the player starts outside of the room. Upon getting killed, they should spawn in the custom room for their team. They will be able to fly out of the room, but on every death, they will respawn back in that room.

Would it be feasible to do this by coding a teleport that would only work the first time player enters the game?
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy » Wed Jul 12, 2006 8:33 pm

Sounds like Team Fortress to me. :)

Would it kill gameplay if the team members spawned inside of the room at first? If not, you might just be best off using regular old spawn points.

I just thought of a neat trick: make 2 kinds of custom switch (call one red_team_switch and one blue_team_switch). In your server-side collision handler, if a weapon belonging to a red team member collides with a blue_team_switch, or vice versa, discard the collision. Otherwise, pass it up the chain. That might give you the effect you want. It still requires that the level author write a script for the red_team_switch that opens the red team's door, but it takes care of the most important logic piece.
User avatar
Foil
DBB Material Defender
DBB Material Defender
Posts: 4900
Joined: Tue Nov 23, 2004 3:31 pm
Location: Denver, Colorado, USA

Post by Foil » Thu Jul 13, 2006 8:36 am

DCrazy wrote:Sounds like Team Fortress to me. :)
Nope, not really. ;) (I may PM you the details if my 'general' descriptions aren't enough at some point.)
DCrazy wrote:Would it kill gameplay if the team members spawned inside of the room at first? If not, you might just be best off using regular old spawn points.
It has to do with when access in/out of the room is available (a switch will control the door to the room). It would be okay to spawn players in the room if they all came in at once, but I want this to work for players who jump in during a game in progress.

And thanks for the switch idea. I may just try to implement that.
User avatar
Foil
DBB Material Defender
DBB Material Defender
Posts: 4900
Joined: Tue Nov 23, 2004 3:31 pm
Location: Denver, Colorado, USA

Post by Foil » Sat Jul 29, 2006 12:16 am

I'm still working on this... I think I have a pretty good idea of how to implement a lot of what I want to do, but I'm still vague on a couple of issues.

DCrazy, do you happen to remember how you did the teleportation you described below (for OG3)?
DCrazy wrote:...the teleportation, while it usually works, can potentially cause game crashes if a player teleports on top of another player. Not likely but it did happen to us. At first we tried using waypoint objects, but D3 does not inform your mod if a player collides with a waypoint. Eventually we used S1-S6 to emulate waypoints: S1 was the start of the track, S6 was the end of the track (tracks were required to be circular), and S3 - S5 were waypoints along the way. D3 does let you know when a player has changed rooms/terrain segments.
Maybe my brain is just a bit fried today, but I'm not real clear on this. I understand that S1-S6 refer to the "special" room types, but I'm not sure how to use that to implement changing player ship locations (especially on the client). Or was all of that scripted in DALLAS on the level-side?

Basically, I just need to know which objects/functions to manipulate to force a "teleport".

I appreciate all the help! :)
Post Reply