News:

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

Main Menu

Other games?...

Started by Matei, February 05, 2024, 02:39:31 PM

Previous topic - Next topic

Cas

Ha, ha, ha... Yeah, these are the tasks I like doing, so I would like to. Only I feel soooo lazy!  But at least I can try to get you the 3sh-to-text thing if I have some time.

There is a slightly newer version of the engine. I've been very untidy with it and it's always attached to something else. The version I posted in Race For Kicks contains a track viewer. The other version is more interesting, but harder to use, but I wanted to post it after some touches to make it more friendly. It can actually replay "multi-player" races and sort of allows you to make a video out of them. It can draw cars... cars without wheels, ha, ha, but cars.

For just printing all the coordinates and colours of or triangles in a frame, I suppose I can just hack on the triangle drawing function and have it write to a log. Or do you mean all 3D triangles, that is, prior to rendering?  That's somewhat more complicated, though possible.

I think if we discuss these things enough, we might be able to find a way to do some team work here. We work very differently, but in the end, we are heading more or less in the same direction.
Earth is my country. Science is my religion.

Matei

I mean all 3D triangles because I need all the track, so just put them in a position in which they would all be rendered and save their coordinates and their colours in a file instead of drawing them on the screen. I managed to run FreeBasic in DosBox and it compiled engine3.bas, but the graphics don't work. The main problem is that even if I get some tracks working, the 3D models don't have a free license, so I can't include the tracks in the game, although I can put them in a separate archive on my site.

Matei

I'm not in any rush, and if you want to do anything, you should have my email, and my site has a contact page. There is, of course, a better way to do things, i.e. convert all the 3D models that compose tracks into text files that I can use and also create a text file with the positions and (horizontal) rotations of all elements in the track, because the file with the track from my game(s) contains a list of the files with the 3D models followed by a list of the track elements, where the position, rotation and 3D model used for each element are specified. I think I should be able to do it, but it would obviously take me a lot longer, especially since I don't know anything about FreeBasic nor the models in Stunts yet. Anyway, if you want to use FreeBasic to make a game, it will never run anywhere near as fast as if it was written in C. I looked at engine3.bas and it seems quite well written already. I think that sorting triangles rather than using a Zbuffer should have an advantage if you have transparent triangles, but as far as I saw, you don't...

Cas

Maybe I can do some of that this weekend. This week's work and a strong wave of heat and humidity here are a killing team.

FreeBasic actually uses GCC as a back-end so algorithm speed should be similar. Now I can't talk about the efficiency of the internal graphics library, but it's the only simple one I've found that I feel comfortable with. I've been interested in finding a good way of using it in C. Since the library was written in C originally, it has to be possible, but I have to do some research. The other idea would be to just read the source and see how the individual OS calls are handled for graphics and make my own, even simpler graphics library.

Not sure what you mean by transparent triangles, but I do handle 1-sided and 2-sided triangles. 1-sided triangles are only drawn when the orientation is positive and are eliminated from sorting at an earlier phase. My engine also decomposes polygons from Stunts to triangles. It does it in a rudimentary way, but because Stunts doesn't seem to use concave polygons in its models, it works well.

About licensing, my thinking goes like this: Stunts is like "freeware without papers". I'm OK with people redistributing it, it's on my site (Race For Kicks), but I'd immediately take it down if I were told to by any authority. I openly ask for anybody owning it to engage in communication with us and I'm willing to do anything legally required to be allowed to distribute it the right way. Only reason that hasn't been done is because we haven't been able to get in touch with anybody official. And if they don't want to allow it, I'd take it down. With my software (which is always free software), I wouldn't distribute it, because it'd violate my own license. On the other hand, creating free software that works with Stunts is perfectly legal. Say, I can make an engine that reads the original files and I can distribute the engine without the original files. Finally, if the moment comes when we want to have free models, it's not hard to make new models that will resemble those of Stunts enough to serve the same function and they would be legal.

For the 3D, I think it'd be simpler for me to make it the second way, that is, to extract the individual elements and turn them into text files and then give another text file with the offsets and rotations for those elements.

Oh, about the engine in DOS. I haven't tried to compile it there, but surely the problem is about the screen resolution. You need to change that near the top of the code to a resolution DOSBox supports. My engine uses 32bit true colour, so The maximum resolution you can use in DOSBox is 800x600. Otherwise, you'd have to look for the place where the screen resolution is set (it says ScreenRes) and set the third parameter to 16, which will bring the colours down to 16 bit high colour. Then you can apply a resolution of up to 1024x768. Resolutions in DOS have to be exact.
Earth is my country. Science is my religion.

Matei

If you can make a program without any graphics in FreeBasic, it should run in DosBox, which means I could distribute it with the game and without any problem, because it would be for converting tracks from Stunts, which requires DosBox anyway. All that I will have to do is compile an executable file for DOS. As I said, there's no rush, the first version of Simcar is from 2010, the last one is from 2014 and I'm working on other things right now. Anyway, if the models and the tracks are in text files, everything will become very easy to modify and extend.

I think my functions should be simple enough and have everything you need though, except for 3D lines. The project is even called "simple3d" and it comes with free technical support.

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

