Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 10 Dec 2004
Offline Last Active Yesterday, 07:54 PM

#5311894 Biome based map generation?

Posted by on 22 September 2016 - 07:29 AM

Hi everyone!


I'm working on an RTS where I want to generate maps. The concept of biomes are very important as some buildings can only exist in some biomes etc. What are some of my options here?


I've found tons of articles, tutorials, samples and libraries, but almost all of them use a height map to determine biome. This gives reasonably realistic results etc, but boring since certain biome types will always be next to eachother. I want a technique that can result in a mountain with a lake to the north, a forrest to the west and a dessert to the right.


My current generator uses a fixed size tile map, randomly places some biome "centers" on it, then does an incremental flood fill to spread these biomes. The results are rather nice, but it's extremely slow and does not support expansion.


How does games like Minecraft do this? What are some other options?


* It must support populating a presized tilemap at the very least, but ability to seamlessly expand is a big plus

* Control over biome density is a huge plus. Some are supposed to be rare, others are supposed to be common, all players need reasonable access to some etc.




#5311516 Why C# all of a sudden?

Posted by on 19 September 2016 - 05:03 PM

C# is a really powerful and expressive language that can easily interop with other .NET languages as well as C. It has really good development tools. Performance wise, it's not as fast as optimized C++, but for a lot of use cases it's more than fast enough (faster than many alternatives) with some serious stability and security benefits. It's typically very hassle-free compared to Java and many other solutions on Windows, which is the platform of choice for most gamers and probably also game devs (though this seems to be changing rapidly).


Java was designed with various academic values and best-practices in mind, where C# was designed as a more practical language for real world scenarios. For example, C# has unsafe and P/Invoke integrated into the language. This makes it very good at interfacing with existing code, but is arguably unclean. C# also has both value types and reference types with the same syntax. This can be confusing and is arguably also "ugly", but extremely practical when trying to interface with native code and/or trying to control memory layouts. For things like vector math, vertex arrays and tile maps, this can make a huge difference.


C# has been embeddable since an early age, making it easy to use as a scripting language. It's very easy to use for tools that interface with whatever engine you are using. The overall cross platform support is probably worse than Java etc, but it's good enough on all platforms that are relevant for games.

#5309502 Faster Sin and Cos

Posted by on 05 September 2016 - 05:11 AM


But your link is broken.

Works for me (just tried).


It's broken for me too. You probably have cookies on your system, if you look at the link you can see that the url does not contain any names or IDs, so there's no way it could identify your snippet. The ideone link works though. :)

#5308989 Make this small algorithm branchless ?

Posted by on 01 September 2016 - 06:32 AM

What about using the loop with the floored value, then always doing the else part after the loop? I would worry more about calling functions more often than needed than the branch though..?

#5307914 Visual Studio Hardware Requirements Seem Lower

Posted by on 25 August 2016 - 03:41 PM


I bought one for my mom with 1.44GHz cpu, 2GB ram and 32GB storage

Why do you hate your mom so much?




She wanted a tablet and had an extremely limited budget. Apple stuff is 3-4x that price, at least over here, so that was pretty much ruled out. Then there are lots and lots of different Android based tablets/hybrids, but they typically rely on manufacturer for updates and stuff which means you'll want to stick with a known brand. Those are also in the upper price range. Then there are the Windows based ones with a familiar interface and familiar applications, that I can properly support (I'm an all in MS guy), for a really low price, with rather good support/maintainance from MS. As someone who has owned and used a Windows 8.1/10 tablet for years now, I can honestly say it's a pretty nice platform. The one I got for my mom is probably gonna be a bit slow, but not sure anything else would be better in the same price range, and she's a very casual user so. I guess time will tell though, she got it very recently.

#5307818 Visual Studio Hardware Requirements Seem Lower

Posted by on 25 August 2016 - 04:52 AM

Any reasonably modern PC -- basically anything built in the last decade -- can meet those specs.


Thinking on it, it would actually be an expensive trip to museum-type stores specializing in old hardware in order to build something that DIDN'T meet those specs.  


Actually, there has recently been an upswing in really cheap hybrids (as in tablets with keyboards) with very low specs. They focus more on battery time, low price and low weight, and can easily drop below those requirements. I bought one for my mom with 1.44GHz cpu, 2GB ram and 32GB storage for ~$150, including attachable keyboard and Windows 10 license. 

#5270020 What programming languages does support VLAs?

Posted by on 08 January 2016 - 04:41 AM

IIRC, some C compilers implement VLAs using malloc/free. Not sure where we encountered it, but my guess is some vendor supplied compiler for one of those non-arm microcontroller architectures.

#5269211 Criticism of C++

Posted by on 04 January 2016 - 10:06 AM

I completely disagree with you on this. smile.png


If something is implementation defined, then it's typically platform specific as well, in which case we could just as well use vendor supplied intrinsics or similar. You would retain 100% power while greatly reducing error prone-ness. Design with normal day-to-day usage in mind, not some super rare edge case.


I'm not talking about removing capabilities, I'm talking about making error-prone stuff more explicit. IMHO, language features that help me write "correct" code is extremely desired, especially for low level systems code.


As for naming standards, I agree that a language should not enforce this, but there could be a de-facto standard that everyone uses (like in C# and Java).

#5269176 Criticism of C++

Posted by on 04 January 2016 - 06:12 AM


Is that what C# (Microsoft) and Objective-C (Apple) and Go (Google) were supposed to be?

Objective-C = "Objective-C is a general-purpose, object-oriented programming language that adds Smalltalk-style messaging to the C programming language. It is the main programming language used by Apple for the OS X and iOS operating systems,"
C# = "C# is intended to be suitable for writing applications for both hosted and embedded systems, ranging from the very large that use sophisticated operating systems, down to the very small having dedicated functions."
Go = "Designed primarily for systems programming, it is a compiled, statically typed language in the tradition of C and C++"



C# is awesome, but it's mainly for application level software. You can use pointers and stuff in C# and I occasionally do, but the support is very limited and you loose most advantages of the language. A large design goal of C#/.NET is the ability to interface with existing code and we do have C++/CLI, so there's a fairly reasonable migraion path (at least if we can get C++/CLI on other platforms) but the language is still too high level.


Objective-C seems closer (never used it) but has unfamiliar syntax and seems to lack certain features that might be required. No idea about migration paths.


Go also has unfamiliar syntax and appears to be closer to Ada in philosophy. Kindof a different market than C++. Again no idea about migration paths. I have no experience with it either.


What I want is a language with C#-like syntax but for lower level stuff. Not GC-based. Modern compilation model. Less "implementation defined" behavior, either it's ok or it's not. Less relying on preprocessors. Well-defined primitives. A default recommended naming convention. No more declare-before-use except for locals. Maintain the power of C++ while making it less easy to make misstakes. Make common pitfalls more explicit (casting, switch/case fall-through, ...).

#5269110 Criticism of C++

Posted by on 03 January 2016 - 08:33 PM


No, it's there to make sure you don't pay a cost for wasted memory or speed (or even crashes) no matter which platform you are on.

If you want your data to work across platforms, you need to accept the cost and use a library or implement it yourself.

Also, if you really want standard sized data types, they already exist as a part of C99 in the form of int32_t and the like.

I know, all real world code I've seen uses those, or custom typedefs like those. I can almost never use 'int' because it might be 16 bits and not be able to hold my data while I can't use long because it might end up being 64 bits and increase my memory usage to the point of stack overflows or whatever.

Not sure what you expect. They do exactly what they say on the tin - trade performance for memory. I don't know of any hidden gotchas with them.

#include <iostream>

struct MyStruct
	unsigned int field1 : 1;
	char field2 : 7;

int main()
	std::cout << sizeof(MyStruct); 
	return 0;
One could expect 1, or 4, many (most?) compilers will give 8. The bits will not be packed in the same byte like one could expect. It makes a lot of sense when you know why, especially on little endian platforms, but still. It's easy to be confused.

A lot of that carries over from C and must be carried forward to maintain backwards compatibility with mission-critical systems whose companies cannot afford to upgrade.

Exactly. I fully understand it, I just hate it.

It's been repeatedly tried by several people and companies. All have failed because C and C++ is too far entrenched, as stated above. If you cannot provide all of the features of C and C++ and work with all existing C and C++ libraries and upgrade everyone's code for free (or prove that your new magic language is worth the massive cost of a rewrite) - no sale.

There are lots of attempts indeed, but most have no commercial backing and/or no migration path. I think there's a huge desire for an alternative, but it needs heavy backing to break in. Someone needs to actually push it, not just "make it available". I think for example Microsoft could do it, they just don't really stand to gain from it right now.

#5269078 Criticism of C++

Posted by on 03 January 2016 - 05:46 PM

I have tons of issues with C++ and I'm a true C# fanboy.


My biggest issue is the awful compilation model and the whole declare-before-use for anything but locals.


Second issue is the whole primitives-have-platform-defined-sizes thing. It's awful and completely breaks portability, which is ironic considering it's exactly what it's there for. I even work with those weird architectures and compilers that could potentially benefit from it, and still no, just no. Give me well defined regular types and then a special 'platform_int' for that extreme edge case where it would make sense, any time.


Then there's those bit field structs. They are so not-what-you-expect that several books and college educations describe them all wrong. It's a nice feature in theory, there's just way too much wtf over it.


I really dislike various implicit casting and constructing rules. Some of it can be fixed by increasing warnings and turning on warnings as errors. There are several of those I wish had been errors by default though.


I wish some heavy weight tool provider (like MS) would create a cleaned up systems level language.

#5267236 trying to think up a new way to level up

Posted by on 20 December 2015 - 04:48 PM

In FORCED (they spell it with upper casing) you beat levels, where each level had 3 crystals you could unlock. One for completing the level, one for completing it faster than some set time limit and one for completing it while also doing some challenge. A challenge could be something like "don't get hit by a single shockwave attack" or "don't use walls for cover from energy beam" etc.


Your "level" (available skill set) was determined by the number of crystals you had unlocked, so if you had a hard time completing a specific level, you could greatly benefit from going back and completing the secondary challenges on previous levels.


It suits a very particular set of games I suppose though. 

#5264857 Why didn't somebody tell me?

Posted by on 04 December 2015 - 05:39 AM

You can also scroll-click to open a new instance of an application in the taskbar. A feature that I'm using a lot more is right-clicking an application in the taskbar to open recent or pinned files/projects though.


edit: Also, you can right-click an application in the taskbar and right-click the application name in the lowest section of the popup-menu to start it in admin mode.


edit 2: If you are on Windows 8.1 or 10, you can right-click the start button (is it still called that?) to open a menu with various tools and shortcuts. It's also available as Win-X.

#5259726 Release mode crash

Posted by on 30 October 2015 - 06:30 AM

Just mentioning that if your C++ code accesses C# objects/data through pointers, you need to tell the GC to not move those objects/that data. There are methods for doing that and you can also use fixed(...){} to temporarily "lock" data in a memory position. Not doing so can cause very rare and random crashes that are very hard to track.


Edit: This probably also applies to accessing members of C++/CLI reference classes through pointers.

#5256856 C# Garbage Collection and performance/stalls

Posted by on 12 October 2015 - 08:42 AM

On that note, is anyone here privy to any details or rumblings about plans with Microsoft and Mono going forward? With the CLR opening up, is it reasonable to start seeing some unification going on there, or is Microsoft going to do its own thing on Linux/Mac while Mono goes on its way?


Mono 4.x marks the start where Mono is incorporating code from Microsofts opensourced version. From what I understand, Microsoft will continue to do develop their own thing (.NET) and Mono will probably port most of that into its implementation. In other words, they'll remain separate projects but share some code and strive to complement each other for platforms etc. I'm also under the impression that they'll be takning steps towards a unified hosting API, but that's a vague personal interpretation based on non-official statements and mailing list posts.