Forum Jump :

Author Message


Posts: 15
Rank:


Level: Member

Country: us
Location: California
Occupation: Pyrodyne
Age:
In-game name:

 
#1 Posted at 2009-12-10 15:54        
     


v0.2 beta is complete, with the following features:

* No addons
* Vanilla cars are faster
* All cars are less affected by slowdowns over gravel/grass
* Vehicle brakes actually work
* High visibility turn signs
* Lightweight download
* Portable scripts

Done!:
* More visible "turn ahead" signs. The BIS vanilla signs are too small to really see properly at high speeds.
* Repair script - fix flats - this won't help if you hit something hard enough to blow your car up and set it on fire, but in those cases you will be too dead to care about it. The repair should take some amount of time in order to encourage cautious driving through blind curvy mountain roads.
* Insert timing script that can track completed races
* Set trigger points to keep cars from offroading or bypassing checkpoints
* Convert to multiplayer - testing and HELP needed!


TODO:

* Modify timing script to assign points on race end - didn't get this one done yet... next patch will have this complete.


Release Note:
I give full permission for any and all to use the scripts included with this mission. I would like to see faster cars all around, in racing or in combat. With decent brakes.

This post was edited by Pyrodyne (2009-12-19 06:46, ago)


Author Message


Posts: 20732
Rank:


Level: Super Admin

Country: nl
Location: The Netherlands
Occupation:
Age: 45
In-game name: Foxhound

 
#2 Posted at 2009-12-10 16:18        
     
Sounds like a fun idea, I can remember someone else tried to make some kind of racing event a while back.

As for the sign's, cant you use the recently released GLT sign's pack? You say "no addons" in your feature list but if you make your own it will always be an addon so why not use whats already available if its not something you can do yourself?

Just an idea ;)


Advertisement


Author Message


Posts: 15
Rank:


Level: Member

Country: us
Location: California
Occupation: Pyrodyne
Age:
In-game name:

 
#3 Posted at 2009-12-11 04:39        
     
I did make an autocross track which serves as a good teaching tool on how A2 vehicles handle, serves as a race-against-yourself mission.

Those signs certainly look big enough in the screenshot. I would like to keep the mission as addon-free as possible, though I believe I can pack addons with the mission?

The download size for those signs is a little on the heavy side, 16MB. I just wanted something a little bigger than "Land_arrows_desk_L(R)". Any speed in excess of 100kmh, and you really can't see the BIS arrows. The puny turn signs are worse off and are hardly visible at any speed from within the car.

It looks like I could possibly cherry pick just one sign out and load one or two textures for it, if that's ok with Myke. That would still raise the size of my mission considerably, but not nearly as bad as 16MB. I'm not really sure how to load textures from within the editor yet, either. They didn't teach the useful things in C++ class...


Author Message

Dead3yez  

I am evil


Posts: 3113
Rank:


Level: Member

Country: en
Location: North Yorkshire
Occupation: dead3yez
Age: 31
In-game name: dead3yez

 
#4 Posted at 2009-12-11 04:57        
     
May I ask how you manage to set the velocity to 300km/h, or if this controllable; are you able to control the acceleration and deceleration without any conflicts?

I made some scripts not long ago to help improve and add new features to car performance, the ones that are released are really an alpha version, I couldn't find a way to work around 200km/h without making it controlled and 250km/h uncontrolled speed.


Author Message


Posts: 15
Rank:


Level: Member

Country: us
Location: California
Occupation: Pyrodyne
Age:
In-game name:

 
#5 Posted at 2009-12-11 06:44        
     
That code is actually pretty simple. I used some authorless snippet I found somewhere while I was on the hunt to make cars faster in general and found a juicy morsel. Basically you setup your init.sqf to call on event handler "keydown", and in your script, run checks for if you're in a vehicle or not (unless you want to turbo your running speed... hmm a seaside marathon on steroids..?!) Actually now that I think of it, I want to give that a go ;)

