Crea sito

Crea sito

downloads Windows & Linux_Ubuntu executable + SourceCode (compilabe for practically *any* desktop operating system) : generic download, choose from list.

main variant: CTruck3D _Open --> it's OpenSource software released under licence GPLv3 : it can be downloaded with C source file included , from it's SourceForge space ( play it freely, but read the licence type and relative definition of rules before using CTruck3D's C sourcecode ).

the 3 subversion of the CTruck3D series are ( click to get to SourceForge space of each, and download ):

>> CTruck3D_Open ( runs on: Windows & Linux & Mac & *any* POSIX -compliant system) ;

~$: XTruck3D _Truck ( runs on: Linux & Mac & *any* POSIX -compliant system ) ;

>> Term_ CTruck3D ( runs on: Windows & Linux & Mac & *any* POSIX -compliant system) ;

>>> Lagrange Rally 3D (yes, as the title suggests, it does simulation with pure lagrangian method, and all articulations are actually simulated, no approximations, but no constraint forces are bothered about, so it's very simple and performant too):

Su questo sito / About the site:

ENG: homepage of the CTruck3D truck/car simulator series and the Lagrange Rally 3D series by Simon Hasur : a physically realistic offroad driving simulator (rally ) in which one can drive in total freedom on a piece of terrain, make jumps, turn upside down and whatever ; particular attention to internal camera view to be able to see all like sitting in a real car. Both could be considered a modernized re-make of the classic Terep 2 , or say, Terep2 with truck. Written in the standard C programming language ; the CTruck3D series and its 2D predecessor is also OpenSource. These games run by default both on Windows and Linux Ubuntu, for which ready executalbes are in the downloaded zip. For more detailes, go to their SourceForge space. There's discreetely tidy documentation about it's C sourcecode. Additional dydactic material on game programming can be found in the site. There's also a game similar to the old STUNTS but done with more realistic physics and more jums structures and better graphics. New fronters are attending CSTUNTS because a version will be made with the physics engine I recently developed (2013) that uses lagrangian mechanics in a finite-element fashion. I also made a video-tutorial about physically realistic simulation from zero, good from starters to experts, here:

ITA: homepage della serie di simulatore di camion/auto Ctruck3D e Lagrange Rally 3D di Simon Hasur : un simulatore di guida fuoristrada (rally) fisicamente realistico in cui si può guidare dappertutto su un pezzo di terreno collinoso, fare salti, ribaltarsi e cose simili ; particolare attenzione alla visuale interna per poter vedere tutto come se si fosse seduti in una vera auto. Va di default su Windows e Linux Ubuntu. Potrebbe essere considerato un remake modernizzato del classico Terep 2 [1996], o, diciamo Terep 2 con camion. L'ho scritto nel linguaggio di programmazione C standard : La serie CTruck3D e il predecessore 2D sono OpenSource, per cui qui si impara anche a fare queste cose per che si interessa. Ulteriori dettagli sui rispettivi spazi su SourceForge. C'è una discreta documentazione anche sul codice sorgente. Su questo sito ci sono anche testi didattici in cui spiego come programmare giochi 2D e 3D in C, con particolare riguardo ai simulatori e classici. C'è anche uno spin-off simile al vecchio STUNTS, con fisica più realistica e più strutture per saltare: nuove frontiere attendono quest'ultimo game (CSTUNTS) perché ho creato di recente (2013) un simulatore o 'physics-engine' basato sulla meccanica di Lagrange in uno stile a-elementi-finiti. Ho anche creato un video-tutorial comleto sulla simulazione fisicamente realistica, adatta dai principianti fino a esperti, qua:

--> executalbes are in the downloaded zip ; to have an executable of CTruck3D for other systems too, wrirte me specifying which one; the CTruck2D instead can be compiled for any system by the gamers themselves, some instructions are included in the zip, in a text file.

NOTE: Videos are on my 2 youtube spaces: you can find them by typing CTruck3D and using YouTube's search engine. Sometimes embedded vids are problematic, so just go to YouTube to watch videos, so you make also sure that you get the latest stuff. For CTruck3D series in general I made a complete, 30 min documentary explaining and showing techinical deatiles too, so it's worth it; there is also an official presentation video, less technical:

Well, making a website is long, and for that reason even pictures are upgraded very seldom here: so just go to the space of each member of the CTruck3D series: that is frequently updated, since it's made on purpose to be easy to update download-files, pictures / screenshots, and documentation.


 the XCTruck3D _Truck is finished and *does* sucessfully reproduce the DOSgame -looking graphics of the classic Terep 2.

(N.B.: the background music was written by me. )

CURRENT VERSION of PhysicsPark3D: 1.0: Ctruck3D_Open is the officially released version of Ctruck3D. Lagrange Rally uses Lagrange_Simulation 0.1 which is as simple as powerful, support any articulated mechanism's simulation as long as a parametrisation is given... not a common product as to 2013.

#: What is CTruck3D and 2D and how it started out: I give an answer to this question:

The stuff is a 3D truck/car simulator -called "CTruck3D" -, whos physics relies on a physics engine - called PhysicsPark3D - developed for that purpose, by Simon Hasur(myself). I called it CTruck3D because the initial "C-" indicates somehow that it was written in the C programming language: the C programming language was very good for this purpose in my opinion, and allowed to write this stuff in little time. The graphics of CTruck3D relies on the OpenGL graphics library, and the non-versatile GLUT library which also provides real-time interactivity... so that CTruck3D is available both for Windows, Linux, and I hope soon also for Mac.

Before such a big simulator could be completed, I had created a couple of smaller simulators /simulation-games, with previous versions of the physics engine behind CTruck3D: this games range from the simple material-point dynamics to basketball-physics, and also a 2D truck simulator - the CTruck2D. All this programs I wrote from totally zero of course, trying to keep the thing always down to the ABC. There are plenty of –also free – physics engines- call them simulation environments-, but they also are mostly written and offered in C++ programming language. But for circumstances that I dont' have to explain, PhysicsPark2D & -3D I wrote in standard C language. And originally it started so that a fancy rigid-body physics engine was needed in Matlab language.... I didn't find any, so I wrote one myself. Then from 2D it progressed to 3D, and it was natural to re-write it progressively in the C language, because of it's peculiar features - such as the semplicity and minimalism, and control on precision of non-integer numbers. Matlab ® /Octave is a kind of programming language and IDE that allowes to write the code in 1/3 of the space, and allowes to focus more on physics than on programming questions and battling with long vector-calculus function definitions. But it's not as simple, clear and univocous and C, and for compatibility on all operating systems, nothing is better than C ( with or without OpenGL ), in the context of simulation-oriented game programs of course. That's why there are eventually so many free simulators here. For Windows and Linux either.

After, I went on experimenting how to exploit the pure Lagrangian mehod and the first game created with this method is Lagrange_Motocross2D , downloadable form SourceForge that too. Yes, since at the time I started doing simulators ( initially just for hobby) I wanted to become a truck driver, I noticed immediately how badly the rigid-body + contraint_force approach discriminated articulated bodies and how all mechanics books I ever saw, discriminated or mistified it. I came across the article by Chris Hecker “how to simulate a ponytail” which was good but... I knew there had to be a way of doing that fits much better the articulaed-body simulation. I knew all the time there was that thing called usually “Lagrangian dynamics” but it was documented in a very academic way, and almost no documentation (I found none at all yet already at that time there was fast internet) on how to do 3D simulations with lagrangian method without the need to have any symbolic expression except some things in the parametrisation of the dynamical system to be simulated... so I bought the book “Game Physics” hoping that there every quastion would find an answer. Well... for collisions and the rigid-body approach yes, but... not on the articulated body thing... rather, it confirmed my intent to investigate some method to do a phsyics engine which does articulated bodies *intinsecally*, and thus being very simple since not calculating any constraint-forces; and I say again, it had to be non-symbolic and the dynamical system to be simulated had to be very easy to set up in the sourcecode because I did not like and don't still like complicated academic things. In the book Game Physics, besides a short but contentful chapter on the use of lagrangian dynamics (only fully-symbolic approach though) in implmenting simulators, in chapter 5 (about those pieces of software called usually “phsyics engines” ) I found this statement:

Section 5.2.5 proposes a different approach to constrained motion than what a general-purpose engine provides and one that I think should be investigated. I propose that an implementation can detect and provide enough information about the constraints imposed by the contact set […] so that rather than continually solving Newton's equations of motion, the system can construct the Lagrangian equations of motion and switch to the appropriate set of equations when necessary. This approach is of particular importance when dealing with frictional forces since Lagrangian dynamics do a better job of incorporating the friction into the equations. The paper [jak01] by Thomas Jakobsen already hints at this by using projection of the system state variables onto a manifold described by the constraints.”-(Dave Eberly, Game Physics, year 2004)

Well... you can bet that I immediately read that article by Jakobsen... it is a very simple article with concrete examples and simple figures, and you can bet how much that kind of article can strice a non-academic boy's mind. it was so simple but great that it just opened my mind culturally, I immediately understood that I should investigate thoroughly the use all-comprised, of generalised coordinates... but do the motion with no approximation... that is, using lagrangian mechanics in videogames and simulators in general.

Later, in fact, I started experimenting by implementing little simulators that use pure lagrangian dynamics in an all-symbolic fashion, obtaining the symbolic expressions to put in the C sourcecode with the Maxima program (an easy-to use, free symbolic calculation program). The first such interesting product was LagrangeMorocross2D which is open-world and handles to some extent also collisions. I found no books at all even mentioning how to unite lagrangina method and collisoins but well, that I solved immediately since I have never been an academic so I did not regret to just implement a routine that finds the right collision-impulse empirically and applies the best impulse to the point which has collided. I went slow because I noticed how badly the prejudices learned at school and on many books about he lagrangin method (and the whole mechanics in general) were limiting my view of the possibilities. Eventually, partly becase I was very young (and thus endowed with less prejudices and thus more flexible) and because I have always been critic about the ridigbody + contrain_force approach because a litte bit long to implement, alitte bit too complicated if compared to the final result, and worst of all it discriminaing badly articulated bodies (so also trucks' simulation), and parly because of a certain cultural openness jointed with coherency, I overcame all those problems and did a funny physics engine based on lagrangian method which does no symbolic operations; and did a long videotutorial also on the whole machanics for people to be able to learn it easily with main focus on implementing simulators, not having to face all the difficulties I found with documentation on the topic. Needless to say that at the end I ended up deducing the whole what-to-do from zero, using deduction, also to be sure not to introduce uninternded prejudices and biases from from books written like 30 or 40 years ago. Well, Lagrange_Rally_3D is really what I was looking for since the beginning, thats it: certainly I will soon use the new simulator to do a remake o STUNTS based entirely on lagrangian dynamics, ideal for simulating vehicles – and also trucks of course – driving on analytic surfaces... provided that the roads, highways and such things can be considered as big pieces of analytic surface. I thought it was all over and it was about time to just wait the life to pass by, but I realised I am still full of ideas, even on topics which I never was interested in like level-editors... yes, the use of lagrangian mechanics in simulation-videogames has brung me to forsee lots of innovations in gaming area and not only... if anything, it's funny!

certainly I shall write one or more books on the topic, focusing a lot on a finite-difference approach which eliminated the need to think about symbolic expressions and ugly partial derivatives... I also thought of doing some demo-software and describe it, which finds the qdd vector by doing a semprandom empiric minimum-search of a mltivariate function (whose values are a result of a procedure of course). Why should doing a realistic videogame be more complicated than plauing Lego Technic? - well, there isn't a reason for it: it should not be more complicated, only funnier or in the worst case just “N3rdest”!

Since I had been a pure autodidact in game/simulator programming, and was lucky with the texbooks used, I had a formation which adressed to keep to ABC, as simple as possible. I appreciated the fact theat the book I used to learn C not only taught it very quickly and very well (the R&K C book), but in general gave a very clear idea of information technology and programming in general, evidencing very well what are those aspects of information technology which did't chage much in the last 30 years. I was disappointed by the fact that many books and online references didn't teach directly and clearly the most essential things required to write the software that a certain practical situation requires to write. So with game programming I decided that hey, I know what my simualtors must do, just dont't panic if for hi-resolution graphical output an additional C library needs to be used: we are not computer scientist, we are physicist or game programmers. So I just wrote all the software using the minimal programming knowledge. In free time I decided that, since this going to the ABC, it would be good to get more seriously into computer science to discover how it is possible to write programs as system-independent as possible. For this reason, I wrote some small 2D games very well commented, which show what does that mean that the problem of writing also a complex 3D flight simulator is not a problem iof programming but formalizing what it has to do. Since graphics and interactivity there is already in Tetris, if we can write a very system-independent Tetris game in C, we can do the seme for any program that is not realated to hardware or very particular services which must be provided by the host operating system(networking and other things).

I wrote some very well-tidyed dydactic material on this (commented C sources) accompanied by a general text which first teaches and explains how to implement Tetris and Snake in the C programming language providing the C code, and how to compile it and get i t work also on Unix/Linux systems. download here: It also expains how to do serious graphics and how one could write for himself also a 3D graphics library using only the ususal elementary operations allowd by the C programming language, along wiht providing actually a library of that kind even if supporting only wireframe if working 3D. Still a draft... will undergo several refinements.... but it's already usable, even because the code provided with it is very well commented, simple and ordered.

I realised that for example the perplexities many people showed with OpenGL, are not because it's difficult or because the standard manual for it (“OpenGL redbook”) is not excellently good... but because the examples showed obtain the graphics-window service form the operating system using an additional library which is very confusional, the GLUT library, and because people don't understand in what way OpenGL is just a set of easy-to use functions to draw in 3D quickly, nicely, and wothout having to spend months to write a 3D graphics library from zero. But again that's not a proglem of computer programming, that's a problem of 3D geometry and the geometric model of perspectivic images. I also made a version of Ctruck3D_Open which desn't use any external 3D graphics library or similar, but does old-style, all-written-from-zero 3D graphics: the XCTruck3D

Even if the very widely used Windows operating system makes it very hard to give graphical output to a program in a graphics window, it is true (on all good operating systems) that if one can say “I go to the concert if I have the ticket and if doesn't rain ”, can program at least something like Snake. And at the level of computer programming, that has the seme requirements of programming a 3D flight simulator, realistic or not or anything similar.


DOWNLOAD HERE A TEXT of mine ABOUT SIMULATION – I presented it as 'tesina' when I was (disastrously) at high-school. Good also for non-italian readers, lots of Matlab and C code: at this link:

 and enjoy it, lots of pictures also and simualtors in attachmente, “La simulazione della realtà fisica al computer”(2010) , all packed togather in order.

older, small videogames:

CTruck2D /* Open Source, C code included in the zip */

a 2D truck simulator; realistic physics.Comes in 3 subversions: normal, _Snow, and Term_ ;

Control: E-R-T-Y keys, to give user-controlled rotation to the tyres. “1” and “2” to reduce or increase gravity; the Term_CTruck2D variant has some addotional controls, read them in-game, it appears automatically in-game. Have lots of fun. Note about the C code: my programming style is extremely simple; if possible, use the Term_ version because GLUT+OpenGL is overwhelming and makes look code awful.


The text-based version of this game, Term_CTruck2D; it's also good as dydactic material to understand how 2D graphics work when it's written from zero.

there is still some other stuff, even if no of them is like CTruck2D/3D....

CBasketPhysics2D ; baseCSpecrel2D; PencilDynamics2D ; Cbiliard2D ; // sourcecode (well-tidyed) may be found on SourceForge under the "illustrative progs" project title, along with the CTruck3D series.

Specrel2D translated to C+openGL, now is ok, with basic features, no extra content, just grid with relativistic effects and WAZD control. Will make it terminal-output... like iriginal SpaceInvaders, with serious graphics like this, it looks too good, and not enough primordial.

Download from link below. / Scarica dal link sotto

>>baseCSPecrel2D>> .

PencilDynamics2D: simple 2D simulator videogame that simulates the realistic rebouncing of a pencil from a horizontal groundline. Control: WAZD keys, plus “e” an “r” to give user-controlled rotation to the 'pencil' and keys “1” and “2” to reduce or increase gravity. The control keys can be read in the starting Dos window anyway.



a 2D simualtor of the physics of a basketball; the 'environment' is poor, just a groundline, but the physics is cool. Control: WAZD keys, plus “e” an “r” to give user-controlled rotation to the 'basket ball' and keys “1” and “2” to reduce or increase gravity. The control keys can be read in the starting Dos window anyway. After the Dos window opened, put it at the right side of desktop, to avoid covering the graphycs window that will open when you press a key to start simuation. Make sure that Dos window is active, otherwise command keys will not respond. Have lots of fun.

Download: CBasketPhysics2D

openGL and C are really cool, but it takes time ot work with them, since code becomes quite complicated and long, and the longer, the more likeliness for making mistakes. In practice, below you find some images and description of antiquates which were cool, but were ine in Matlab/Octave. Note that many component of the Ctruck3D I had tested befeore in Matlab/Octave.

Specrel 2D Matlab/Octave version:

A simple videogame resembling the calssic SPACEWAR!, but realtivistic: interactive directioning of spaceship with mouse. The relative velocity can be set up, augmenting or diminishing the realtivistic distortions of course. Sample picture of screenshot:

 nice apparel, worh playing with it.... And woth understanding how the realtivitstic universe works, since all space-time is realtivistic, magnetism is a realtivistic effect, and gravity too! It's FREE !


- -


Specrel 3D:

Seme as Specrel 2D but in 3D and looking like a normal flight simulator: this I had not implmented in C+OpenGL, maybe sometime I'll do it. Hope also to create sometime a more interesting videogame such as Descent 1 ®, but all realtivistic. Sample picture of screenshot:


 And what was it like the physics engine behind Ctruck3D one day back?

The PhysicsPark3D physics engine v0.1: in the picture below, a material point rebouncing until it reaches the depression according to gradient.


The physically realistic rebounce of material points form a 3D terrain, of arbitrary extension; the green lines are the normal vectors to each triangle that is hit by the material point. I had tested the point-grid triangulation algorhythm with this. It was in Matlab.

 Wanted to know how I look? Here a photo:


Videogames currently under development:

following versions of the CTruck3D simulator... extending it's present versions to create even better versions.

I didn’t want to be too explicit on that at the top of the page: if for some very stessing questions you reader want to write me, write to the following e-mail adress:   ;