my folly: direct controllable road vehicles

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

theBohemian
Engineer
Engineer
Posts: 17
Joined: 18 Jul 2004 18:19

my folly: direct controllable road vehicles

Post by theBohemian »

Hi freaks,
some days I though about how funny it would be to control openttd's road vehicles directly. I took as a small exercise to work myself into the codebase and finished it last night.

Note: The patch is for the SDL version only.

What you can do:
(all commands are transferred to the vehicle through its detail window)
keypad minus: toggle between normal control and direct control mode
kp 4: steer left
kp 6: steer right
kp 5: drive straight ahead (may cancel a former request to steer or turn)
kp enter: turn around
kp 8: increase tempomat speed
kp 2: decrease tempomat speed
kp 0: full stop (tempomat speed to zero)
kp plus: full throttle (tempomat speed to max_speed)

Note that although it is named direct control the vehicle works according to the game's rules. that means that you cannot leave the road tiles with this. furthermore the algorithm automatically adjusts movement if you try to steer in an invalid direction.
the steer commands are "executed" when the vehicle enters a new tile.

In dc mode the detail window will shows your current command and tempomat speed in green and the real velocity in black.

"for what is this useful?"
For nothing really. I did it for fun and to train my C skills a bit. furthermore
its the "matrix-style" of free software: I have the tools and the knowledge to modify the world, so why not do it.
Maybe someone else gets inspired to do something useful out of this (taxi driving? what about this mechwarrior thingie someone spoke on this board?).

here is a screenshot:
Image

the patch can be applied to the openttd 0.4.0 sources.
beware: I modified the language files english.txt and german.txt a bit. OTTD will crash if you use another language without having defined the few extra strings. add them yourself (its easy look at the last lines in english.txt) or use english/german.

have fun :)
thebohemian
Attachments
openttd-dc.diff
patch for direct controlled vehicles for plain openttd 0.4.0 source code (as provided via sourceforge)
(14.37 KiB) Downloaded 344 times
User avatar
orudge
Administrator
Administrator
Posts: 25171
Joined: 26 Jan 2001 20:18
Skype: orudge
Location: Banchory, UK
Contact:

Post by orudge »

Heh, this has potential... racing games, anyone? ;)
User avatar
Sellu
Engineer
Engineer
Posts: 98
Joined: 24 Sep 2004 20:06

Post by Sellu »

So when will there be the first openttd rally championship? ;)
Image
The power that I trust.
Singaporekid
Tycoon
Tycoon
Posts: 1966
Joined: 21 May 2004 07:39
Location: Singapore

Post by Singaporekid »

What a cool patch, can you compile one for 0.4.0.1?
Also make one for trains please :P
<+Raichase> ugh, I just ate some of my beard D:
User avatar
Sellu
Engineer
Engineer
Posts: 98
Joined: 24 Sep 2004 20:06

Post by Sellu »

I would like to see similar options in trains such as uncouple/couple waggons.
Image
The power that I trust.
User avatar
Sionide
Director
Director
Posts: 523
Joined: 10 Oct 2004 10:54
Location: England
Contact:

Post by Sionide »

Wow, that's genius! Lot of potential with controlling your own trains...
...Synthetic Intelligent Organism Normally for Infiltration and Dangerous Exploration...
...sionide.net...
User avatar
jvassie
Tycoon
Tycoon
Posts: 3421
Joined: 18 Dec 2002 18:00
Location: High Wycombe, England
Contact:

Post by jvassie »

Looking good, it'd be wicked if we could use it on trains!

James
(British) Modular Stations Set - Thread: | Website:
Swiss Set - Thread: | Website:
Route Map Creator
My Screenshot Thread
User avatar
Invisble
Transport Coordinator
Transport Coordinator
Posts: 341
Joined: 17 May 2005 15:06
Location: England
Contact:

Post by Invisble »

Trains!!!!! Just imagine what it would be like for aircraft...........
User avatar
Bob Smith
Engineer
Engineer
Posts: 111
Joined: 17 May 2005 23:25

Post by Bob Smith »

Invisble wrote:Trains!!!!! Just imagine what it would be like for aircraft...........
Hmm, the ability to take a shorter route and force a plane to land early (i.e. skip the queue) could be very advantages at times.
Roo
Engineer
Engineer
Posts: 72
Joined: 13 Dec 2004 17:47
Location: Roudnice, Czech Republic
Contact:

