News:

Herr Otto Partz says you're all nothing but pipsqueaks!

Main Menu

New mod: extended line of sight

Started by HerrNove, January 27, 2025, 01:47:06 AM

Previous topic - Next topic

HerrNove

@Duplode if you can update the IDA database, here are the global names I changed in my code:

byte_3C09C --> detail_threshold_by_level
off_3C084 --> tiles_to_draw_offsets_tables
timertestflag2 --> detail_level
transformed_shape_op_helper2 --> projectiondata9_times_ratio
transformed_shape_op_helper3 --> is_facing_camera
transformed_shape_op_helper --> insert_newest_poly_in_word_40ED6
word_40ED6 --> poly_linked_list_40ED6

HerrNove

Hey, turns out that Plan 3 was easy to implement! This version in attachment is not perfect but seems playable. It tries to draw its 10x11 rectangle of tiles, if there are too many polygons it discards the whole scene and recalculates it with a narrower field. It is horribly inefficient – on a complex ZCT track you'll need a 486 :-) , or crank up your DOSBox cycles – but it is quite playable.

I'll try to devise better methods if I find the time. For now, hope you'll enjoy this version!

HerrNove

And here a small further improvement (better tile prioritization)

Matei

Unlike I tested it the first time, now I tried with other cars and most often it worked. A Pentium 4 at 3.4 GHz is of course not fast enough...

https://github.com/libsdl-org/sdl12-compat/

Btw, I have solved the engine to load any number of tiles (even all of them if you want), no graphical problems at all and it runs well even in the above conditions, but no one is interested... (Cas helped a little)

Duplode

The view from ZCT275's high jump  8)



Quote from: HerrOtto on January 29, 2025, 12:13:14 PM@Duplode if you can update the IDA database, here are the global names I changed in my code:

Not sure when I'll manage to get back to properly doing Restunts work (I'll try to make some time for that in the upcoming month!), but we'll surely want to keep such notes well-preserved. A cluster of pages in the Wiki could make sense...

HerrNove

#20
This is my latest version, where I tried to do some minimal optimizations. It works well most of the time. Unfortunately, sometimes the tiles near the car still disappear, so it's not really ready for competitive use. I don't know what is the source of the problem but I'm running out of time, so I think this is the best I can do for now.

I investigated the possibility of extending the max # of polygons, but after a long debug session I had to find out that the bugs were due to the exhaustion of the memory (the stack would grow to the point of overwriting the globals – bad things ensued and it cost me a huge amount of time to find out the error). Extending the max polygons would still be possible, I think, if we managed to  allocate a dedicated memory segment for polyinfoptrs. But it would be a huge project and the success would not be guaranteed.

I'll be writing some documentation in the next days, meanwhile I'd appreciate your impressions about whether this version is of your liking.

HerrNove

We are making progress, pipsqueaks! I managed to find the source of the failures and obtained a version that, I daresay, plays very comfortably. I did not have much time to test it but run ZCT282 a couple of times and did not see the tiles around me disappearing.

I will open a thread in Stunts Modification Projects and leave this to the technical discussion. I still want to tune a couple of details, but this is already a version worth playing for pleasure and not only for testing. Let me know your impressions and, if you can, try to test with other tracks (I fiddled with some multi-tile code, so I wonder how the engine behaves with illusion tracks).

Note: the number no top left shows the number of tiles discarded when the scene is too complex. You may ignore it, but it's useful to me for debugging (and demonstrates a simple way to print arbitrary infos while playing)

Cas

Hey!  This is really great!  You can do a lot of progress in a little time!  I also tried (and gave up, in my case) to set up the toolchain in Linux, so Daniel3D has been doing the compiling and helping finding code, testing and analysing during my experiments, but this is a higher level than what we achieved.

I've been thinking, regarding Stunts mods, that more efficient results could be obtained by branching out the mod code and using a lightly modded Restunts as a hub. That way, we can write modes directly in separate files and a little piece of code connects them to Stunts and you can plug them and unplug them freely and independently. Same way, if you have access to all polygon data, you don't need to be limited by Stunts: you could write a simple renderer and redirect it. But anyway, it looks great to have it all in a DOS Stunts binary!

