Sunland Villagers (was: Learning OpenGL/LWJGL)

Much better, but…

Left and right are inverted ???

I’m not quite sure which left and right you refer to? Mouse buttons? Scroll directions? Both appear to work the same on my computer as they did in the former versions.

Or I just fell through the looking glass and didn’t notice ;D

Probably the scrolling, i was referring to the right and left arrows on the keyboard.

I see. I had forgotten about the key bindings and indeed they have been inverted. Will be fixed in the next release, thanks for the report :slight_smile:

I’ve been working on buttons for the UI … on one hand I like how they turned out, on the other hand I ask myself how to make the UI more clear to the player. The upper group of buttons selects the type of things to be shown for selection - buildings are then subgrouped into three more groups. Maybe this was planning “too big”, and just one panel would be good enough for all buildings. It would make the UI appear less cluttered also, to have only the upper button group.

Ideas and feedback are welcome :slight_smile:

Maybe you should create some kind of table with all buildings / chains for yourself.
When you have enough buildings, you could try to find out what would be the best way to group them.
Are you going to work in different techs / ages / styles or something, then these could be nice groups.

The most important is that you know what you wanna put there, the amount of time i have put in GUI’s i needed to throw away due to new insights… :S

I have no plan of all buildings yet … I thought I’ll start small and “let it grow”. But I must admit, this sort of game design is among my weaknesses. The next building which I have prepared is a home for a clay-digger, who will produce clay for a pottery and a brickyard.

There fit 3 buildings in a row in the panel, and it has space for 7 rows, so there is space for about 20 buildings. It will definitely take a while to have this many.

Well i dont mean planning evrything beforehand, but i bet you have some sort of plan going on?
I mean groups like this:
Social - Material - Food - Misc

Or like:
Primitive - Middle age - Colonial - Modern

Also, i would recommend an scrollbar, so you wont have to worry about fitting stuff into category’s :slight_smile:

I suggest just having pictures of the buildings in small picture tiles. It is easier to recognize images on one full page than it is to see buildings split into different size groups. If you have different ages, that is the only way I’d see you splitting buildings per age. People can tell how large a building is if you leave a shaded footprint on the land, or just show a small text that says “3x3”.

Tried it out. Worked fine. Sawmill not doing any work yet? It doesn’t seem to do anything.
Suddenly an extra flag was being drawn a bit right and down from another flag it seemed to be mimicking. Whenever a log was placed at the “real” flag, a log would also be drawn at the mimicking flag. I tried to click the flag with the “?” active, and it asked me if I wanted to remove it. I clicked remove in the box, and the game crashed.
I’d recommend adding the line “pause” to the end of your .bat file, so users have a chance to write down an error message for you. Alternatively, make an errorwriter, which writes errors to a text-file we can send you.

I guess my motivations were quite a bit convoluted. Once I liked the Settlers II game a lot, and had already tried to make a clone some years ago, but I stopped it. I don’t remember exactly why. I couldn’t find the sources anymore though, so I had to start freshly.

Recently my interest picked up again and I looked for open source Settler remakes - I found two, but both in C++ and I don’t like C++ anymore. I tried one of them, and it felt a bit incomplete, still rather good:

http://wl.widelands.org/

I was considering to port it to Java, but they program in a style which I don’t like, and porting seemed to be about as much work as writing it freshly in Java. So I started coding from scratch. I also considered doing only the code and using their graphics and map data, but I don’t like their way to store maps, and I don’t like some of their graphics.

Admitted, my own way to save maps is very kludgy, so beyond the “don’t like” I have no reason for making a format of my own. And the graphics - I’ll make my own ones where I think I can do better, and borrow from theirs where theirs are better.

Widelands is open source and GPLv2, my project is also open source and GPLv2, so it’s no problem to share elements between the projects.

Now that I have the basics together (landscape, pathes, carriers, buildings, workers, storage …) I feel uncertain how to continue. I’m not really a game designer, just a programmer and self-tought graphics artist.

I see that I could go and make my own game from the elements that I have, but my design skills aren’t good enough, I guess. I also could try to make an amalgamation of Settlers II and ideas from the Anno series, but since I didn’t play any of the Anno games, and don’t know much about it, it will be difficult. And I certainly could make a plain Settlers II clone, but I don’t want to do that, I’d at least like to expand the concept, and leave out the fighting and military parts, replace them by trading and negotiations.

I have a lot of options right now, and don’t know which way to go :-\

I’m not sure if I understand this correctly. The panels show small versions of the buildings, isn’t that what you suggest? The grouping by size was due to the assumption, that if there are a lot of buildings, it is easier to switch to a given group (assuming one remembers the buildings size) and have a smaller number of buildings to search till the right one is found.

It doesn’t produce anything yet. I added it to test the goods distribution code. The sawmill has a higher priority to get trunks than the headqarter/warehouse has. I wanted to see if the priorities work.

I’ll add the pause to the batch file. I have no real ide how you got the duplicate of the flag, but the games structures allow such a bug. I’ll keep an eye on it, maybe I find the reason (it must have been registered twice at different locations, but I don#t know what input/event would make that happen.)

Meanwhile I have continued to work on the UI, and this is the current incarnation.

Thanks for all the feedback :slight_smile:

You’re very welcome. It’s looking good. I like the buttons :slight_smile:

About the bug…it might have been something like scrolling the map with right-click while having the flag-planting thingie turned on, while left-clicking ferociously. I was trying a bunch of right-clicking+left-clicking and generally being an idiot, trying to force “The Settlers” behavior ^^ It’s a good thing. It’s all a bit hard to get used to ATM, but with a few kinks ironed out, I could be very happy playing this game. Anyway, you should definitely ensure that nothing gets built, unless the clicking is done exactly right. Be vigorous in your control-system from the beginning. It’ll make debugging that much easier along the way.

Good luck! Looking forward to building massive cities to test your memory-handling ^^

I have some problems to display proper windows/popups on top of the OpenGL display. After some consideration I decided to just let that be and display the results of an inspection below the map. It’s not perfect, but it seems to work. The “start.bat” still misses the pause command, but it includes the new UI buttons:

http://sourceforge.net/projects/sunlands/files/v0.15/

Talking about memory problems - since the release I already found one. Carriers were not removed from the list of all carriers when their paths were removed, and remained in the list. Once this was a memory leak, and it also could cause propblems if later another carrier was created for the same path as one of the “old” carriers. Will be fixed in the next release.

I’ll also look into the mouse handler. At least I can ignore left clicks while the map is dragged. I must say I didn’t think of that, and you made me curious now what sort of effects one can trigger in the original Settlers game this way ;D

Logging to a file should be in the next release too.

Thanks again for all the hints and tips :slight_smile: Soon the sawmill should work too …

Im getting really tempted to give this genre a try, like your doing.
Also an reason why im posting so much in this WIP project :wink:
The only problem is that graphics is an issue here, cant draw anything nice myself.
What program are you using to draw the buildings, or did you just download them?

You should make your own menu-system to be displayed inside OpenGL. It’s a bit tedious, but if done right, you never have to do it again :slight_smile:

Maybe this could’ve had something to do that extra flag?

I don’t think you should screw with your mousehandling at the source (your mouseevent handler). More like limit the actions that it triggers.
In the original Settlers they used left+right-clicking a lot. If you did it on a road, it would ask if you wanted to remove it. If on a flag, it would prompt the “send geologist to flag”-window. If done on the build-menu button, it toggled the “where-can-I-build-what” overlay, which you’ve already implemented. There are a few more, but I think those were the primary ones.

Great! It’ll make it much easier for you to debug :slight_smile:

You’re welcome. Looking forward to it :smiley:

Left + right click: I didn’t think of that, so far the code is designed to trigger an action on left click, and scroll/drag the map on right click. Thanks for the info though :slight_smile:

I’ve implemented portable UI toolkits in C++ twice for old projects of mine, but I feel not motivated to do it again, even porting one of them looks too tedious. It sure has a coolness factor when doing it the first time, but it wears off soon ;D

I hope that I can get around the work by using customized Swing UI elements to the right and below the map display. At a first I was hesitant about that, because it implies larger mouse travels, and the information isn’t shown where the player looks at at the very moment, but it worked surpsingly well. The benefits are that the information is always shown in the same place, and doesn’t obstruct parts of the map display. Feedback on this decision is welcome, though :slight_smile:

It’s been surpsingly difficult to have constructions sites. The need to order construction material to the work site, wait for the arrival and finally create the building introduced quite some new states to the game data, and particularly saving and loading all states correctly turned out to be very error prone - and even small mistakes like a plank that was confirmed for the construction site, but never delivered just caused the construction to be never finished. This really requires 100% correctness. Having two game threads (+ java’s own VM threads) I still fear inconsistencies in rare cases which might be very difficult to detect and fix.

I now have something that seems to work though. The headquarter comes with 20 planks in storage right away, and construction of a building needs two planks - no rocks/bricks yet, and always two planks. I’ll expand this one the basic code has proven to be stable. The construction site graphics were done in a hurry, just good enough to show the constructiopn steps. I might do something better later, but I like the “here will be built” sign for new construction sites ;D

http://sourceforge.net/projects/sunlands/files/v0.17/

There is a small demo game included with two construction sites in progress. The sawmill produces planks from trunks now, so with a forester, a woodcutter and a sawmill you have infinite supply of planks.

At the moment I don’t try to keep saved games compatible between versions - IMO the game is too young and there are too many and too deep changes from version to version. But it’s on my list and it was a conscious decision to defer it till later. It’s just extra work that I don’t want to do while there are so much other things missing in the game, which seem to be more urgent to implement. Also a lot of bugs to hunt and fix.

Since the last release it’s been mostly bug hunting and fixing:

  • Map creation bugfixes
  • Path splitting bugfixes
  • Zoom related bugfixes
  • Landscape and buildings now fully configurable (unless I missed something …)
  • More landscape deco objects
  • Texture supersampling added (might render slower, but rendering wasn’t a bottleneck so far).

http://sourceforge.net/projects/sunlands/files/v0.18/

If you find any bugs and problems, please let me know.

Humongous bug:

  • Create a flag
  • Make a path from this flag, and end it with another flag
  • Add another flag on the path you just made
  • Now add yet another flag to the same path

SO MANY LITTLE BLUE MEN! I have 4 of them hugging the same pole ^^

You can get up to 6 ;D

Place a single flag. Build pathes from all adjacent vertices to this one flag. 6 carriers having smalltalk that the flag :slight_smile:

Maybe you found a different bug, though. I know about a problem that carriers do not stand in the middle of their path, if the path has an odd length. I tried to fix it, but it turned out to be more complicated than expected first.

I could fix a weird bug in workplace lookup though, which at times caused path not allowed on seemingly random spots on the map, because the code miscalculated this spot to be occupied by a workplace building. Most likely this bug also had other strange effects:

http://sourceforge.net/projects/sunlands/files/v0.19/

The v0.19 also has a new building, a clay diggers hut, and a new worker who can dig clay. No brickworks yet though to make use of the clay, also no pottery, but they will come.

I’ve got a few ideas for the evolution of a settlement now, and I hope I can make it a real game some day.

Well, The Settlers had a similar “problem” to what you described, when the paths were of certain sizes or shapes, the men would stand at weird points. The problem I’ve described is very different, though.

I’ll try to draw it for ya.