Post by Roo »

Bob Smith wrote:
Invisble wrote:Trains!!!!! Just imagine what it would be like for aircraft...........
Hmm, the ability to take a shorter route and force a plane to land early (i.e. skip the queue) could be very advantages at times.
WOW, Imagine that wonderful crashes! :shock: :shock: :shock: :shock:
theBohemian
Engineer
Engineer
Posts: 17
Joined: 18 Jul 2004 18:19

Post by theBohemian »

Really I think this is just not useful but can be fun. I do not have much time these days but I think about adding direct control for other vehicles later.

If someones wants to enhance my patch in the meantime and has problems understanding parts of it just contact me. One bit that may be confusing is the bit fiddling for the road vehicle animations. Just take a look at this and the code and you will certainly understand http://page.mi.fu-berlin.de/~rschuste/o ... ement.jpeg (watch the bit masks!!)

btw: ottd road vehicles cannot crash into each other. thats lame ;)
User avatar
^Cartman^
Engineer
Engineer
Posts: 110
Joined: 28 Apr 2005 14:42

Post by ^Cartman^ »

theBohemian wrote:btw: ottd road vehicles cannot crash into each other. thats lame ;)
Someone should make it possible, then. :D
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

IDEA OMG THAT'S AN IDEA!!

One can use this patch to create the waypoints along with orders.

This way, road vehicles will go anywhere player had set!

This will be useful and easy way to tell trucks to use specified way, like via the bridge instead of via the railway crossing.

It would be new era of road vehicles if someone makes trucks' paths based on user-made waypoints!!
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1771
Joined: 30 Mar 2005 09:43

Post by peter1138 »

MeusH, an easier way to avoid railway crossings is to apply my patch... see part of http://www.tt-forums.net/viewtopic.php?p=284724
init
Engineer
Engineer
Posts: 93
Joined: 07 Apr 2005 10:01

Re: my folly: direct controllable road vehicles

Post by init »

theBohemian wrote:some days I though about how funny it would be to control openttd's road vehicles directly. I took as a small exercise to work myself into the codebase and finished it last night.
Sounds like U-Drive-It in Simcity 4: Rush Hour. Although I didn't try this patch, I think that it could be fun once in a while. Just like U-Drive-It.
DeletedUser21
Tycoon
Tycoon
Posts: 11501
Joined: 20 Sep 2004 22:45

Post by DeletedUser21 »

what about ships? they can get more potential too.
They might actually become usefull :shock:
User avatar
SkeedR
Tycoon
Tycoon
Posts: 2265
Joined: 11 Jul 2004 14:55
Location: West Midlands
Contact:

Post by SkeedR »

ok, so how exactly do i apply this patch?
:oops:
Last known as: Weirdy
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Checkout (from SVN) or download (from sf.net or nightlies.openttd.org) a copy of the source code. Use either TortiseSVN or patch(1) to apply the diff, and then compile with $COMPILER_OF_CHOICE.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
yoshi314
Engineer
Engineer
Posts: 11
Joined: 27 May 2005 14:56
Location: PL
Contact:

Post by yoshi314 »

if this evolves, one could make this game into RTS :]

select a group of evil buses and make a raid at enemy city (bus-rush :D) X]

you could make road blocks with busses, trucks etc. (police cars? :]) :D

you know, now we have to design some tanks, warships, battle planes, and panzerwagons and implement "fire" feature, and the game might get a new dimension to its gameplay :]

heh.... openttd-capture-the-flag (bus-only) <lol>

this is neat.

racing championships also sound fun :]
---------------------------------------------
maybe we should suggest the developers to code some plugin support into the game. who knows what might pop-up? people could get encouraged to make modifications :]
User avatar
bobingabout
Tycoon
Tycoon
Posts: 1850
Joined: 21 May 2005 15:10
Location: Hull, England

Post by bobingabout »

i like the idea of adding this to trains, together with a decouple command. problem would be controling coupling....
JPG SUX!!! USE PNG!!!
There are times when JPG is useful, TTD screenshots is not one of them. Please use PNG instead.

[/url]
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 1 guest