Creating my own futuristic aircraft

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
User avatar
Adoniram
Engineer
Engineer
Posts: 4
Joined: 06 Jan 2016 16:42

Creating my own futuristic aircraft

Post by Adoniram »

Hello all, I am new to the forums, but not new to TTD (or OpenTTD). Recently I've been playing around with a lot of GRFs that add a lot of cool futuristic stuff like vacuum tube trains and more, but aircraft are not evolving. I looked at av8 (or something like that) but it wasn't futuristic.

So, I've decided to code my own aircraft into the game...

(Before anyone jumps on the placement of this thread, I read this post in the Development section which said to post here since I was not making any "brilliant" contributions...)

Anyway, I found the list of vehicles in engines.h but I wanted to know where things like aircraft cargo types are specified, and of course, any other files you think are relevant for adding new vehicles to the game.

Right now I'm just trying to keep it simple, not creating a newGRF or patch, just modifying the code. Later I will work on GRF and/or patch work. I'll just reuse existing plane graphics for now as well.

Thanks!
Last edited by Chrill on 06 Jan 2016 17:01, edited 1 time in total.
Reason: Moved to NewGRF Technical Discussions instead of General OpenTTD
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: Creating my own futuristic aircraft

Post by PikkaBird »

Adoniram wrote:Right now I'm just trying to keep it simple, not creating a newGRF or patch, just modifying the code.
Yep, nope. Creating a newgrf is going to be an order of magnitude simpler than hard-coding new vehicles into the source. Your two choices for newgrf creating are nfo and nml - You'll find plenty of info and assistance here in the newgrf forums. :)
User avatar
Adoniram
Engineer
Engineer
Posts: 4
Joined: 06 Jan 2016 16:42

Re: Creating my own futuristic aircraft

Post by Adoniram »

Interesting... I've been able to modify the source code and modified a few older planes (just changed properties and introduction date), but I have been unable to add additional planes. (my modified planes show up in the compiled executable, but new ones cause it to crash because the program is looking for a specific number of planes/vehicles)

Looking at the NFO/GRF tutorials, I see sort of the same issue there: You can modify the existing list of vehicles, but you cannot introduce entirely new ones. Is that correct?

(just rechecked wiki and it states exactly that)

I really think editing the source is a lot easier, but maybe that's just based on my own personal experience. C++ is very familiar as is Visual Studio, whereas hex completely obfuscates the meaning of every line, and only the main program knows how to interpret any of it (unless you want to constantly refer to a webpage or cheat sheet).

I guess if I wanted to add new graphics, the GRF system would be better... perhaps someday :)
User avatar
Sylf
President
President
Posts: 957
Joined: 23 Nov 2010 21:25
Location: ::1

Re: Creating my own futuristic aircraft

Post by Sylf »

[quote="Adoniram"]You can modify the existing list of vehicles, but you cannot introduce entirely new ones. Is that correct?[/url]No. You can add vehicles.
[quote="Adoniram"](just rechecked wiki and it states exactly that)[/url]I'd check the NML Tutorial and NML Vehicles reference again and try again.

NML is not all that difficult. It's not the most intuitive language. But it's been far easier to teach myself NML than to teach myself EmberJS. And I've been programming in javascript for 10+ years.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Creating my own futuristic aircraft

Post by Alberth »

You can modify the existing list of vehicles, but you cannot introduce entirely new ones. Is that correct?[/url]No. You can add vehicles.
Technically, you are both correct and wrong :)

All aircraft are based on existing models from the base set. "Make a copy" is the first thing you do. However, you can override each and every property after copying, so it's fully customizable.
Being a retired OpenTTD developer does not mean I know what I am doing.
User avatar
Emperor Jake
Tycoon
Tycoon
Posts: 3427
Joined: 24 Apr 2007 09:37
Skype: Discord: Emperor Jake #4106
Location: Not Actually Japan
Contact:

Re: Creating my own futuristic aircraft

Post by Emperor Jake »

Might I also add that NewGRFs are much, much more accessible by the general playerbase than a source code patch. Also NML is intended to feel similar to C++, if you're used to that I'm sure it's no problem to get into NML's syntax.
User avatar
Adoniram
Engineer
Engineer
Posts: 4
Joined: 06 Jan 2016 16:42

Re: Creating my own futuristic aircraft

Post by Adoniram »

Thanks for the info. NML is indeed a lot cleaner looking so I'll try to play around with that, but I still do not see how I can add additional vehicles without overwriting others... I'll keep digging.

In the meantime, I have a few questions based on issues I've come across:

If I create futuristic, faster planes, there seems to be a problem with queuing for the landing. Sometimes, the planes get stuck in an infinite circle or loop near the airport they're trying to approach. My guess is this is what's happening:

-Plane is attempting to correct its course for approach
-Plane moves more tiles than the algorithm was expecting
-Algorithm readjusts its final approach based on new/unexpected position
-This causes the plane to spin in a circle for all eternity

