News:

Simutrans Chat Room
Where cool people of Simutrans can meet up.

Make world limits not forced to water level

Started by Markohs, November 16, 2012, 01:39:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Markohs

That's certainly doable, but  whould need some thinking  of how to define wich tiles are playable or not, and how to expose that to the user. I also suspect there whould be people against that idea.

We'll see,let's finish this first.

jamespetts

If it is doable without too much pain, I support Fabio's idea, not least because it might (depending on how it was implemented, I suppose) allow maps with dimensions greater than those currently permitted (by allowing large dead areas, for example).
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Markohs

#37
 Maybe not so much, because the only performance acceptable solution that comes to my mind is keeping the x*y array like it's now but marking the planquadrats that are outside the map somehow. This whould ofc save memory because that positions won't generate extra data structures, but will reside memory too, even it's low.

The only way to get around this whould be using some bi-dimensional hash structure to store the tiles, to allow constant time access to the tiles, and those nodes will have to be linked also to adjacent tiles to allow for iterative map processing (or maybe not). The gaps whould in that case not ocuppy memory in that case, but will imply recoding most of the simutrans inner functions, I'm quite sure this task whould take lots and lots of coding, maybe with little advantage compared with current implementation.

Introducing this whould also create lots of problems designing how the player can activate that disabled areas for playing, to layout them (they can default to water level, shore, be random...), this has also to be implemented in the network multiplay, re-design the mini-map, the vehicles routing... It's quite a big change, and I don't personally think it's worth the work it requires, atm. I'd focus other aspects of the game that need to be improved imho.


IgorEliezer

Excellent!  8)

What about rivers that end at the map limits? I guess, with this new feature, rivers would be easier to be extended if the map is enlarged.

And sloped world limits would be for those players that don't want to enlarge the map, in this case the "Enlarge map" tool would be disabled.

Markohs

I post the WIP patch here for the rest of the coders to make any comments they find necessary.

All code is dirty and non optimized, and uncomplete, the only tool that can deal with borders is the raise tool, lower is not implemented still. It doesn't show world slopes neither, still needs implementation. Paining background black like we do on underground mode renders a better result, bur forces a complete screen flush each frame, and that has very bad performance . I'm posting it mainly for kierongreen to examine because it's related to his double height patch and we need to reach a consensus. And all coders interested ofc.

There were two ways to implement this, making raise/lower tools able to raise corner1, corner2 and corner3, not only corner4, or adding a row of vitrual tiles on the edge of the map, so you could raise the grid interacting with them. I chosed the first option. I also had to extend hang_t with values to nw,ne,sw and se, to indicate wich corner was to be interacted (to be able to compare to get_grund_hang()) . This decisions might have been bad decisions, any comment is welcome.

Mind it's WIP, I know many routines are not needed and are bad quality, I just need constructive comments of what you find important to consider. I implemented this without DOUBLE_GROUNDS, I hope my implementation is compatible with it.

I attach the executable for anyone to be able to test it. Please have in mind the program can crash at any moment, backup your savegames first please, I'm not responsable of any damage to them. :)

patch and executable.

Markohs

#40
New version of the patch, and executable, this is way cleaner. If you want to make any comment please do the sooner the better, before I write more code so I don't need to change so much. This one is much cleaner code.

Tried to change the code so it doesn't affect DOUBLE_GROUNDS too much, I assumed using the lookup_hgt was a better option than trying to get the heights manipulating hoehe and hangs. The part I'm not sure can coexist with kieron's code is:


        const hang_t::typ corner_to_raise = corner_to_operate(pos);

        const sint16 x = gr->get_pos().x;
        const sint16 y = gr->get_pos().y;
        const sint8 hgt = lookup_hgt(pos);

        const sint8 hsw = hgt + corner1(corner_to_raise);
        const sint8 hse = hgt + corner2(corner_to_raise);
        const sint8 hne = hgt + corner3(corner_to_raise);
        const sint8 hnw = hgt + corner4(corner_to_raise);


Right now corner_to_operate is:


    enum _corners {
        corner_west = 1,
        corner_south = 2,
        corner_east = 4,
        corner_north = 8
    };


Does a equivalent definition for double_grounds exists?

Markohs

New version of the executable and patch.

Enlarge map should work now and render an acceptable result, but still working on how to make it better.

Basic code is finished, I'll implement the world slopes as next step. Bug reports and comments welcome.


Ters

I think it looks good enough as it is. The complete world flush might be more important than walls, unless you fixed it already.

kierongreen

Just to say I am following this, but I still have no internet access so can't see this patch in action let alone get it to work with double heights. Don't worry though, once this is in trunk, and I have internet access I'll update the double height patch :)

Markohs

Okay, kieron. :)

Yea, think so, Ters, I'll just flush screen black and include it do SVN when the release is over.

New version, not much changes, but this patch exposed the factory creation tool didn't check for the chosen grounds being inside map limits properly, it relied for the water to constrict factories in buildable places.

Same for roundabouts, the algorithm that built them tried to build roads around them, and now that algorithm might try to build outside map too.

Fixed, there might be more bugs.

Sybill

Hi, I tried your patch and it looks nice!
I still get graphic errors on the front sides when scrolling, but I suppose that's because it is not finished yet.

Markohs

thanks for trying it Sybill. :)

Yes, the clipping errors on from will disapear soon. :)

Yona-TYT


stops working when I generate a map in the "pak128 2.2.0 nightly"


Size : "1024x1024"
Water level:  -10
Mountain height: 320
Map roughness: 7



