VStanced/mods
Submit a mod
Mods Guides Forum Submit a mod Log in Register

Forum

Questions, builds, help and the odd argument. The mods and guides are out front.

Notifications
Clear all

Amilmand WIP

526 Posts
57 Users
0 Reactions
282.9 K Views
amilmand
(@amilmand_18634)
Reputable Member
Joined: 11 years ago
Posts: 259
Topic starter  

It has been possible for quite some time from code (C#), with the sources I shared (LINK).

Its a lot of parameters though so I doubt I'll be able to be convinced to make a full UI :/ .



   
ReplyQuote
MikeShinodaSLR
(@mikeshinodaslr_20837)
Active Member
Joined: 11 years ago
Posts: 8
 

# adnan54 :
is it also possible to edit a mesh materials?

I did the program exactly for that purpose a while ago, but I'm too lazy to finish all that I want. Here's how it looks

amilmand, I also want to ask you some questions. First one is about your WalkMarker and TRCMarker tools, is it possible to make a spline to the vertex/mesh snap option like it is in 3ds max? Cause it is really hard to make traffic not flying over or under the road at the moment (or I just dumb and didn't find that option). Or even maybe create some sort of 3ds max spline export script into .trc/.walk format? And if creating the 3ds max script is real hardcore thing, I hope that doing a snap option isnt. Anyway, this is just a question, not a request (yet, haha 😃 ).

The second question is about your scx scale tool, after I saw it I got an idea for making an extended version with possibility of scaling the mesh by all 3 axes independently. I think I could make it by myself, but it will be easier for me if you share how exactly rescaling works. Or you could just share the sources (or even make that option by yourself 😃 ). Anyway, that's still just kind of a question.

And the third one is not about programming at all, you're really good at the SLRR internals, is there any way to make track meshes which will be shown regardless of the drawing distance. That would be very useful for long-distance decorations like mountains or cities, that usually made just as a texture.

Hope I don't ask you too much. Anyway thanks for your attention! 🙂



   
ReplyQuote
Bigg_Boss93
(@bigg_boss93_1370)
Member Admin
Joined: 15 years ago
Posts: 3835
 

The last one isnt really possible not because the game cant do it, as it can already just by using lod_amp etc on cfgs and rpk, but rather because the skybox is too small and unfortunately i have never managed scaling it up.

Even if i re-exported the skybox with 10x size, cutting pieces etc just to see if it worked and so, and it did, the game always scale it to the same exact size for some reason(some internal code? i havent really found anything related to it in javas)



   
ReplyQuote
amilmand
(@amilmand_18634)
Reputable Member
Joined: 11 years ago
Posts: 259
Topic starter  
MikeShinodaSLR wrote

to the vertex/mesh snap option like

Snapping the control points to vertices or faces of the track wont help, it is quite hard to approximate the shape of the track (as you also pointed out) even with unconstrained movement of the control points introducing a new limitation will make it even harder (even if it doesnt seem that way) (I mainly used the height of the control points to make the example trc passable, and minimize the number places where the cars were floating or intersecting the ground) and would probably lead to people making splines with an overwhelming amount of control points (as to make even the linear approximation feasible and disregard the curved nature of the spline) which would make it all but impossible to adjust the "density" of a spline and hence make the traffic travel the spline at a near constant velocity, which again must be done by hand.. (I researched the problem and confirmed my vague memories about splines (in particular BΓ©zier splines (but even curves) that arc length parameterization is not viable in the given context (would need a pre-transformation on the parameter which slrr doesnt use as far as I know) and the whole thing becomes a general iterative method on the given "length" parameters of the slrr spline construct with only a guess on the use of the params being optimised... frankly I dont want to deal with that)

Defining splines for the track after the fact (I'm pretty sure the basis-model of Valocity was generated in regards to the splines used as the trc data and not vice versa) is as easy as I could make it in reasonable time (generating the Navigator lanes, enforcing the constraints on continuity, generating adjacencies, translating the relations from indices and back and so on)

If however there is a way to save (continuous) splines of this kind (list of Cubic BΓ©zier curves) in any other program I would be alright with implementing a way to import these files (if the file structure is known)

MikeShinodaSLR wrote

scaling the mesh by all 3 axes [..] Or you could just share the sources

I would like to point you to the link mentioned just above (LINK) you are looking for the ScxV3Constructable and ScxV4Constructable classes after constructing one of those the problem becomes trivial, I would be glad if you or anyone else for that matter dove into the sources and utilised it, it has some great potential, and as battered as I am regarding modding slrr it would be good for some other people to start using a, I think well written enough, library to access and modify the data files of slrr.
But the source for the small dialog I added using the "model" linked is here for you, it is quite trivial really.
Spoiler:

public partial class ScaleMeshDialog : Form
{
	public ScaleMeshDialog()
	{
		InitializeComponent();
	}
	string lastOpenFileDialogDir = System.IO.Directory.GetCurrentDirectory();
	private void ctrlButtonSelectSCX_Click(object sender, EventArgs e)
	{
		Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
		dlg.InitialDirectory = lastOpenFileDialogDir;
		dlg.FileName = "";
		dlg.DefaultExt = ".scx";
		dlg.Filter = "SCXs|*.scx";

	Nullable<bool> result = dlg.ShowDialog();

	string curFnam = "";
	if (result == true)
	{
		curFnam = dlg.FileName;
		lastOpenFileDialogDir = System.IO.Path.GetDirectoryName(curFnam);
		ctrlTextBoxFnam.Text = curFnam;
	}
	else
	{
		return;
	}
}

private void ctrlButtonGo_Click(object sender, EventArgs e)
{
	float scale = 1.0f;
	try
	{
		scale = float.Parse(ctrlTextBoxScale.Text, System.Globalization.CultureInfo.InvariantCulture);
	}
	catch (Exception)
	{
		MessageBox.Show("Number not in proper format (" + ctrlTextBoxScale.Text + ")");
		return;
	}
	var scx = Scx.ConstructScx(ctrlTextBoxFnam.Text,true);
	if (scx.Version == 3)
	{
		var scx3 = new ScxV3Constructable(scx as ScxV3);
		foreach (var model in scx3.models)
		{
			foreach (var vert in model.VertexDatas)
			{
				vert.VertexCoordX *= scale;
				vert.VertexCoordY *= scale;
				vert.VertexCoordZ *= scale;
			}
		}
		scx3.SaveAs(ctrlTextBoxFnam.Text, true, "_BAK_SCALE_");
	}
	else if (scx.Version == 4)
	{
		var scx4 = new ScxV4Constructable(scx as ScxV4);
		foreach (var model in scx4.Meshes)
		{
			foreach (var vert in model.vertData.VertexDataList)
			{
				vert.position.X *= scale;
				vert.position.Y *= scale;
				vert.position.Z *= scale;
			}
		}
		scx4.WriteAllData(ctrlTextBoxFnam.Text, true, "_BAK_SCALE_");
	}
	MessageBox.Show("Done (" + ctrlTextBoxScale.Text + " : " + ctrlTextBoxFnam.Text + ")");
}
}
MikeShinodaSLR wrote

regardless of the drawing distance.

If you mean the ingame option I know for a fact that that is not possible from the rpk side of things, also there is a limit on the number of vertices that can be in a POLY entry in an rpk, but you can try and trick the spatial data structure of the rpk (floating an entry high up the hierarchy) to show the given POLY entry even when far away. Even then the draw distance will cut it though so the best you could do is construct a proper octree and bias some objects to be high in the hierarchy in the meantime setting the draw distance to a very high value and leaving the keeping of the number of objects rendered low to the spatial partitioning. But this is a complex problem (with the sources linked above it is possible but there are points in there which I'm not sure about so it would need experimentation)



   
ReplyQuote
MikeShinodaSLR
(@mikeshinodaslr_20837)
Active Member
Joined: 11 years ago
Posts: 8
 

amilmand, big thanks to you for that informative and really fast response! And also thanks to Bigg Boss93 for sharing his research too 🙂

Returning to the answer, I feel myself a bit dumb after all your explanation about splines, haha, so let me clear some things. At the moment we have a script that export splines (Bezier curves to be correct) from 3ds max into the .spl format SLRR use for race lines. So isn't it a way to make the process of creating traffic paths easier? Or the race lines are weakly correlated with them?

And wow, the solution of the mesh scaling is that simple! Seems I really didn't work on any programming-related stuff for a long time. Also I already used your work on SCX files for my Materials Editor, thank you for that. You right about the potential these sources have, so maybe I should start on utilizing them and creating some sort of documentation to make it easier for others. But I warn you - don't be optimistic on me 😃

>>If you mean the ingame option I know for a fact that that is not possible from the rpk side of things
Yeah, I hoped exactly for that. Cause I don't feel that I could do some kind of tool for tweaking scx or rpk structure. I know how hard it is and I don't get that much inspiration you have. So I think it's better for me to solve simpler but not less important tasks (like fixing car javas haha 😃 )

Thank you again for your answer and for all the work you doing on the game, this is really insane (in a good sense ofc 😃 ). And you actually inspire me to continue working on it too, but in less global form 🙂



   
ReplyQuote
amilmand
(@amilmand_18634)
Reputable Member
Joined: 11 years ago
Posts: 259
Topic starter  

Well good guess on the .spl format but no cigar unfortunately those lines define a "closed cubic Hermite spline"
Quote from LINK

The .spl file spline row format (%LF is float %d is int) is:
(%lf %lf %lf) (%lf %lf %lf) %lf %lf %d %lf %lf %d:
(pos XYZ), (normal XYZ), splineWidth, targetVelocity, I do not know the rest
the two ints are used as bools
the list of first two vectors define a closed cubic Hermite spline.

The main concern again is the "density" of the spline as the Hermite spline description (well this is of course a guess (that it defines a Hermite spline) but it "fits evidence") defines normals which are well... normalised (they need to be or the AI gets confused) so they really cant be straightforwardly converted to their .trc lane equivalent (and further complication is that while the AI follows a .spl spline its movement is subject to the physics engine, and the spline defined is more of a hint of the path to take and not a direct definition opposed to the .trc, I bring this up because the .spl-s I ran into in modded maps were in most cases grossly missaligned (from a .spl standpoint this doesnt matter as the physics engine helps and keeps the car on the ground and generally forces the car to move "believably")).

But 3dsmax uses BΓ©zier splines if you have a homebrowen solution to export those that might work (as far as I know the closest 3dsmax natively has that generates spline like data is the export to adobe illustrator but that doesnt help much I dont think)

MikeShinodaSLR wrote

some sort of documentation to make it easier for others.

The article (LINK) is a good starting point the code is mainly a direct implementation of that knowledge and some elaborate stuff in the GameFileManager (and the trc related file types but that is a bit more complicated than the rest and I think less hmm popular)

I always think its nice if someone shows love for such an old game so keep on modding 🙂
(if you have questions about the code or anything just ask 😉 )



   
ReplyQuote
MikeShinodaSLR
(@mikeshinodaslr_20837)
Active Member
Joined: 11 years ago
Posts: 8
 

That's not a problem to export splines from 3ds max into any binary or text data via maxscript. Here's for example Invictus' .spl export script
Spoiler:

/* ************************************************************************************ */
/* Developed by Invictus Games Ltd Hungary, (c) 2003-2004 Invictus Games                */
/* ************************************************************************************ */

clearListener()

convertToSplineShape $

txt = newScript()

function GetVec s k d =
(
	if (d==1) then
		return getOutVec $ s k
	else
		return getInVec $ s k
)

function outputKnot s k d =
(
	p = getKnotPoint $ s k
	v = GetVec s k d
	p /= 100.0
	v /= 100.0
	v -= p
	p = [p[1], p[3], -p[2]]
	v = [v[1], v[3], -v[2]]
	v /= length v
	format "% % %\t% % %\t%\n" p[1] p[2] p[3] v[1] v[2] v[3] 2.0 to:txt
)

if queryBox "Do you want to export in forward direction?\nYes=forward\nNo=backward" then
(
	for s = numSplines $ to 1 by -1 do
		for k = numKnots $ s to 1 by -1 do
			outputKnot s k -1
	outputKnot (numSplines $) (numKnots $ (numSplines $)) -1
)
else
(
	for s = 1 to numSplines $ do
		for k = 1 to numKnots $ s do
			outputKnot s k 1
	outputKnot 1 1 1
)

As you can see we can easily get every control point coordinates and both it's normal vectors too, all the maths here just converts 3ds max into SLRR coordinates system, but other things were done by standard maxscript methods. We also can parse for example lines' names for additional data like speed, turn type etc. Is that data enough to create not .trc, but at least some intermediate file for importing into your tool? Cause I could try to do some kind of export script when I got the time 🙂

Yeah, I red that article, when you published it I realized that we have a lot more possibilities for modding this game. And it still is really useful 🙂 But I think that C# sources could get a bit more love so they started to look more like actual API. Hope to do that in some future, but can't promise 😃

As for me SLRR is the unique racing game for modding because of scripting possibilities (can also name MTA here but I guess that's all), so yeah, still can't quit playing with it since all these years. And that's really great that you opened a new modding level for all of us.

And little P.S. I'm not the one who interested in .trc files, after seeing the traffic on Alps my mate got an idea to create another city for the game (and we actually did the prototype with races and stuff) but it is really hard to make proper traffic paths yet, cause we both more familiar with 3ds max



   
ReplyQuote
dowdow
(@dowdow_384)
Estimable Member
Joined: 16 years ago
Posts: 206
 

Hi 🙂 Amilmand, i have a question about chrome, how to improve the chrome shine of this wheels for exemple ? Thanks 🙂



   
ReplyQuote
amilmand
(@amilmand_18634)
Reputable Member
Joined: 11 years ago
Posts: 259
Topic starter  
MikeShinodaSLR wrote

intermediate file for importing into your tool

I've become quite busy lately I probably wont have time in the foreseeable future to make this happen the best I can do is release the source of the tools as is if you want to explore or extend it (or anyone). LINK

dowdow wrote

improve the chrome shine

Thats quite broad and subjective 😛 I think they look fine.
I could only provide technical details or something like that, this pic doesnt seem to use reshade but who knows nowadays with everybody and their config.
Reshade does have a quirk with the DisableReflectionsOnSecondLayer=1 set, naturally the second layer will have its reflection toned down if not disabled outright, other than that 🙂 I dont know
(My opinion on what is "nice" has been seen to differ quite a bit from people usually expressing their opinion on these forums so in general I'm probably not the best to ask about aesthetics 😃 I mean.. I think this is a nice pic:
Spoiler:

)



   
ReplyQuote
dowdow
(@dowdow_384)
Estimable Member
Joined: 16 years ago
Posts: 206
 

Thanks for the tip bro ! yeah i always try to do a best reshade setup to get the game a little more real
On the pic i use reshade but only 5 - 6 filters..i must take time to tune all parameters.

In fact, i'm trying to get something like i had on my previous enb 😃

BTW, i love bump options



   
ReplyQuote
MikeShinodaSLR
(@mikeshinodaslr_20837)
Active Member
Joined: 11 years ago
Posts: 8
 

# amilmand :
I've become quite busy lately

Yeah, same thing here. And thanks a lot for the sources! I'll take a look at them for sure, hope will do 3ds max spline to .trc export script someday. Anyway, if I'll get any progress I'll let you know 🙂



   
ReplyQuote
Holy_Shit_Man
(@holy_shit_man_3240)
Member Moderator
Joined: 14 years ago
Posts: 2251
 

# dowdow :
Thanks for the tip bro ! yeah i always try to do a best reshade setup to get the game a little more real
On the pic i use reshade but only 5 - 6 filters..i must take time to tune all parameters.

In fact, i'm trying to get something like i had on my previous enb 😃

But you know it depends on material settings of each part though? So for example my wheels use materials that are set the best for vanilla graphics (or any as long as they don't affect the materials) and they may look bad if you use ReShade



   
ReplyQuote
dowdow
(@dowdow_384)
Estimable Member
Joined: 16 years ago
Posts: 206
 

# Alan Smithee :
But you know it depends on material settings of each part though? So for example my wheels use materials that are set the best for vanilla graphics (or any as long as they don't affect the materials) and they may look bad if you use ReShade

Yep you're right, i've seen that after test other parts with different chrome textures



   
ReplyQuote
RedCarDriver
(@redcardriver_1155)
Member Moderator
Joined: 15 years ago
Posts: 1125
 

Hey Amilmand, sorry to bother you, but I had a question: do you know how to get the car's current flags? I've tried both getFlags(); and (int)the_car.getIndexedData(Chassis.IndexedData_Flags); and neither worked.

Also, is it possible to check whether or not ExhaustiveBits (or, really, any one individual Java method) exists, without crashing the game if it doesn't? I want to write some mod scripts that will use the ExhaustiveBits flags, but I don't want to crash other people's game if ExhaustiveBits is not installed.

Thanks in advance!



   
ReplyQuote
amilmand
(@amilmand_18634)
Reputable Member
Joined: 11 years ago
Posts: 259
Topic starter  

Almost there but as you found out (judging by the static cast to int) this function returns a float soo its no good for you the full call would be to get the address of the value and decode it as an int:

RawEdit.getI(the_car.getIndexedAddr(Chassis.IndexedData_Flags));

The clues would have been: LINK
And the comments in the chassis.java:

public static final int IndexedData_GearNumber = 0x20FC-0x304;
   //this is an int getIndexedData will return
     strange but the RawEdit.getI with getIndexedAddr will suffice
public static final int IndexedData_Flags = 0x70;//int

I dont know what your goal is with the flags but I found that access to this value is of a readonly manner as most of the flags the game updates each frame and invalidates any changes you try to force (though you can get interesting state indicators so to say, (whether the blinker is on, is the car running and some others)

As for checking function availability, you cant read arbitrary data from files so the actual function name is problematic but you can check for files present, ExhaustiveBits depends on the RawEdit class so you could check for

File.exsits("system\\Scripts\\lang\\RawEdit.class");

as a reasonable indicator, still if the game is not run with the Slrr_GI.exe you are hooped :/ I haven't made a way to detect that.
But there is no general check in the default game you can make to decide whether a function name is valid or not (or I dont know about it).

If I'm already writing I'll mention that I found a way to detect whether the car is flying or not (to be more precise I found a value in the WheelRef instance that is usually close to 0.0 when the car is in the air (it reports 0 if the game disables collision on the car (by the suspend command for example) it can also happen when the car is not moving so there is a constraint on it but its not that bad) :

WheelRef whl;
float sumPressure = 0.0;
for(int whl_i = 0; whl_i != 4; whl_i++)
{
	whl = player.car.chassis.getWheel(whl_i);
	float toad = RawEdit.getF(whl.ptr+344);
	if(toad < 0)
		toad *= -1.0;
	sumPressure += toad;
}
if(sumPressure <= 0.001)
{
	//player car is probably flying...
	Vector3 carVel = player.car.getVel();
	carVel.y = 0;
	if(carVel.length() > 5)
	{
		//player car is most probably flying...
	}
}


   
ReplyQuote
Page 32 / 36
Share: