Page 1 of 2

OgreRails = A railroad implementation demo

Posted: 30 Aug 2011 23:40
by ohlidalp
Hello everybody who ever wander into these forums in a hope that there's something going on. Well, it is now. I'm back 8)

I've decided to work on the most fun and most rewarding part of this project - trains! More specifically, I'm writing a complete railroad track + vehicles implementation: rails, trains, stations, semaphores, pathfinding and such. My goal is to create a complete working prototype which can be incorporated into TE. Currently, it's exists as a separate application which I made as my own sandbox. I've called it OgreRails and hosted it on GitHub: https://github.com/An00biS/OgreRails.

Currently, the program can do the following:
* define arbitrary logical (invisible) track on the game map.
* follow these tracks and compute point coordinates
* visualize the track by placing 3D models of rails in the space
* define logical vehicles and consists which follow tracks and span over a certain length
* visualize the vehicles

And here is the roadmap of things to follow:
0.1 Working rails and trains (DONE!)
0.2 Direct single-track construction GUI
0.3 Train GUI windows, train reversing, train lifting and placing functionality (LOMO-like)
0.4 Train construction, modification and removal GUI
0.5 Rail crossings
0.6 Rail waypoints and pathfinding
0.7 Rail signals
0.8 High track
0.9 High track bridge graphics
1.0 Final touches

Finally, here are the things which NOT to expect from his tech. demo: terrain. The ground is represented by one flat 3D plane and that's how it's going to remain. Uzurpator is working on the terrain and my code is completely terrain-independent (on the engine level), so we can put it together anytime later (when Uzu's code starts working, anyway :P ).

Allright, I've said enough, now check out the v0.1 alpha version. It shows you two pre-built tracks and 5 trains riding it. All you can do so far is to move and zoom the camera, but I'm sure you'll enjoy it anyway :) .
__________

== DOWNLOAD ==
The executable is in the 'bin' folder, in case you were lost.
Known bugs: It crashes on exit (segfault) :( Well, it's alpha, what did you expect... :D
__________

Please download and try running it, I need to know if it works at all, and if it does, then what you think. I tested it on my Windows7 64 bit and Fedora15 64bit (HPNX6310 notebook, 4GB RAM, intel 945 integrated graphics)
And while you download, you can admire these screenshots :D :
screenshot_1.png
screenshot_1.png (830.79 KiB) Viewed 32495 times
screenshot_4.png
screenshot_4.png (886.53 KiB) Viewed 32495 times
screenshot_2.png
screenshot_2.png (823.96 KiB) Viewed 32495 times
BTW in case anybody was wondering where I got those awesome graphics, well, they're mine :] Actually I made them over a year ago, and now I'm finally making use of them. I made them deliberately low-poly and low-res-textured because they are meant for testing, not for beauty. And I'm not any great artist anyway.

Enjoy and let me know how very very much you like it :D .

Cheers
~ An00biS

EDIT: Title, .exe info.
EDIT2: Oops, the download link is broken, why didn't anybody tell me :oops: ?
EDIT3: Added direct download link (the previous was still broken :oops: )

Re: SURPRISE!!! A railroad implementation prototype.

Posted: 31 Aug 2011 06:18
by Spacek531
That looks really cool!

I know you said you would not implement terrain, but it would be awesome if you did.

Re: SURPRISE!!! A railroad implementation prototype.

Posted: 31 Aug 2011 06:49
by ohlidalp
Spacek531 wrote:That looks really cool!
I know you said you would not implement terrain, but it would be awesome if you did.
Thanks!
Sure, terrain would be great, but rather than implementing one I'd like to merge with this one. Why should I do everything myself? :wink: Actually, maybe I'll won't have to implement terrain because the terrain coder will implement me :D

Re: SURPRISE!!! A railroad implementation prototype.

Posted: 31 Aug 2011 07:27
by Spacek531
That sounds like a good plan, if it uses the same language as yours!

I am really excited about this. Perhaps a 3D Locomotion?

Re: SURPRISE!!! A railroad implementation prototype.

Posted: 31 Aug 2011 09:23
by ohlidalp
Spacek531 wrote:...Perhaps a 3D Locomotion?
Well, the idea in my mind is kind of like Locomotion, but with many things done differently. I have some new ideas here, but it's too early to post them - they might change and someone may post a better suggestions. I'm not going to design it all by myself :))

EDIT: Btw, did you download and try running it? I'm waiting eagerly for reports about this.

Re: OgreRails = A railroad implementation demo

Posted: 31 Aug 2011 16:59
by Spacek531
Well, I go to download it, and there is no file named Bin. That means no exe.

Re: OgreRails = A railroad implementation demo

Posted: 31 Aug 2011 21:21
by uzurpator
Like the guy above said. I can download the sources, not quite so with the binary.

Re: OgreRails = A railroad implementation demo

Posted: 31 Aug 2011 23:22
by ohlidalp
uzurpator wrote:...I can download the sources, not quite so with the binary.
:oops: Sorry, my bad.

Well, I just discovered that http://www.github.com is a proud linux site - If you upload a file with badly set user permissions, the file is kept with bad user permissions. In this case, it meant "nobody is allowed to read it".

The Github download is fixed now, and here's also a direct download link:
http://ogrerails.an00bis.net/downloads/ ... -win32.zip

Enjoy.

Re: OgreRails = A railroad implementation demo