So anyways, back on topic, you get the current velocity and then set it with a multiplier. So while you are in motion with the "W" key, it multiplies the current speed every time the script is triggered. It isn't so hot on motorcycles and bicycles, though. They tend to go really insanely fast and crash into something. I was able to launch my dead body, post-crash, completely across Utes and plop into the ocean somewhere. Really unmanageable.

I can post the full script, but i'm sure it needs some fine tuning. One thing it is really missing is the other side... brakes. The stock A2 brakes are FAR too weak when your vehicle reaches +200kmh.

A really simple trick you can do is use a config.cpp to tweak vehicles, and this is what I tried initially. I found that if you trick the terrain coefficient to negative, you would achieve really great acceleration and top speed on dirt, but mediocre performance on roads. Tweak it too far and the car just does a wheelie and drives really slow. I think I nuked the file i had with that, since it was a huge pain in the rear and could only be applied to one car at a time.

At any rate, i'm sure you're slavering at the bit for a decent set of "go fast" scripts, so i'll go ahead and post the meager code I have thus far:

init.sqf:
onKeyPress = compile preprocessFile "onKeyPress.sqf";
waituntil {!(IsNull (findDisplay 46))};
(findDisplay 46) displaySetEventHandler ["KeyDown", "_this call onKeyPress"];

onKeyPress.sqf:
private["_veh","_spd","_nrmMult","_sftMult","_grav"];
_pressed     = _this select 1;
_nrmMult = 1.005; //speed multiplier with just "W" pressed
_sftMult = 1.009; //speed multiplier with Shift+"W" pressed
_grav = 0.99;

switch _pressed do

{
	//W Key
	case 17: 
	{

		_veh = vehicle player;

		if(_veh == player) exitwith {};

		if(isEngineOn _veh) then
		{
		
			_spd = speed _veh;
			_velo = velocity _veh;
			_veh setVelocity [(_velo select 0) * _nrmMult, 
			(_velo select 1) * _nrmMult, (_velo select 2) * _grav];
		};
	};

	//Left Shift key
	case 42: 
	{

		_veh = vehicle player;

		if(_veh == player) exitwith {};

		if(isEngineOn _veh) then
		{
		
			_spd  = speed _veh;
			_velo  = velocity _veh;
			_veh setVelocity [(_velo select 0) * _sftMult, 
			(_velo select 1) * _sftMult, (_velo select 2) * _grav];
		};

	};
	false; //Ensure keypress isn't stopped here
};

I take little to no credit for this code, I merely found it while browsing and shined it up a little.
The code really speaks for itself, modify the top two variables and it adjusts the speed.


Author Message

Dead3yez  

I am evil


Posts: 3113
Rank:


Level: Member

Country: en
Location: North Yorkshire
Occupation: dead3yez
Age: 31
In-game name: dead3yez

 
#6 Posted at 2009-12-11 07:00        
     
Ah, OK. I think the problem is that I calculated the acceleration and not whether a key was pressed, and values somewhat became messed up a little when a cerain speed was reached.

On a side note, I have a suggestion that you could probably use something like inputAction to avoid problems for some who may have different bindings etc.


Author Message


Posts: 15
Rank:


Level: Member

Country: us
Location: California
Occupation: Pyrodyne
Age:
In-game name:

 
#7 Posted at 2009-12-11 07:10        
     
Wow thanks for that link! That will be easier than looking up keyboard codes. I'm going to go ahead and rewrite some of the script, I think with that I can get the braking done too.

I was able to use the "Danger" sign from vanilla objects and use setObjectTexture to put a very rough yellow and black left and right arrow on. It is definitely more visible than the other objects. Now I just have to redo all the signage. I also noticed that I had the signs lumped up too close to the turns to be useful even if visible. Coming into a sharp 90 turn it quickly turned into a pile of burning wreckage and a red view of the steering wheel all too often. The new signs, and more of them spread out further appears to do the trick.

How is the performance hit of using a bunch of editor placed objects all with setObjectTexture used on them? I made a quick and dirty 512x512 png, but the conversion made it behave odd, remade it as a jpg and it seems to look proper now. The black stripe would fade with a very short distance and the sign would still be the same bright yellow.


Author Message


Posts: 20732
Rank:


Level: Super Admin