I can get the planes to move on if I tell them to skip an order, or blow up the airport, and that'll work for a few back-and-forth passes, but then the issue comes back. It's not relevant what size or type of airport, or even what kind of aircraft (same for all aircraft that exceed the original max speed of the Dinger 1000)

Any ideas how to fix this to allow for faster planes?
Supercheese
Tycoon
Tycoon
Posts: 1660
Joined: 16 Dec 2007 22:24
Location: Idaho, USA

Re: Creating my own futuristic aircraft

Post by Supercheese »

Adoniram wrote:Thanks for the info. NML is indeed a lot cleaner looking so I'll try to play around with that, but I still do not see how I can add additional vehicles without overwriting others... I'll keep digging.

In the meantime, I have a few questions based on issues I've come across:

If I create futuristic, faster planes, there seems to be a problem with queuing for the landing. Sometimes, the planes get stuck in an infinite circle or loop near the airport they're trying to approach. My guess is this is what's happening:

-Plane is attempting to correct its course for approach
-Plane moves more tiles than the algorithm was expecting
-Algorithm readjusts its final approach based on new/unexpected position
-This causes the plane to spin in a circle for all eternity

I can get the planes to move on if I tell them to skip an order, or blow up the airport, and that'll work for a few back-and-forth passes, but then the issue comes back. It's not relevant what size or type of airport, or even what kind of aircraft (same for all aircraft that exceed the original max speed of the Dinger 1000)

Any ideas how to fix this to allow for faster planes?
Yes, this is a problem when you set excessively fast speeds for airplanes. The easiest solution is of course to just set a lower speed. If you're dead-set on having a really fast cruising speed, you might be able to finagle variable speeds using a callback, allowing higher speeds while cruising while specifying lower speeds on approach, to allow the planes to properly initiate their landing approach.
Eyecandy Road Vehicles | Fake Subways | Supercheese's NewObjects

"Fashions and cultures change, but steam trains shall always be majestic."
-Professor Hershel Layton
User avatar
Adoniram
Engineer
Engineer
Posts: 4
Joined: 06 Jan 2016 16:42

Re: Creating my own futuristic aircraft

Post by Adoniram »

Ok I figured that was it. The objective was to create a suborbital transit option with a fast acceleration, really high top speed, but really slow deceleration such that only vast distances would benefit from this form of transport. (basically a rocket that has to glide back in)

I'll keep playing with the source code and try to find where I could put all this...
SimYouLater
Chief Executive
Chief Executive
Posts: 675
Joined: 03 Apr 2016 20:19

Re: Creating my own futuristic aircraft

Post by SimYouLater »

Adoniram wrote:Ok I figured that was it. The objective was to create a suborbital transit option with a fast acceleration, really high top speed, but really slow deceleration such that only vast distances would benefit from this form of transport. (basically a rocket that has to glide back in)

I'll keep playing with the source code and try to find where I could put all this...
If you must know, from what I've determined as an end user, you shouldn't bother with editing source code unless you're trying to add new features. OpenTTD isn't like most games. In Transport Fever or Locomotion you have to add the vehicle as an individual mod. In other types of modable games like Skyrim or Fallout, you require viewing the source code. In some games with no modding support, you actually need to edit source code.

OpenTTD has NewGRFs if you want to add new vehicles, NewObject decorations, a different industry chain (which requires that only one such NewGRF setup like FIRS or the ECS collection be used) or new default town names. In the case of vehicles, NewGRFs don't overwrite the default vehicles. The default vehicles in the affected categories (trains, road vehicles, trams, ships, planes) are simply disabled, and you can mix and match all other vehicles as desired.

If someone wants to use your futuristic plane NewGRF then the default planes will be disabled through the NewGRF system, no messing with source code required. If they are unhappy with that tradeoff, the Planeset, av8, av9.8, World Airliner Set (WAS), VTOL AirCraft for Everyone (VACE) and Russian Planes Set can fill in for the default vehicles, and I think there is a parameter that turns off the disabling behavior (IIRC it's on by default) and/or a NewGRF containing the original vehicles if you want to use the originals regardless. The problem you're trying to avoid doesn't actually exist, so you're making a mountain out of a molehill!

Don't worry about source code, the NewGRF system can handle it. Just learn the intricacies of NML and you should be good. I recommend starting here: https://www.tt-wiki.net/wiki/NMLTutorial
Licenses for my work...
You automatically have my permission to re-license graphics or code by me if needed for use in any project that is not GPL v2, on the condition that if you release any derivatives of my graphics they're automatically considered as ALSO GPL v2 (code may remain unreleased, but please do provide it) and carry this provision in GPL v2 uses.
Please ask someone in-the-know to be sure that the graphics are done by me. Especially TTD-Scale, long story.
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 11 guests