Posted: 01 Sep 2011 17:44
by uzurpator
1. Frame rate is OK - on Core 2 Quad 6600 @ 3ghz and radeon 6850.
2. Batch count is catastrophically bad. THere are over 800 batches in the full zoom - that is a batch count for the whole scene, not just an alpha. Where does it come from?
3. Try to not use the ExampleApplication framework.
4. Likewise - avoid using std::auto_ptr. THat thing is evil and depreciated in newest c++ standard. Use boost::shared_ptr or, if an object is often passed around, use boost::intrusive_ptr

However - looks nice :D

Re: OgreRails = A railroad implementation demo

Posted: 01 Sep 2011 22:38
by ohlidalp
Thanx for the feedback.
uzurpator wrote:2. Batch count is catastrophically bad.
I didn't pay any attention to this, I admit. I guess that's because the Loco model uses about 15 materials - every piece has it's own texture image. Or because the straight track consists of tens of separate meshes. I'll look into it.
uzurpator wrote:3. Try to not use the ExampleApplication framework.
I admit, the "Example" in it's name gives it sorta lame look - but otherwise, there's nothing bad about it, it's just another library which handles some arbitrary work for me and it does it well. I'll slowly eliminate it when it becomes insufficient or unnecessary, but right now, removing it would'n be any progress.
uzurpator wrote:4. Likewise - avoid using std::auto_ptr. THat thing is evil and depreciated in newest c++ standard. Use boost::shared_ptr or, if an object is often passed around, use boost::intrusive_ptr
std::auto_ptr is not evil in the same way that a chainsaw is not evil.
I admit, there is some controversy about auto_ptr. I'll study boost's pointers and see what I can use. Shared_ptr would work, but it's logically incorrect because I allways use auto_ptrs where the ownership is, there is no shared ownership and no passing auto_ptrs by value.
uzurpator wrote:However - looks nice :D
I' so very very glad to hear this :] :] :]

Re: OgreRails = A railroad implementation demo

Posted: 02 Sep 2011 21:15
by uzurpator
From what I see you use 4, when we disregard the ExampleApp batches.
You sould build trackage as a StaticGeometry, that is a great batch saving method.

auto_ptr - once again. Avoid like plague. This thing works in a way that you cannot guarantee.

first link
http://anki3d.org/stl-auto_ptr-a-bad-idea/

If you need something with sole ownership - use boost::unique_ptr or boost::scoped_ptr.
If you need something passed around with a pointer - use boost::intrusive_ptr
otherwise use boost::shared_ptr

Anyhow - auto_ptr will be depreciated in next c++ standard, so using it is bad anyways

Re: OgreRails = A railroad implementation demo

Posted: 02 Sep 2011 21:23
by ohlidalp
> uzurpator : Allright.

Tomorrow I'm leaving for a week's biking trip to Romania, so don't expect any updates in that period. But I'll get to it right after I return.

I'll be back 8)

Re: OgreRails = A railroad implementation demo

Posted: 29 Sep 2011 23:27
by ohlidalp
BUMP with a screenshot.
Screenshot with example CEGUI window and visual map cursor.
Screenshot with example CEGUI window and visual map cursor.
ogrerails-alpha-gui.jpeg (120.57 KiB) Viewed 31862 times
Current task: GUI and track construction

The progress is slower than I'd wish for it to be, I thought version 0.2 would be done by now, but now I'm happy that I at least coded something. So far, I've been doing mostly uninteresting internal stuff: I've ditched Ogre's ExampleFramework and, following Uzurpator's advice, replaced std::auto_ptr with boost::shared_ptr (I tried other options, but this was the simplest). On the 'visible' side, I incorporated CEGUI (credit) and added code which finds cursor position on the map (credit) and visualizes the snap-point where track can be built (it's the yellow-crossed purple puddle in the screenshot :wink: - yeah, It looks terrible, I don't know what I was thinking when I was drawing it :mrgreen: ).

So, I've got all I need to start with the construction - but not today. :P

Cheers.

Re: OgreRails = A railroad implementation demo

Posted: 06 Oct 2011 10:34
by ohlidalp
There is something going on with the track building system :wink:

Re: OgreRails = A railroad implementation demo

Posted: 07 Oct 2011 19:17
by uzurpator
This is pretty nifty :)

Re: OgreRails = A railroad implementation demo

Posted: 08 Oct 2011 04:04
by vinaximus
I downloaded and ran it. Quite nice. Plz go for it.

Re: OgreRails = A railroad implementation demo

Posted: 13 Oct 2011 15:38
by ohlidalp
I've been working on the railroad... :D
Building works, deletion not yet :-D
Building works, deletion not yet :-D
railroad-construction.jpeg (109.97 KiB) Viewed 31474 times
Uzurpator: thanx!
vinaximus: the train keeps rollin... :)

Re: OgreRails = A railroad implementation demo

Posted: 17 Oct 2011 20:54
by uzurpator
Nice :)

One question. I am going to have some free time soon, so I want to continue my branch of the development. However. I have implemented some MyGUI in my branch. How entangled are you in CeGUI?

Re: OgreRails = A railroad implementation demo

Posted: 21 Oct 2011 11:59
by ohlidalp
Uzurpator: Glad you like it.

The GUI in OgreRails is temporary, just something to control the demo. Right now, I don't know exactly what features it's going to have so I can't design a complete GUI. When time comes, I'll rewrite the whole layout into a final state.

I like the idea of using MyGUI, it's a great-looking lib, though I've never used it. I've used CeGUI because it was easy to start with, but in the future, I'd like to use something else.

Re: OgreRails = A railroad implementation demo

Posted: 01 Nov 2011 15:00
by dogcat1984
:lol: I am very glad this project continues. I just can't wait to play the completed version.