News:

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

Main Menu

Recent posts

#61
Stunts Reverse Engineering / Re: Restunts repository - Git ...
Last post by dstien - October 11, 2025, 03:22:42 PM
Quote from: llm on October 10, 2025, 02:00:01 PMax seems to be undefined if x and y = 0 in the asm routine

so the question is: does Stunts rely on this "random" behavior? and if - how to fake it in C?

clvn implemented this by just doing return result; before assigning any value to result. Since this type of randomness isn't portable, I did some (probably too brief) testing and determined that AX is always 0 in the game in these situations. But now that you brought it up I started wondering whether the case could be otherwise in certain circumstances. If I recall correctly, Stunts have a type of bug where a replay can't be fast-forwarded, because the simulation outcome is different than when it's played through, indicating that there's undefined behaviour that changes when the graphics code is involved. I did a repldump batch run on 100s of replays from the Zak Stunts archive, and it turns out that atan(0/0) happens frequently. But every occurrence that I tested in-game has AX=0, for example for @Duplode on ZCT289:

(The replay controls aren't redrawn on every frame, so printf debugging kinda works.)

Does anyone remember some particular replays that has the "can't fast-forward" bug? If not, I guess we should be able to find them automatically. All competition replays are supposed to finish successfully, while a bugged run would either crash or never cross the finish line in repldump.

Edit: Found a bunch of files don't register as finished in the last frame, but the only one I have confirmed with this behaviour so far is zct244/02-ROT.RPL. Haven't found any connection to atan(0/0) though. Looks like hitting water ends the joyride in the pure analysis, while the playback let the car continue straight over the surface.
#62
Stunts Reverse Engineering / Re: Restunts repository - Git ...
Last post by Matei - October 11, 2025, 03:11:12 PM
I always want the source code to compile it myself, so that single exe without dependencies, which has a lot of dependencies, is not very useful for me.

https://drv.nu/freebasic/building/freebsd/

Besides, I already used BASIC (for ZX Spectrum) and Pascal, so I know what we're referring to. Example:

https://matei.one/oprog.html

Click on "Power on", then on "Open" and select "Civil Engineering". JavaScript required, but the emulator and all the used files can be downloaded and used offline. Also, I wrote the BASIC program with Fuse, not when I was using a ZX Spectrum; I'm not that old.

I downloaded Cas's track viewer, it worked now and it's not actually that slow. How do I look up and down?
#63
Stunts Reverse Engineering / Re: Restunts repository - Git ...
Last post by llm - October 11, 2025, 10:00:40 AM
@Matei

CAS explained his views on third-parties serveral times over the years, he don't like (someway hates) 3rd-party dependencies (and the deployment/dependecy "burden" - he preferse tiny single exe builds without dependencies - like in the old times, 40 years ago) and FreeBasic is giving him an enviroment were he can get that and still be productive - its just the way he personally wants to do coding, and he wants to do it in a Basic-Language, and he wants the FreeBasic graphics interface - even if its nearly the same as SDL (its just a tiny fraction of less functions needed to get it running)

its clear for everyone that using third-parties, install and deploy them is just as normal in professional developing buisness as drinking water, writing non trivial multi-platform applications without third-parties just don't work anymore - you can do it but no one will pay you re-inventing wheels and consuming endless time doing it

maybe CAS does not work in professional software development, in a very small (lucky) niche were he could prevent using third-parties over a very long time or he choosed that way for his hobby-time - he chooses FreeBasic because it fits his needs fully out-of-the-box

it makes no sense to argue about it - he choose it for reasons we don't see as problematic as he do

but still, he creates nice tools for the community :-*
#64
Stunts Reverse Engineering / Re: Restunts repository - Git ...
Last post by Matei - October 10, 2025, 10:49:44 PM
Quote from: Cas on October 10, 2025, 10:28:15 PMBut programming for SDL feels very different to me from programming in a language. The library takes over and you really are no longer writing the graphics code.

Excuse me, but I wrote the graphics code with SDL more than you did in FreeBASIC.

https://sourceforge.net/projects/simple3d/files/SDL_grf/

You never looked at that. SDL has a little problem, however. It's at version 3 and if you didn't start with it at version 1 like I did, you might get some wrong ideas about it.
#65
Stunts Reverse Engineering / Re: Restunts repository - Git ...
Last post by Cas - October 10, 2025, 10:28:15 PM
I don't really have a problem with SDL. I think it's good. It just doesn't do what I want to do. It's good for SDL to exist because it makes a standard instead of letting tons of different libraries take over. That's a very good thing. But programming for SDL feels very different to me from programming in a language. The library takes over and you really are no longer writing the graphics code. I was a low level programmer in DOS. Now, for GNU/Linux, that's practically banned, so I try to do the closest to it that is possible and SDL is not it. SDL is not C... it's SDL. With SDL, I'd feel that I'm no longer writing programs for the OS, but I'm writing scripts for some program. "SavePNG" (or whatever it's called) -> Boom!  You have a PNG file. I don't like that. Then wanting to copy and run a 2MB program and having to download half a gigabyte from the internet for it to run.... Also not my type.
#66
Stunts Reverse Engineering / Re: Restunts repository - Git ...
Last post by Daniel3D - October 10, 2025, 09:20:31 PM
I know what why CAS doesn't want to use an SDL, and I'll try to give a simple example.

I like to fly RC planes, and there are several kind of people who fly planes at my club.
Two main groups are,
* those who built a plane piece by piece, cut and glue and paint for months to get is just the way they want..
And
* Those who buy a whole plane, mod it and go flying.

CAS is a programmer of the first kind.
He doesn't use libraries, if he needs one he will probably write it himself.
Takes more time but is more satisfying.

Simple DirectMedia Layer (SDL) is a cross-platform library providing low-level access to hardware via OpenGL and Direct3D, supporting Windows, macOS, Linux, ...
#67
Stunts Reverse Engineering / Re: Restunts repository - Git ...
Last post by Matei - October 10, 2025, 08:02:26 PM
Quote from: Cas on October 10, 2025, 04:52:28 PMthere are tons of SDL-based 3D graphics engines out there already.

Any example that can be used for Stunts? I mean besides the one I know about.

Quotebut when talking about graphics code, since C does not include that,

C compilers sometimes do, but using SDL is much better and also much better than what functions FreeBASIC offers. I don't understand what's your problem with SDL. DosBOX uses it as well as OpenTTD, Simutrans, TyrQuake, Fuse, practically all games that work on GNU/Linux and even NetSurf.

https://matei.one/idxchess.html

QuoteThe version above uses SDL for graphics, but the version for DOS/DOSBox, which is available below, uses some graphical functions available with Open Watcom, as SDL has no support for DOS.
#68
Custom Cars with Stressed / Re: Compatibility issue
Last post by Cas - October 10, 2025, 04:58:36 PM
X11 (or Wayland) is part of the OS. It comes installed with it unless you're using a server distro. SDL is not. FreeBasic is semantically abstract from graphics libraries: it can describe graphics code. C cannot. When you program graphics in C, you're not really programming in C. I like comprehensive graphics code.

FreeBasic, the language, has nothing to do with hardware (or software) support. If you write a program in FreeBasic, maybe the compiler will build it for Wayland or maybe not and in the future yes. I don't know. I don't have to worry about it because I can read the code and understand what it does. If needed, I can actually plug FreeBasic to SDL, although I think it does it wrap it under the syntax, which would be great. That's why I prefer the default graphics functions.
#69
Stunts Reverse Engineering / Re: Restunts repository - Git ...
Last post by Cas - October 10, 2025, 04:52:28 PM
@dstien - That's amazing. Yeah, I'd like to be able to write a function that performs exactly the same and the physics engine and compare the car positions. Your porting will be a lot more optimal, of course. I just want to be able to see that I understand it and have it in my mind analytically, not just copying the code.

But mostly yes, my interest is on putting that in the core and build shells out from scratch. I wonder how much is in the core that limits what can be added outside. For example, if there are references to the current memory distribution of track elements, maybe it isn't possible to make a bigger map without modifying the core. But perhaps the required changes would be minimal. I don't know.

@Matei - I think here is a misunderstanding. I'm going to get a little philosophical here, but just to clarify... Yes, my engine is a proof of concept. I wrote it to build and see that it actually did the thing and I didn't make any effort to make it fast enough or to perfectly render things without glitches, so it's not ready be to put on a game.

Now, this unfinished nature of it has nothing to do with it being FreeBasic. Because it is a graphical engine, it is impossible to port it to C, as C has no graphics functions. What you surely mean is to port it to SDL. I don't have much interest in doing that as there are tons of SDL-based 3D graphics engines out there already. They're not bad, but why reinvent the wheel?  I would like to create a new painter's algorithm based engine analog to Stunts' original and software based, like that of Stunts, that runs natively on modern systems and allows for adding some more things. That's it.

There's a difference between translating code between two programming languages and porting code between two compilers. Porting is about creating a source code that can be compiled with another tool chain and result in a different binary that can be run on a different platform. Translating has to do with the syntax, with the language. Libraries play no role in translation and there's no software efficiency optimisation in translating code. In terms of languages, considering the functions that are present in FreeBasic and C and their definitions, there is no superiority in one on the other. Maybe we could say FB is superior because it can do graphics comprehensively, while see cannot (as a language). In terms of the compiler, there are many C compilers, most of which have had much more work on than FreeBasic's and are likely to be more efficient, but when talking about graphics code, since C does not include that, the C compiler will just "copy and paste" from the 3rd party library, say, SDL, so if you make a game in FreeBasic or in C that uses SDL, efficiency will be the same as regards graphics.

Beyond superiority, there's a trend of preference towards the C language (syntactically) because it's more commonly used and you have more compiler options. This makes a lot of sense and I would recommend to follow suit for non-graphical projects.
#70
General Chat - ZSC / Re: Statistics!
Last post by Cas - October 10, 2025, 04:14:15 PM
Wow!  Another important historical detail for 4:00am!  8)