The International Simutrans Forum

 

Author Topic: Curves  (Read 19073 times)

0 Members and 1 Guest are viewing this topic.

Offline Fabio

  • Devotee
  • Administrator
  • *
  • Posts: 2898
  • The Pak128 Guy
    • Visit me on Facebook
  • Languages: EN, IT, RO, FR
Re: Curves
« Reply #35 on: February 21, 2009, 08:35:38 PM »
this rather sounds like starting back all the paks from the scratch...

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9516
  • Languages: De,EN,JP
Re: Curves
« Reply #36 on: February 21, 2009, 08:48:20 PM »
The problem is that simutrans has easily 1000 different images. Unfourtunately that amount of textures is handled badly on high end grafik systems still (There was a more in-depth discussion on this in OpenTTD, including an OpenGL driver which worke worse than the current.)

Offline Ashley

  • Coder/Patcher
  • Devotee
  • *
  • Posts: 1288
    • entropy.me.uk
Re: Curves
« Reply #37 on: February 22, 2009, 02:02:22 PM »
Thinking about the effort you are making, a reflexion came to my mind.  Why not pass the graphics engine to OpenGL without modifying the underlying ST tile model.  A lot of pak makers surely have Blender 3D models of buildings and vehicles.  For those vehicles whose 3D models aren't available, the graphics engine can put the flat image.  For the others, the 3D rendering.  Once a full 3D pak is available, the viewpoint can be freed or even you could "ride a vehicle"...

The Simutrans tile-based system would be needlessly restrictive for a 3D game, you'd want to develop something entirely new in that case, with freeform tracks. I've played around with OpenGL before, and while I probably could do all of this in 3D I quite like the look you get in a 2D sprite based game, that's why I'm developing one :)

Technically though, you'd use the same system, with 3D vectors rather than 2D ones and use the generated bezier curve to draw procedurally generated track graphics in 3D. All of the math is basically the same. You'd also need a fairly trivial set of functions that would split a curve (since track switches would always need to occur at the end of a curve section).

This is the way that, for example, Sid Meier's Railroads! does track drawing, although the system in that game is annoyingly restrictive (e.g. two tracks cannot cross each other without joining). And the complete lack of any kind of decent signalling and the crap routing makes that game pretty fail tbh.

Offline ij

  • *
  • Posts: 41
Re: Curves
« Reply #38 on: March 07, 2009, 07:50:35 PM »
I'm hardly worried about rotating vehicles online (ie., while drawing). It's pretty standard even in games that ran on 386 times and now we have a lot more cpu horsepower. In general there won't be that many vehicles in curves at the same time I hope. On screen I mean, obviously we don't care to do that for vehicles that are in off-screen curves.

Offline whoami

  • Devotees (Inactive)
  • *
  • Posts: 693
Re: Curves
« Reply #39 on: March 07, 2009, 08:06:02 PM »
I'm hardly worried about rotating vehicles online (ie., while drawing).
The thing to worry about is: for certain things, a lot of ST needs to be redone from scratch, and because that is so much effort, that task will have to justify itself by adding even more features, making it even harder (2nd version effect). For example, if going to any kind of 3D, the current tile images will be too limiting, so the vehicles and buildings should all be done again. If the tiles on the map are to be abandoned, goods routing, pathfinding and waybuilding need to be implemented again, in a much more general way.
« Last Edit: March 07, 2009, 08:11:11 PM by whoami »

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4587
  • Languages: EN, DE, AT
Re: Curves
« Reply #40 on: March 07, 2009, 08:45:22 PM »
I'm hardly worried about rotating vehicles online (ie., while drawing).

It would be possible to allow for more views of vehicles (16 or 24 views for curves, several more for up/down hill). But who will draw them?

It would be very interesting to see whether it is possible to automatically construct the missing views from the now available views (8 per vehicle). That is, to reconstruct 3d information from the existing views and render some more views. Ofcourse they will be rough approximations but they can be improved by pixel artists.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9516
  • Languages: De,EN,JP