"SDL_grf - functions for 2D/3D graphics (lines, circles, discs, rectangles, triangles, text and 2D or 3D models composed of triangles), sound and input, written in C;"

"1-sided and 2-sided triangles" are called "selective backface culling" there, but it's the same thing, and i used a Zbuffer, not sorting. You should take a look. A transparent triangle is a triangle through which you can see, so it should be drawn after the triangles behind it, some of which may also be transparent. I don't have any of those anyway. 3D models from TORCS and *.OBJ files also have polygons that have to be decomposed and I never encountered any concave polygons either, but I made separate programs to do that and convert the models.

Speaking of triangles, the ones I use for physics are all "2-sided", whereas the ones in Open Dynamics Engine are "1-sided" and I never managed to get a triangle mesh with more than 1 triangle to work properly there, I don't know why. Anyway, if the track is made of triangles, then you can drive on it in Simcar, although it won't be like Stunts, obviously.

Cas

Here I'm posting a little program I made that will output all the contents of a 3sh file as text. You can thus read a custom car. If you want to read the original Stunts shapes, whether cars or track elements, you need to first unpack the P3S file into a 3SH file. This you can do with the stunpack tool that's part of the Stressed project. I don't remember where the repo was. Sure somebody can point us.

Anyway, to me, it's a lot more complicated to parse a text file than to pull a binary stream, but it can be convenient if you just want to see what's inside.

It looks like I will have to overcome my laziness one day and sit to understand these physics. Game physics can be divided into collision and kinemantics. Not sure if this library does both, but my thinking is that the hardest part is collision, yet it's the part that's more similar between games, whereas kinematics can change wildly.
Earth is my country. Science is my religion.

Matei

Ok, it worked, thanks, looks like I can use it. I'll let you know when I have something. I didn't understand what "culling front" and "culling back" means, so I'll just skip that, at least for now. I have the *.3sh files that came with engine3.bas.

Reading text:

https://matei.info.ro/idxsys.html

This is my second site, which I started making this year, and it's in Romanian. Some functions written in C that read text approximately in the same way are included in SDL_grf (address is above). A video about game physics (the second one, cstCtruck3D.webm):

https://matei.one/games.html#video

Also:

https://matei.one/idxcn.html#math

However, I didn't understand which library you referred to.

Cas

That's interesting work!  I have to take a closer look. It's incredible how I can more or less read your language even though I've never learnt any of it. Our languages are closer than I could've guessed!

Stressed is a program a community member made some years ago to edit Stunts data files. "Stressed" stands for Stunts Resources Editor. It allows for reading and saving uncompressed chunk-based files of the format Stunts uses, which includes 3D shape files, but there are many more. The thing is Stunts often provides these files compressed, so a companion program was made by the same author to decompress these files, then the main program uses it to read the files that are compressed. This little program is called Stunpack.

This week of work has left me super tired. I think I will be going to bed very soon
Earth is my country. Science is my religion.

Matei

I converted all the models, but the colours are wrong (maybe they can be fixed by modifying defmat.txt) and at least so far there are only triangles, no lines, and of course some more adjustments are needed to get the axes and the scale right. How do I send it to you?

Cas

Defmat.txt I created based on our wiki page for shape materials. Maybe you'll find it useful:

https://wiki.stunts.hu/wiki/Shape_materials

If it's images, you could post them here, or else, you can write to me at xlucas@mailo.com.
I think I'll soon upload my new garage program to R4K and casrepo.org :)
Earth is my country. Science is my religion.

Matei

I figured out what the numbers in defmat.txt mean, but maybe you can take a look at the program. I just sent you the file.

Cas

From a quick look, I think you have red and blue swapped, but not 100% sure. In defmat.txt, there are also indications of some "textures" that exist in Stunts. Most materials are just a solid colour, but some are semi-transparent. I've downloaded the viewer, but still haven't figured out how to compile it. Not used to SDL. But yes, for now, I'd say try that.
Earth is my country. Science is my religion.

Matei

Both viewers are also available as executable files for wInd0w$ and compilation instructions are inside. The program I sent you doesn't require SDL. I don't have semitransparent triangles, sorry, but the lines can be turned into 3D models made of triangles. As I wrote before, there's no rush. I think the problem with the colours is a little more complicated, I already tried that. Many models will need modifications. For instance, the dashed line on some road elements is under the road, if you can believe that.

Matei

Actually it wasn't complicated. Modify line 118:

mod.r[mod.nt]=r[w+1]; mod.g[mod.nt]=g[w+1]; mod.b[mod.nt]=b[w+1];

And while you're at it, you can add "freetok();" at line 34, after "}". The colours are fine now.

Matei

Fixing the models won't be very difficult. I just have to make a program that moves the vertices of all the triangles which have a certain colour, in some direction. Has anyone noticed that Romania rhymes with Trackmania?...

Quick Reply

Name:
Email:
Verification:
Please leave this box empty:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:
What is the title of the ZCT242 track, from ZakStunts season 2021?:
Shortcuts: ALT+S post or ALT+P preview