A non-important detail: in the first binaries you shared, I could add "/ssb" and it went on with SoundBlaster, but the latter ones always sound like PC Speaker. Is there a reason for it?
Earth is my country. Science is my religion.

HerrNove

> A non-important detail: in the first binaries you shared, I could add "/ssb" and it went on with SoundBlaster, but the latter ones always sound like PC Speaker. Is there a reason for it?

Thanks for noticing that. The first binaries are the original Stunts executable where I hand edited the tiles; the others are instead built with the Restunts toolchain. As far as I understand, Restunts should support sound cards quite fine, so I'll investigate why it does not work.

Concerning your idea of combining mods: my plan is to commit general improvements (variable labeling and comments) to the main master branch and then compact the real mod in just one commit. This way one can combine it into any other mod via a `git cherry-pick` command.

> I also tried to set up the toolchain in Linux

Took me a lot but the solution is dead simple :-) Just

* install Wine (but I guess you already have it)
* mount the restunts dir as drive S using winecfg
* in the Linux console type wineconsole cmd* in the resulting Wine console type (mind the inverted slashes and the lack of tab completion):
s:
cd src\restunts
..\..\tools\setpath

And then just type make every time you want to build your changes.

I made some tiny modifications to the build files in my branch but it should work also with the version currently in master. If not, let me know, I can send you the diff I used (basically just suppressed all the pop up windows)

HerrNove

Investigated: it's a bug in Restunts, will submit a fix for that. Good catch!

Duplode

Quote from: HerrNove on January 31, 2025, 08:44:41 PM* install Wine (but I guess you already have it)

Wine!! I had pretty much forgotten it existed, and so had overlooked the possibility. I'm definitely trying this later! (While I have a Windows install around, switching systems just for running the toolchain is a bit of a hassle.)

Cas

Oh, I do have Wine installed now because I needed it to compile the Windows port of Pretty Garage, but I normally don't use it for anything else. I could try this.

My idea is to actually circumvent the tool chain completely by making a single base mod. Then the actual hub I was mentioning would be an external assembly binary that would load the mods and the mods themselves could also be written in something more comfortable, such as Flat Assembler, so no need to touch the main code any more and mods could be plugged and unplugged hot, without recompilation. But what you're doing is more like the original spirit of the Restunts project, I think.

I'm also planning to make a mod to report the car coordinates and other data to a file during the game loop in every frame and then pick this up with my engine and send it to a small server, so that we can play live in network and actually see other pipsqueaks. Shouldn't be very hard. Only thing I don't have is something to draw wheels, ha, ha.
Earth is my country. Science is my religion.

HerrNove

Audio fixed and mod baptised :) I opened a thread in the Mods section: https://forum.stunts.hu/index.php?topic=4404.0

But we can further discuss here about the more technical points. Your plan seems very interesting, I have not the skills to implement it myself but I'm totally willing to make my plugin compatible with your hot-plug framework when you when you find the time to create the infrastructure.

llm

#28
nice project  :o

Quote from: HerrNove on January 27, 2025, 11:17:58 PM* The renames of the global variables must be performed on the asm code too. I could do it easily with a search-and-replace but it is my understanding that the asm files are somehow generated by IDA Pro, so the clean thing to do would be to update the IDA database. Do you know how the process works?

i helped starting the restunts project (but mainly driven by users clvn/dstien) - i wrote the drvcombiner tool in the src folder

IDA process is: changing the names in IDA + running the src/idc/anders.idc script from IDA - that generates the complete asm code

problem with IDA is: we used the commercial version of IDA in the beginning and everyone needs to have the same IDA version user with older or freeware versions are not able to open the IDA file

i always wanted to change the assembler from Turbo Assembler to UASM or WASM and using a recent linker like WLINK or ULINK - so multi/cross platform builds are esier doable - but never found the time

Cas

Definitely, the greatest advancement in modding of the actual code for a long time. Will deserve a Wiki article.

How did you do about paragraph alignment?  When I worked with Daniel3D on the needle colour mod, we had to test several times and add padding NOPs to prevent glitches.
Earth is my country. Science is my religion.