Country: nl
Location: The Netherlands
Occupation:
Age: 45
In-game name: Foxhound

 
#8 Posted at 2009-12-11 08:21        
     
Pyrodyne : Those signs certainly look big enough in the screenshot. I would like to keep the mission as addon-free as possible, though I believe I can pack addons with the mission?

Well you can pack addons with your mission release but its not adviced. It will create bigger sized mission archive while downloaders of that mission may already have installed the addon anyway.
Also in MP it wont help as only the mission will be downloaded, not the addons. So people who do not have the addon but connect to a server running the mission will be told they cant connect for not having the addon. So they will have to go out and search for it.


The download size for those signs is a little on the heavy side, 16MB. It looks like I could possibly cherry pick just one sign out and load one or two textures for it, if that's ok with Myke. That would still raise the size of my mission considerably, but not nearly as bad as 16MB.

Just contact Myke and ask for permission however, I still do not see how this will fix the main issue since people who do not have the addon in MP will have to download it themselves. You can not distribute addons within the mission.pbo (which you download from the server when connecting in MP).


Author Message


Posts: 15
Rank:


Level: Member

Country: us
Location: California
Occupation: Pyrodyne
Age:
In-game name:

 
#9 Posted at 2009-12-11 08:31        
     
You can not distribute addons within the mission.pbo (which you download from the server when connecting in MP).

What about textures? I did manage to simply alter a texture on the BIS "Danger" sign (has the radiation tri-foil on it). It is loaded with setObjectTexture in the object's init. I made two textures, left.pac and right.pac. They load OK how I have it now, the *.pac is simply dumped in the mission folder.

I was able to use inputAction for the speedup script, so people can use their own keys. This came at a cost. For some reason, I had to re-tweak the multipliers to get the same speed results. I imagine that it is due to a higher cost script, so it loses a bit of it's fight to keep the speed higher. Now working on braking... possibly even turbo reverse!


Author Message

Dead3yez  

I am evil


Posts: 3113
Rank:


Level: Member

Country: en
Location: North Yorkshire
Occupation: dead3yez
Age: 31
In-game name: dead3yez

 
#10 Posted at 2009-12-11 08:46        
     
Perhaps you could create a collage of black and yellow danger signs? :D

[edit]
Yes you can distribute textures. Just not addons, as they need to be loaded and processed at startup of the game.


Author Message


Posts: 15
Rank:


Level: Member

Country: us
Location: California
Occupation: Pyrodyne
Age:
In-game name:

 
#11 Posted at 2009-12-11 08:50        
     
I could just dump a few hundred onto the road before the turns.... they might get the hint that way :brik

Revised code follows, with all-around good feeling controller support. AND BRAKES THAT WORK.

onKeypress.sqf:
private["_veh","_spd","_nrmMult","_sftMult","_rvrMult","_fast","_grav","_shiftPressed"];

_pressed     = _this select 1;
_shiftPressed = _this select 2;

_nrmMult = 1.01; // speed multiplier for normal speed
_sftMult = 1.05; // speed multiplier for fast speed
_rvrMult = 0.95; // speed multiplier for braking
_grav = 0.99;    // gravity multiplier
fast = 0;

if(_pressed in (actionKeys "CarForward")) then
{

	_veh = vehicle player;

	if(_veh == player) exitwith {};

	if(isEngineOn _veh) then
	{
		
		_spd = speed _veh;
		_velo = velocity _veh;

		//crappy hack to include shift+forward - CarFastForward ignored shift+W
		if(_shiftPressed) then {
			_veh setVelocity [(_velo select 0) * _sftMult, 
			(_velo select 1) * _sftMult, (_velo select 2) * _grav];
			_fast = 1;
		} else {
			_veh setVelocity [(_velo select 0) * _nrmMult, 
			(_velo select 1) * _nrmMult, (_velo select 2) * _grav];
		};
	};
};


