Mod Question Repository... Questions come in, answers go out - Page 42

Mod Question Repository... Questions come in, answers go out

Resources to get you going on your new project, or to help you over some emergent problems during your development cycle.

Moderator: Moderators

Locked
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Re: Mod Question Repository... Questions come in, answers go out

Post by bobthedinosaur »

i added some sounds now spring locks up at weapondefs (last entry in info log after taskmanager kill spring), what do i need to look for?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Mod Question Repository... Questions come in, answers go out

Post by Argh »

Depends on how you added the sounds. If you just dumped them into the project (i.e., the old way) then you may have a problem with a sound being corrupt or a WAV format Spring doesn't handle well.

If you're using sounds.lua (the new, much better way) then you need to be veeeeery careful about case-sensitivity.

I.E.:

Code: Select all

local Sounds = {
	SoundItems = {
		--- RESERVED FOR SPRING, DON'T REMOVE
		IncomingChat = {
			file = "sounds/incoming_chat.wav",
			 rolloff = 0.1, 
			maxdist = 10000,
			priority = 100, --- higher numbers = less chance of cutoff
			maxconcurrent = 1, ---how many maximum can we hear?
		},
},
}

return sounds
If that's really "incoming_Chat.wav" in the actual file name, then you're hosed. Had lots of "fun" with this and other issues of case-sensitivity until I figured out what was borked. Same goes double for script references- BOS scripts are case-sensitive, and if you play-sound("Incoming_chat",10) when the reference is "Incoming_Chat", you will see a crash.
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Re: Mod Question Repository... Questions come in, answers go out

Post by bobthedinosaur »

which wav format works best with spring? I'm using audacity to edit and save sounds, and it has these options:
Image
I should also not audacity is set at 44.1kHz
Attachments
wav options.jpg
(81.94 KiB) Downloaded 184 times
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Re: Mod Question Repository... Questions come in, answers go out

Post by bobthedinosaur »

Okay, since I cant find any docs on it. I'm guessing spring does not like stereo, and must have its wav's mono maxed at 44.1kHZ and in 16bit format?
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Re: Mod Question Repository... Questions come in, answers go out

Post by Peet »

I have noticed crashes with stereo sounds on some hardware, yes.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: Mod Question Repository... Questions come in, answers go out

Post by Pxtl »

I'm just curious - how much about a unit can be changed at run-time in Lua, without having to replace it with a new, pre-defined unit?

Can I change the primary weapon (ie: unit goes underwater, a secondary jammed torpedo launcher replaces the surface weapon as the primary)?

Can I change firing range? Projectile sizes? Features like stun/concussion/damage of the projectile? Muzzle velocity?

Can pieces be resized? The collision sphere? The cruisealt?

I don't want details of how to do anything, just a yes/no so I can figure out how achievable a project I have in mind is.

Thanks in advance.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Mod Question Repository... Questions come in, answers go out

Post by Argh »

I'm just curious - how much about a unit can be changed at run-time in Lua, without having to replace it with a new, pre-defined unit?
Well... hrmm. IIRC, we aren't able to write to the UnitDefs table on the fly, so a truly new Unit... no. Maybe that's changed since the last time I looked at that, but I don't think we're allowed to write all-new UnitDefs once it's initialized.

That said, you can play with a lot of properties... and use transformation code or just a simple swap to go between "modes".

As for weapons: you can change quite a few properties of a weapon, either with BOS or Lua, but you're not allowed to change the appearance without using some fairly fancy Lua.

Pieces may be re-sized, but only with fancy Lua, and that fancy Lua doesn't exist yet, so far as I know. Technically possible, yes. Something you can do without programming it, no.

The collision sphere, or cube / column / etc. may be arbitrarily moved, resized, etc.

The cruisealt is totally non-negotiable, and is a fixed part of the UnitDef.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: Mod Question Repository... Questions come in, answers go out

Post by Pxtl »

Hmm... I could fake a changed cruise-alt by moving the collision-sphere and pieces around, though, couldn't I? For a gunship, I mean, not a fighter. Oh, wait, that would probably look terrible when it aimed downwards, right.

What do you mean by "pieces may be resized, but only with fancy lua"? Can COB resize a piece?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Mod Question Repository... Questions come in, answers go out

Post by Argh »

Can COB resize a piece?
Yes, with vertex deformation. Ask zxswg if he'll write a scaling algorithm, that is almost certainly possible.

Otherwise, you'd have to do it with Lua, drawing the Piece at a new scale.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: Mod Question Repository... Questions come in, answers go out

