models then what? - Page 2

models then what?

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Re: models then what?

Post by oksnoop2 »

Success, I finally got my first unit to appear in game. I feel pretty good right now. So what's next? Movement?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: models then what?

Post by FLOZi »

Setting up a proper moveclass would indeed be a good start.

Examples of gamedata/movedefs.lua here:

CA
http://trac.caspring.org/browser/trunk/ ... vedefs.lua

S44
http://spring1944.svn.sourceforge.net/v ... iew=markup
User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Re: models then what?

Post by oksnoop2 »

So put one of those in the lua file in the scripts folder?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: models then what?

Post by FLOZi »

oksnoop2 wrote:So put one of those in the lua file in the scripts folder?
No, gamedata folder, as I said.
User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Re: models then what?

Post by oksnoop2 »

Sorry, I get rather anxious and don't read everything as closely as should sometimes. After pasting the one from CA into the movedef lua and starting up the mod. I still can't get my unit to move. Is there something aditional I have to do to tie my unit "static_saucer" to the movedef lua (hope that makes some kind of sense, i really don't know of a good way to phrase it)
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: models then what?

Post by FLOZi »

Yes, movementclass tag i.e.

Code: Select all

movementClass       = [[TANK2]],
Worth looking at a full unitdef from CA, I suggest the jeffy:

http://trac.caspring.org/browser/trunk/ ... armfav.lua
User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Re: models then what?

Post by oksnoop2 »

"Couldn't find unittype static_saucer" This is the message spring gives me. Here is the file i have in my units folder: http://pastebin.com/m61ef60c0

The file is named "static_saucer".


UPDATE: After tinkering with the unittype file i got it to work again. When I go in game my unit now has a "move" command. It still does not move. Is it because I did not "put object on ground" in wings3d? It is supposed to be a flying unit.
User avatar
Warrior
Posts: 23
Joined: 18 Dec 2009, 17:36

Re: models then what?

Post by Warrior »

this thread makes it sound easy to make a mod :P I might try myself
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: models then what?

Post by Argh »

UPDATE: After tinkering with the unittype file i got it to work again. When I go in game my unit now has a "move" command. It still does not move. Is it because I did not "put object on ground" in wings3d? It is supposed to be a flying unit.
If you want it to fly, set these values:

canMove=true,
canFly = true,
maxVelocity=5,
cruiseAlt = 500,
maxAcc = 0.5,

You do not need a movement class, for flying stuff; they have their own special class.
User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Re: models then what?

Post by oksnoop2 »

cool beans! My saucer, it fly's! So next step is, making it shoot perhaps? or is it something else?
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: models then what?

Post by SinbadEV »

you might want to try some animation scripting and shooting, yes.
User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Re: models then what?

Post by oksnoop2 »

Can some one direct me to a link on next step?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: models then what?

Post by Argh »

OK... animation.

Simplest way to learn: read the stuff in the Wiki... then study existing code. IDK what's currently best to read, in terms of good "newbie code". NanoBlobs was OK, but it would be teaching people to do a few things wrongly / inefficiently now, compared to P.U.R.E., and P.U.R.E.'s animation code is pretty complex and not terribly well commented. I honestly think we (the experienced animators) need to write some simpler, well-commented examples out to feed the Wiki with.

I will post some animation code here, but there is still no real guide for the basics that covers things very well (I've been thinking about writing one, this issue bothers me, because it's such a big newbie trap). There are various guides that cover parts here and there, but none of them end up being all that coherent (imo).

This assumes that you have three named Pieces (which may be nulls, if your model permits it): firepoint, turret, barrel.

Code: Select all


RestoreAfterDelay()
{
//wait approximately 5 seconds
 	sleep 5000;
//turn the barrel and the turret back to the home position
 	turn turret to y-axis <0> speed <100.0>;
 	turn barrel to x-axis <0> speed <100.0>;
	return(0);
}

AimFromWeapon1 (piecenum)
{
//What piecenum do we use to check and see if we're aiming the right way?
	piecenum = firepoint;
}

AimWeapon1(heading, pitch)
{
//Locks up that turret, so that nothing else can interfere with it until it's done
	signal SIG_AIM1;
 	set-signal-mask SIG_AIM1;

//turn the turret towards the target
	turn turret to y-axis heading speed <100.0>;
//we turn the barrel up / down while the turret turns around
	turn barrel to x-axis 0 - pitch speed <100.0>;

//Wait for the turret to finish turning around
 	wait-for-turn turret around y-axis;
//Wait for that barrel to aim upwards / downwards
 	wait-for-turn barrel around x-axis;
 //If we're ready to fire, start the timer on recovery.
 	start-script RestoreAfterDelay(); 
//FIRE!
 	return(TRUE);  
}


QueryWeapon1(piecenum)
{
//Where is our shot coming from?
	piecenum = firepoint;
	return(0);
}

Shot1()
{
//do cool FX or whatever here
}

FireWeapon1()
{
//you can also do cool FX or whatever here, but I prefer Shot()
}
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: models then what?

Post by FLOZi »

N.B. as Argh neglected to mention, that is BOS animation code
User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Re: models then what?

Post by oksnoop2 »

thanks for telling me it was BOS
User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Re: models then what?

Post by oksnoop2 »

..are there any lua examples?
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Re: models then what?

Post by SinbadEV »

you might need to post in the Lua forum
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: models then what?

Post by Argh »

I don't have any Lua examples written yet. Was kinda thinking FLOZi would, they (the S'44 team) has been in the forefront of using this new technology, I haven't had time to catch up yet.
User avatar
oksnoop2
Posts: 1207
Joined: 29 Aug 2009, 20:12

Re: models then what?

Post by oksnoop2 »

What directory of the mod would this animation code go in? And is it the same place for both lua and cob?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: models then what?

Post by Argh »

Both Lua and COB go into the scripts directory.
Post Reply

Return to “Game Development”