//Car Fast Forward
if(_pressed in (actionKeys "CarFastForward")) then
{

	_veh = vehicle player;

	if(_veh == player) exitwith {};

	if(_fast) exitwith {};

	if(isEngineOn _veh) then
	{

		_spd  = speed _veh;
		_velo  = velocity _veh;
		_veh setVelocity [(_velo select 0) * _sftMult, 
		(_velo select 1) * _sftMult, (_velo select 2) * _grav];
	};

};


//Car Reverse
if(_pressed in (actionKeys "CarBack")) then
{

	_veh = vehicle player;

	if(_veh == player) exitwith {};

	if(isEngineOn _veh) then
	{

		_spd  = speed _veh;
		if(_spd > 0) then
		{
			_velo  = velocity _veh;
			_veh setVelocity [(_velo select 0) * _rvrMult, 
			(_velo select 1) * _rvrMult, (_velo select 2) * _grav];
		} else {
			_velo  = velocity _veh;
			_veh setVelocity [(_velo select 0) * _sftMult, 
			(_velo select 1) * _sftMult, (_velo select 2) * _grav];
		};
	};

};

false; //Ensure no further code is executed for this control


Edit:
Ok, i'm definitely getting giddy from sleep sleep deprivation. I managd managed to get a Skoda up to 500kmh and I think I hit a rock and it rolled about 20 times, can't stop laughing now...

Can't spell at all anymore, or form coherent sentences for that matter.

Update:
Turn signage is complete. Some of the more bumpy roads may result in car launching, so I might add an exclamation mark sign near those points, not too bad except for a couple spots though.

Update:
Completed a basic repair script.

Update:
Ported timing script from my autocross map.
Created a set of waypoints and triggered timing script with the waypoints. Currently will only show you the time of your run.
Scrapped idea to use voice cues for turns, signs suffice.

Current Status:
Need help to get this mission ready for prime time. I am not 100% sure that using waypoints is the best way to restrict player movement to the track. I couldn't find a way to use the same set of waypoints for each player, and setting them up in the same group I think would defeat the waypoints used as triggers. If waypoints need to be recreated for each player and scripts attached, it can be done but it's about 43 waypoints... I could probably just edit the sqm to pile those in if it comes to that. If I can get this working soon, i'll be planning on hosting an online alpha, probably 2-4 players, for tomorrow.

Since you are given plenty of opportunities to crash at high speed, even though you can repair the car, this action does not heal you and i noticed a tendency to die too frequently. The track has to be taken far too slow otherwise you die after typically the third non-major crash. So i'm going to put in for the driver to be healed as the car is repaired.

This post was edited by Pyrodyne (2009-12-12 17:39, ago)


Author Message

Aqu  



Posts: 16
Rank:


Level: Member

Country: fi
Location: getPos Aqu
Occupation:
Age:
In-game name:

 
#12 Posted at 2009-12-14 00:42        
     
I made this sort of thing in Arma. Racing around various tracks in Sahrani (with or without normal traffic).

In principle it was like the script you use, except the speed was limited to realistic value (something around 250 kph). I also tryed to make it behave in other sense like a real car (accelerates slower in higher speed etc).

There were two reasons why I lost interest a bit. 1) It was quite hard to make the car behave relistically. One problem was how to know what wheels are on ground and what in air. Also knowing on what surface the tyres were 2) In MP it seemed that on somebody's computer the same car could be just slightly faster killing the idea somewhat (probably due to slight differences in the game speed and how fast it runs the scripts even with sleep).

To make your system behave better you could first make the car accelerate to the direction of the nose rather than where it is moving currently (even that is not exactly correct but prolly good enough for this game)


Author Message


Posts: 15
Rank:


Level: Member

Country: us
Location: California
Occupation: Pyrodyne
Age:
In-game name:

 
#13 Posted at 2009-12-14 05:59        
     
Hmm well how it currently sits, the cars were mellowed a bit, they can still reach insane speeds though. I give full permission for anyone to re-edit this to be more realistic, but it's general purpose as I can create it is ridiculous fun and a track to try to complete without crashing the car and becoming a huge fireball. Note also that the car can accelerate in mid-air! I didn't put the original script together, as well but now that you mention it, it should accelerate to the front rather than the current direction. That might be more complex, and the script rather relies on running lean and fast. Just adding different checks required tweaking the multipliers up to get the same boost effect out of them.