Re: Curves
« Reply #41 on: March 07, 2009, 09:09:01 PM »
There are even wuite a number of vehicles with only four views ...

And there was a patch for vehicles on slopes. But then all vehicles on slopes has to be redrawn. Given the fact that even many vehicles on diagonals are not of the correct length in almost every set ...

Offline ij

  • *
  • Posts: 41
Re: Curves
« Reply #42 on: March 07, 2009, 10:26:26 PM »
The thing to worry about is: for certain things, a lot of ST needs to be redone from scratch, and because that is so much effort, that task will have to justify itself by adding even more features, making it even harder (2nd version effect). For example, if going to any kind of 3D, the current tile images will be too limiting, so the vehicles and buildings should all be done again. If the tiles on the map are to be abandoned, goods routing, pathfinding and waybuilding need to be implemented again, in a much more general way.

I disagree on most of the points... I guess you didn't get what I was saying... Those tile based things can certainly be rotated by any angle by simutrans while it needs to draw a vehicle. How beautiful the end result will look like is something that hasn't been tested yet but such sprite rotation has been used for ages. I'm certainly not talking about drawing more or redoing them like people are whole the time suggesting :-).

My idea about curves is not something presented by Timothy (or 3d people) which abandons the current tile based model (either replaces or abandons it completely). Each curve in my thoughts is still in the end quite much tile based, the curve goes from a tile to the adjacent one at a time (the only violation is actually the case where it goes exactly through a tile edge crossing but I currently ignore that corner case, I haven't done the math if that'll happen with some radius or not). Thus, routing and pathfinding can be fully tile-based like now.

As listed in the beginning of this thread, the building of curves is still an open problem. Ie., how it should be integrated gui.

The first thing on my todo list is getting the closer diagonal tracks to work since I'll needing that anyway to do close enough curves. I'll open a new thread on that one once I get something concrete.

Offline whoami

  • Devotees (Inactive)
  • *
  • Posts: 693
Re: Curves
« Reply #43 on: March 07, 2009, 10:41:48 PM »
I disagree on most of the points... I guess you didn't get what I was saying...
Maybe I subconsciously used the debate method of "take the opponent's point so far that it becomes a point against himself". :P

Quote
Those tile based things can certainly be rotated by any angle by simutrans while it needs to draw a vehicle. How beautiful the end result will look like is something that hasn't been tested yet but such sprite rotation has been used for ages.
Hmm, I am quite sure that the low resolution (especially pak sizes <=64) prohibits that, unless you have a method of telling the algorithm which pixel to move/morph into which other one - but I would be glad to be proven wrong. (For certain vehicles, a single pixel, or single line of them, can be important for the whole impression.)

Offline isidoro

  • Devotee
  • *
  • Posts: 1129
Re: Curves
« Reply #44 on: March 08, 2009, 12:37:51 AM »
Other games with multiple-tile curves has side-effects too.  For instance, signal placing.  In those programs, a 4x4 curve can only have signals at the exits.

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2269
Re: Curves
« Reply #45 on: March 08, 2009, 08:55:04 AM »
Sprite rotation is fine for a 2d game, however simutrans is 2.5d so you can't use the same techniques.

Offline ij

  • *
  • Posts: 41
Re: Curves
« Reply #46 on: March 08, 2009, 11:48:34 AM »
@isidoro: signal placement was also among the problems listed in the first mail :-).

@kierongreen: doh. Good point, I haven't thought that before. It certainly is a problem with 4 views only vehicles and even with 8 views there's one jumpy change when the tail dis/reappears (plus some variance in the visible length of the vehicle)... :-( I'll probably experiment with some vehicle to see how bad it will look like if I just skew it by changing one of the axis vectors instead of both as would be done with plain simple 2d sprites. I'm not sure the end result will be any worse than what we already have when the vehicle jumps from view to another (the 45deg angle).

@whoami: lines usually do not vanish, small one pixel detail vanish or are made less obvious from time to time but I doubt that appearance of a vehicle is so much depending on a single pixel really and the ones that vanish are angle dependant.