Post by FLOZi »

Argh wrote:
Can COB resize a piece?
Yes, with vertex deformation. Ask zxswg if he'll write a scaling algorithm, that is almost certainly possible.

Otherwise, you'd have to do it with Lua, drawing the Piece at a new scale.
No.

COB Cannot do vertex deformation, and never has been able to. Why you insist on perpetuating your myth that it can is beyond me. There is no way to scale a piece in Cob other than using multiple pieces and show/hide.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: Mod Question Repository... Questions come in, answers go out

Post by zwzsg »

Just Argh being Argh. I guess he got confused by seeing my boobies.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: Mod Question Repository... Questions come in, answers go out

Post by Pxtl »

FLOZi wrote:
Argh wrote:
Can COB resize a piece?
*snip*

COB Cannot do vertex deformation, and never has been able to. Why you insist on perpetuating your myth that it can is beyond me. There is no way to scale a piece in Cob other than using multiple pieces and show/hide.
Well, shit. And it's such a simple transformation! So the only way to do a dynamically resized piece is to actually have it drawn in Lua using the OpenGL API?
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Re: Mod Question Repository... Questions come in, answers go out

Post by bobthedinosaur »

how does CURRENT_SPEED work? i can't seem to compare it to MAX_SPEED when im trying to figure out at what stage a unit is in the accelerating or deaccelerating process. is it not on the same scale as max_speed and just a percentage of it?

Does CURRENT_SPEED and MAX_SPEED just not work with air units? I am getting bizarre results.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Mod Question Repository... Questions come in, answers go out

Post by Argh »

COB Cannot do vertex deformation, and never has been able to. Why you insist on perpetuating your myth that it can is beyond me. There is no way to scale a piece in Cob other than using multiple pieces and show/hide.
<shrugs> If zxswg says it's just me mis-remembering, then it's probably my brain misfiring.

I thought there was an example of this in one of the radar models, back in the day. It was only used in maybe one-two Cavedog models, I thought, and I thought I remembered reading about it being one of the mysterious curiosities that nobody ever did anything with because it was such a pain in the ass, because you had to have the vertex number, or something equally awful.

But yeah, I must be thinking of something else. Maybe I'm mixing it up with the stuff I did with Freelancer's engine, where we did various hex-edit silliness to mess with their bloody awful animation system. It's been awhile. Dunno why I keep thinking that it was an unfold sequence or something, where the verts did something that can't be done with move / rotate, but whatever, I'm wrong, and if I'm not wrong, then obviously nobody knows how to do it and it must be a pain in the butt.

So, basically, yeah, use OpenGL. If you just want to resize it, that's pretty easy, anyhow, the only trick is intercepting that Piece's display list.

But... one question... what do you want piece size transforms for? I mean, if you just want Units that change size due to some condition, but it's a fixed size, that's easy, and you don't necessarily have to get into OpenGL to do that. If you want really dynamic stuff, like a Piece that is resized over time... not so much, that will get a bit tricky and kinda expensive.
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Re: Mod Question Repository... Questions come in, answers go out

Post by bobthedinosaur »

Why is it that adjusting max speed to air just kills the unit, and makes it sink to the ground?

Also once again, how the hell do you use CURRENT_SPEED with air?

edit: testing current speed it apparently jumps to 99 when moving and does not account for acceleration, and it does not drop when an aircraft is refueling, but it does during landing...
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

Re: Mod Question Repository... Questions come in, answers go out

Post by bobthedinosaur »

"define GROUND_WATER_HEIGHT 78 // get land height, negative if below water "
does not actually get a negative value if below water like it says it does, or not for buildings?
Currently I am detecting water to delete (self destruct) a feature that may accidentally spawn in water, but I have to use setSFXoccupy, which on some maps will delete them all if the ground water is to high.

Any suggestions?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: Mod Question Repository... Questions come in, answers go out

Post by Argh »

Use Lua to get the groundheight at x,z (unit's base position) instead of COB.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Mod Question Repository... Questions come in, answers go out

Post by KDR_11k »

If it doesn't go negative just check for 0.
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Re: Mod Question Repository... Questions come in, answers go out

Post by rattle »

It's possible that GROUND_HEIGHT goes negative instead. One of them does IIRC
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Mod Question Repository... Questions come in, answers go out

Post by KDR_11k »

rattle wrote:It's possible that GROUND_HEIGHT goes negative instead. One of them does IIRC
GROUND_HEIGHT2 does AFAIK.
Locked

Return to “Game Development Tutorials & Resources”