Although Dead3yez and myself gave this a go on multiplayer, I really didn't notice that there was a massive difference in speed other than whoever could actually keep the car on the track seemed to do better. Since I go in for twisty slippery tracks, raw speed really isn't a major factor for this mission. See the first half of the alpha video.. death is common on one section of the track, simply due to the tight turns and ample debris it is difficult to drive at full speed without losing control and crashing.

I do have a feature request open on the A2 community tracker that could help do away with alot of the scripting, as I requested uncapping the maximum speed in the configs. http://dev-heaven.net/issues/show/6040 Having this completed would obviate the need for scripting hacks, as a simple config.cpp would have all the values to get faster cars. I also put in for removing or nerfing the turn-brake, or slowing the car down when the steering is at an extreme. If BIS can do these things, we won't have to worry about such things as someone has more FPS than you and so gets the speed boost more often etc etc..

Given the current acceleration script, the car rather acts like a 4WD and considering it is a rally mission it's easier to pretend that is indeed the case. I'm not sure that the script i'm working with could really be applied to realism too much. I got the car accelerating in the right direction, thanks for pointing this out! It can still accelerate in midair though. Still working on that one...

Update:
Completed waypoints and timing scripting for all four players.

Known bug leftover: If AI is left in control, it will slowly plod through the track. I could use a way to check if the driver is AI or player and tell AI to go climb a tree.

Remaining TODO before release (almost there!):
During testing with Dead3yes, it was really apparent that there would be deadly crashes throughout many of the rougher points, regardless if you were trying to be careful or not. Respawn points were suggested, and these need to make it in before the release.

Note: Manually placing all of those waypoints for each player is a bit of a pain, I need to see about finding a better way so that rally missions can be created with just a little effort instead of a huge massive effort.

Update Again!:
Found ability to disable AI for MP missions in description.ext. AI will only be present in editor, etc.
Also found workable respawn. If you manage to destroy the car it will respawn with you. If you only damaged it, you will need to repair it. I need to find a way to also repair the car on respawn so that you aren't penalized twice for a total of 40 seconds to respawn from death and then repair the car.

Another problem that cropped up was that if you merely roll the cars onto the side, you are effectively stuck. I recall seeing a script someone made to flip the car back onto it's wheels, i'll have to hunt that down next. I found during further testing that the repair script was missing on respawned cars. I fixed that problem, however can't get the car to flip back over reliably. Instead, you must suicide, and the same repair/death/etc penalty is exacted.

Since this is as far as I wanted to take it for the moment, I am going to wrap it up and release the public beta.

Public Beta Test:
Well it looks like the bugs aren't fully worked out. When are they ever? Had a great time with a fellow from France, and we had lots of fun even though we couldn't really communicate well.

1) respawning with a flipped car doesn't always work. Will have to use car abandonment method provided for in simple vehicle respawn script.
2) Need to retune vehicle respawn speed, as it takes a while for the inits to kick in and let you back in the car.
3) There currently is no reset for disconnected players, so others joining in may have a broken, rolled vehicle possibly in the middle of nowhere. Will need to reset timers too.
4) Time announcement needs minor edit, shows everyone "You finished with time....", need to use player's name for this announcement.
5) Complete time comparison and scoring, or make method to simply store a continual list of times and drop the scoreboard. I did note that players are rather volatile, popping in and out at all moments in time. If they actually finish the race, they could get their score posted.
6) Maybe add time score saving to file for a goopy yummy bit.
7) Reset players that completed the race so they aren't tempted to turn about and play chicken with the other racers!

Best time update:
New best time is 502.324 seconds - 8.5 minutes - 1 crash requiring repairs to continue, multiple minor crashes.
1.05 handling improvements beat out the initial beta improvements, and you can actually keep the cars on the track!
Also noted - maximum speed dropped to about 230km/h, so it looks like BIS is doing more in frame 49... probably related to the handling improvements. I believe I will leave the speed script as-is, as the handling is manageable at this point.

This post was edited by Pyrodyne (2009-12-23 03:47, ago)