IgorEliezer

I tried the latest build (Reply #45), but it crashes.


Markohs

#50
@Igor: Try installing http://www.microsoft.com/en-us/download/details.aspx?id=5555 please and let me know if that fixes the problem.

@Yona: I'm aware of that problem, I'll post a new executable here soon with the crash fixed. :)

Thanks for your testing both!

EDIT: New executable and patch.

This is close to done, just needs a bit of code cleanup and fixing the bugs that might arise, plus world slopes. The background is painted in black now.

More testing welcome!

Markohs

Two screenshots showing the map extension now respects the old part geography to the extent of possible:


IgorEliezer

#52
Quote from: Markohs on March 08, 2013, 09:43:43 AM
@Igor: Try installing http://www.microsoft.com/en-us/download/details.aspx?id=5555 please and let me know if that fixes the problem.
Sorry for bothering you. I tried to install the MSVC package and got this message:

QuotePlease resolve the following:
A newer version of Microsoft Visual C++ 2010 Redistributable has been detected on the machine.
I run on MSWin 64bits.

Quote from: Markohs on March 08, 2013, 11:05:25 AM
Two screenshots showing the map extension now respects the old part geography to the extent of possible:
This is amazing o.O'

Markohs



Isaac Eiland-Hall

Absolutely stunning. I love it! Now my only problem is I'm spoiled on Minecraft auto-expanding the world! hehe. But that's 100% impractical for Simutrans. :)

Markohs

mmm... a bit clueless of what can be the problem, I think moving the msvcr80.dll file you have in the same directory to elsewere and trying to start the program can maybe solve the problem. I don't really know where the problem is. Another option whould be compiling this with MinGW like the niglies are, but I don't have the enviroment installed here in this computer, I'll try it later when I get to my other computer.

The only dll's that I have in that dir are https://dl.dropbox.com/u/30024783/pthreadGC2.dll and https://dl.dropbox.com/u/30024783/pthreadVC2.dll , even SDL.dll is not necessary. because they are statically linked I think in my enviroment. But I'm not really sure, I have so many build enviroments that sometimes I don't really know wich dependencies I'm adding. ;)

Markohs

Quote from: Isaac.Eiland-Hall on March 08, 2013, 02:46:08 PM
Absolutely stunning. I love it! Now my only problem is I'm spoiled on Minecraft auto-expanding the world! hehe. But that's 100% impractical for Simutrans. :)

Who knows wich cool features we can add to simutrans in the future, we'll see. ;)

An_dz

This is just amazing. Anything can be built on the corners and the terraforming tools work perfectly. The world expansion also works great. I've created myself a lake on the corner and when I expanded it, the lake was expanded a little too.

Quote from: Markohs on March 08, 2013, 02:53:29 PM
Quote from: Isaac.Eiland-Hall on March 08, 2013, 02:46:08 PM
Absolutely stunning. I love it! Now my only problem is I'm spoiled on Minecraft auto-expanding the world! hehe. But that's 100% impractical for Simutrans. :)
Who knows wich cool features we can add to simutrans in the future, we'll see. ;)
SimCity 2013 region play? :)

jamespetts

Quote from: An_dz on March 08, 2013, 03:12:32 PM
SimCity 2013 region play? :)

We can do better than that. Our servers work most of the time, and we have synchroneous multiplayer.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

ӔO

Excellent work, now mountainous maps will have mountainous perimeters :D
My Sketchup open project sources
various projects rolled up: http://dl.dropbox.com/u/17111233/Roll_up.rar

Colour safe chart:

Sarlock

Wow... this is truly wonderful.  When I get a few spare moments, I'll test it out.
Current projects: Pak128 Trees, blender graphics

Markohs

Thanks for your comments guys, another SS:

jamespetts

Ohh, I do like the edging. That is very nice.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

greenling

Hello Markohs
The photo looks very good out!
Opening hours 20:00 - 23:00
(In Night from friday on saturday and saturday on sunday it possibly that i be keep longer in Forum.)
I am The Assistant from Pakfilearcheologist!
Working on a big Problem!

Isaac Eiland-Hall

Oh, the edging is VERY fantastic. Makes the world feel like it has depth. :)

IgorEliezer

Quote from: Isaac.Eiland-Hall on March 08, 2013, 02:46:08 PM
But that's 100% impractical for Simutrans. :)
I have the feeling that it's not sooo true. Maybe...

Simutrans already uses some kind of seed number; the terrain can be generated upon map creation and extended manually by using map editing tools. The map could be expanded as you pan it... I don't know how Simutrans would handle non-rectangular maps. In Minecraft, the map is extended by adding 16x16x256-meter lots of terrain (a.k.a. chunks) as the player walks, the map can be larger than Earth's surface, even so only the visible chunks (those that the player can see) are loaded by the game -- it's a quite smart way of saving computer resources.

Quote from: Markohs on March 08, 2013, 05:13:43 PM
Thanks for your comments guys, another SS:
lalalah... I has a screen too... 8)



Anyway, it's marvelous.

Isaac Eiland-Hall

Now, now, I already want SimCity in my Simutrans... having Minecraft in my Simutrans would be just....

I'd never leave the house. Ever! :)

jamespetts

Quote from: Isaac.Eiland-Hall on March 09, 2013, 06:36:10 AM
Now, now, I already want SimCity in my Simutrans...

You might be interested in the city growth related ideas on this thread.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

IgorEliezer

For those who want to know how I did that montage: