Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 18 Oct 2005
Offline Last Active Yesterday, 10:50 PM

#5251072 The technical side of game design

Posted by on 07 September 2015 - 05:08 PM

I don't know if this is the right forum for this.


Are there any resources for the technical side of game design on the web?  By the technical side I don't mean how to code and stuff like that.  What I mean is something that would lead to less inexperienced game designers from trying to make Skyrim on a gameboy advance.  In other words an article that is a sign of the time in regards to what is possible and what isn't, and the techniques (not necessarily implementation) that would allow for the more taxing behaviors of certain types of games/graphics.  Something that would allow a game designer to communicate better and be a more effective member of the team rather than just "being a dreamer". (not my opinion)


Whats possible on a given platform is pretty much irrelevant.

The only thing that matters is: 

What can your team actually do with the platforms you have access to in the time you have available for it ?


Designing any reasonably complex game without knowing what human resources you have available is pretty much doomed to fail, the platform is only a consideration if you are pushing close to its limits (and even then your human resources will be the biggest factor in determining how close to the limit you're actually able to get).

#5249542 How would I be able to do this in C++?

Posted by on 29 August 2015 - 04:52 AM


Did you remeber to #include ?


He is probably not using C++11.



The error message implies that he is compiling in C++98 mode using a compiler that also supports later versions, probably gcc


passing -std=c++11 to the compiler should fix that, in code::blocks there should be a checkbox under settings>compiler>compiler flags that he can check.

#5249231 Games on non smart phones?

Posted by on 27 August 2015 - 03:06 PM

Does anyone know anything about this, both pre smart phone era and current non smart phones, I'm pretty sure a lot of them used/use the Symbian OS, would these games be created in Java, can anyone shed any knowledge. What languages/tools are used. Just curious really.


Symbian is a smartphone OS(and it was quite dominant before Apple entered the market with a more consumer oriented device), apps for symbian were written in C++ and later versions(after 2010) used the Qt framework (Which made it a pretty awesome smartphone OS to develop for, it was imho superior to both iOS and Android from a developers point of view at that time but by then it was already too late.)


non smartphones tend to run Java Micro Edition "apps" which are far more limited, you can get everything you need for that here: http://www.oracle.com/technetwork/java/embedded/javame/javame-sdk/downloads/javamesdkdownloads-2166598.html

#5249227 Terraria clone. What do I need to learn

Posted by on 27 August 2015 - 02:48 PM

Hello fellow programmers.

I want to make a terraria clone. Ofc in alot smaller scale. And i therefor wonder what kind of skills i need to learn to do so.

What is the difference between procedural generation of my map and perlin noise generating my map array. Ive tried out Perlin, to get my array filled with random numbers.
Are those the same thing or am i all wrong?

What other skillset do I need to learn?

Im a newbie so go easy on me smile.png


procedural generation is a broad term that can refer to pretty much any form of data generation where the software creates data based on a set of rules (which may or may not include perlin noise), perlin noise is good for procedural terrain since it creates clusters of similar values that have reasonably "natural looking" shapes but you probably want to do more, you can for example add rules to modify the terrain based on things like slope and altitude,  add caves, add objects, etc. 


This one can be worth looking at: http://www.roguebasin.com/index.php?title=Cellular_Automata_Method_for_Generating_Random_Cave-Like_Levels

allthough it is intended for top-down rogue-likes you can use pretty much the same method to generate caves for a terraria clone (generating a bunch of such caves and placing them at not quite random positions below some suitable depth is fairly easy and makes the maps a bit more interesting)

#5249085 Question about deprecated OpenGL functionality

Posted by on 26 August 2015 - 06:02 PM

I am working on a game that I initially just used immediate rendering for, knowing that I'd revisit it and implement vertex/texture coord/color/etc buffers when the time came. So then I was reading in this thread that a lot of OpenGL stuff that I learned way back when (in the 2000's) is deprecated now.


My questions are:


  1. How much harm will I suffer if I use this deprecated stuff? It seems like it still works well enough. Is there any performance hit associated with using it?
  2. I saw this basic tutorial on shaders, and in fact have a attenuated point light shader sitting in a git branch, but it just shows how to color a fragment a solid color. Is there any easy, drop-in shader that I can use to handle the basics that I listed above, until I'm ready to dig deeper into writing my own shaders? (UV mapping, colored vertices, etc).

If there are any other resources I should be looking at, please let me know. It's hard to know how old the tutorials you're looking at are sometimes. There's still stuff out there with ARB functions in it that looks current at first glance...


1. If you are using immediate mode you will get significantly worse performance (especially if you are pushing tons of vertices to the GPU) and a lack of shaders does greatly restrict the flexibility of your renderer.


2. There are tons of pre-written shaders you can download and pretty much just drop-in but if they are basic(the GPU driver should replace fixed function UV mapping and colored vertices with shader equivalents for you anyway) you won't gain much by doing so, for a basic renderer the main performance advantage comes from using VBOs rather than pushing vertex arrays to the GPU once per frame, or worse, pushing a metric crapton of individual vertices to the GPU each frame with glVertex calls.


once you are using VBOs however you will have to use vertex shaders to do more fancy transformation of the vertices (i.e, skeletal animation) as doing that on the CPU will require you to re-upload the mesh each frame (which is fine if your scenes consist of 10-20k vertices but not quite as fine if your scenes contain 30m vertices), if you are modifying your vertex arrays right now (rather than just rotating, translating and scaling them) you will have to convert that code to vertex shaders in order to use VBOs effectively.


fragment shaders are less useful for basic renderers but becomes almost essential once you try to implement more advanced effects (if you use the fixed function you're pretty much limited to stencil operations and blending the results of multiple render passes together in various ways)



edit: it is worth keeping in mind that "significantly worse performance" is still insanely fast, the deprecated stuff is not slower today than it was in the late 90s or early 2000s, its just that GPUs have become several hundred or even a few thousand times faster while PCIe x16 is only around 30 times faster than PCI (4GiB/s vs 133MiB/s) and only 2 times as fast as AGP(2GiB/s for AGP8x) so the amount of data you can send to the GPU each second hasn't gone up much at all.

#5245768 default install folder for windows game

Posted by on 11 August 2015 - 10:43 AM


What's the advantage to "everything in one folder"? I'm missing something here.


backup purposes primarily. and no chasing down long directory trees to mass delete saved games through the OS (ever tried to delete a couple hundred savegames in skyrim from inside skyrim?).



and yes at the moment, the game just uses current working dir, no specific paths. so you can install and it works anywhere (well, at least anywhere UAC allows). this also means you can freely move the game folder without breaking anything. however, such a setup does not take user permission systems into account. i remember first noticing way back at OSU (late 80's)  that such a setup is really not the UNIX permissions way of doing things.



Things like backup actually becomes easier if everyone plays by the rules and stores things in (roughly) the correct place, As a user i don't want to keep backups of all my installed games (doing so would require insane amounts of space and re-installing them from disc/steam/gog or a downloaded installer is trivial) and i definitely don't want to set my backup scripts to make backups of C:\Program Files\game1\saves  , C:\publisherX\game2\saves, D:\game3\saves, etc


If all applications behave as they should i only need to make a backup of the user folder and everything that can't be re-installed will be covered (documents, photos, code, save games, settings, my browser bookmarks, etc, etc), if i use network/domain user accounts (or just store the user folders on a NAS and configure the local users on all machines to use that) i can share all that stuff between all my machines seamlessly while still having all the big game assets, binaries, etc on a local SSD on each machine for fast loading.

#5243421 default install folder for windows game

Posted by on 29 July 2015 - 01:15 PM

whats a good default install folder for a windows game?


i'm about to post beta 21 of Caveman with skinned meshes. But i noticed that in Inno setup, i'm installing to \program files(x86)\caveman.


i've had one user with issues caused by a corrupt UAC file and use of the program files directory.


Also, skyrim modding guides recommend moving steam out of the program file folder due to UAC issues, protected folders, having to run as admin, etc.


So installing to protected folders can cause issues.


So whats a good default non-protected folder to install under?


(multi user) application binaries should go into FOLDERID_ProgramFiles, application data should go into FOLDERID_ProgramData and user files (save games, settings, etc) should go into FOLDERID_LocalAppData.





if you want to support legacy versions of Windows you can use the CSIDL equivalents


If you want non admin users to be able to modify the binaries you should default to FOLDERID_UserProgramFiles (single user installation) Available in Win7 and later, for Vista you can fall back to FOLDERID_LocalAppData and add \Programs or something to the path (You should never ever install multi user binaries in a location where non admins are able to modify them as that compromises the systems security), even if you do single user installation you may still want to share some or all data between users (if you have several gigabytes of levels, artwork, music, etc you probably don't want each user to need their own copy even if they each have their own binaries)

#5241830 LWJGL exported JAR; Texture Flickering

Posted by on 21 July 2015 - 07:04 PM

	public static void DrawQuadTex(float x, float y, float width, float height, Texture tex) {
		glTranslatef(x, y, 0);
		glTexCoord2f(0, 0);
		glVertex2f(0, 0);
		glTexCoord2f(1, 0);
		glVertex2f(width, 0);
		glTexCoord2f(1, 1);
		glVertex2f(width, height);
		glTexCoord2f(0, 1);
		glVertex2f(0, height);

The memory usage from my program does seem to be ridiculous. Upwards of 300mb at times. I checked if I was making multiple objects, and I wasn't, so I thought maybe there was a problem with my drawing method. Is there a flaw with this?


This is my first experience with LWJGL so this is essentially copy pasted from a tutorial, though I did my best to make sense of it.



Other than the fact that you're using immediate mode (Which pretty much became obsolete in 1997 when OpenGL 1.1 was released) and that you probably shouldn't combine binding a texture with the drawing (if you draw using the same texture multiple times it is unnecessary to bind before each draw), it would also be a good idea to push and pop the matrix rather than calling loadidentity if you absolutely must manipulate the transformation matrix inside the function.


Nothing in there should cause flickering though, only worse than necessary performance and a bit of inflexibility.

#5241457 Unity: Storing and using weapons and objects

Posted by on 19 July 2015 - 09:44 PM


There's honestly a ton of ways to do this. The most straight-forward would be to just create a script file that defines the properties of each item, though, its also least flexible in that it makes it difficult to change things after you've shipped.


A data-driven approach is probably preferable, like Derek suggests; you can use JSON or some other format to your liking. Load and parse them at run-time so that you can add or change the items later if you need. There's a way to specifiy that an arbitrary file is meant to be published with your Unity game package, rather than processed at build-time. You might want to do some basic hiding/obfuscation of any plain-text files, just to deter the casual cheater, one easy way is to put these things in a .zip file, or to do some basic XOR "encryption" -- but don't get caught up trying to come up with a perfect anti-cheat thing because you won't (people much smarter than you and I haven't yet in their entire careers, you or I aren't going to do it in our spare time) all you want is to prevent people discovering easy cheat attacks while casually browsing your game files.



More generally, the tendency with Unity, especially if you're less experienced, is to think of everything in the game as *the* thing -- you have a game with 12 loaves of bread, and you literally have 12 loaves of bread defined inside Unity, and maybe you help yourself out with prefabs. But what your really want in this instance is not to define disticnt game-objects for each instance, but to be able to create instances from a kind of recipe. What you store in the JSON (or whatever) file, is the recipe.




Use a json string like this.


{"id":"Sword1", "attack":"5", "crit":2},
{"id":"Sword2", "attack":"12", "crit":1}

and then parse it and load up your object that way.

Or create prefabs in unity for all your objects and have a weapon component that holds all the weapon data. Then you can use the unity editor to edit these weapons.

So like WeaponData would be a component with an attack and crit variable.

Then create a game object and add the component to it. From here you can now save the game object as a prefab. You can now copy and past this prefab to your hearts content and rename then and have each as a different weapon which you will be able to edit individually.



Thanks so much to you both for the tips, I know almost nothing about JSON, so I'll try to know better and then say it solved my problem... I believe that is the best way. The JSON is supported by Unity or any additional plugin is required? Thanks!





There is a port of JSON.Net for Unity that you can use, there are also a bunch of json libraries in the asset store.

#5240676 Multy player Game limit per area

Posted by on 15 July 2015 - 09:49 PM

Really server side as long as you're not rendering the actions of players you could have a huge number of people in one spot from what I know. It's just making them appear on screen that is the issue.



Not really, more players in an area = more events occuring and more players that you need to send each piece of data to which cause outgoing bandwidth requirements to scale exponentially as you increase the number of players in an area.


When we hit MMO scale (10.000+ players) we can do a bit of fun math:


lets say we use 2 8 bit values for x,y (delta)  , don't use z and orientation as a 8 bit value and send each player the position and rotation of all other players 10 times per second then we would send 9999*10000*10*24 bits per second or ~24Gbps,


by splitting those same players up into 1000 instances/areas with 10 players each we would only use 1000*10*9*10*24 = ~2.16Mbps upstream bandwidth for the same number of players and the same update frequency. (most games will require you to send for more data per player but the difference in magnitude stays the same, 1 room with 10.000 players is roughly 1000 times more expensive to host than 1000 rooms with 10 players each if you use a basic approach to networking.


MMOs have to work around this problem by throttling updates based on distance and importance and designing things in such a way that players will spread out (you can't effectively throttle updates based on distance and importance if everyone is having an all out brawl in a small room) and if there is content that alot of players will be doing at the same time you may have to use instancing for that content or make sure players will naturally spread out within that content(There may also be gameplay reasons to use instancing (smaller battles make each players individual performance more important). I would strongly recommend against moving players between instances on the fly (it sounds like it can get incredibly messy as even though it is fairly easy to keep players who are in a group together it will be a nightmare to keep track of interactions between groups (if group A is fighting group B and group C is moving in to pick off whatever remains after the fight you can't really separate those groups either without disrupting gameplay), assign groups to an instance as they enter the content (i.e, as they pass through the dungeon entrance) or design the content in such a way that players will spread out by themselves and add safeguards to deal with high player concentrations.


For pvp dungeons where you want competing groups to fight over the price i would either create dungeons with 2 or more starting points(depending on how many groups I want it) and then treat them like WoW battlegrounds (players queue up for it and start when all groups are ready) or have people join an existing instance when they enter unless all currently running instances are either full or close to finished (probably having the enemy respawn rate and/or enemy power/numbers get reduced in sections the previous groups have pushed through to give those who enter late a good shot at catching up and fighting the ones who started before them without giving them a clear path)

#5239660 Game engine or programming luanguage?

Posted by on 10 July 2015 - 08:22 PM

When i tried to look this up on google some people said that if you know a programming luanguage you can make a better game because you are not limited by what Unity offers but games like:endless legend,cities skylines,rust are made in unity and seem like very good games.Can someone explain me how this works?Do they combine in some ways?


All general purpose engines use one or in some cases multiple programming languages, Those engines take care of the low level stuff (rendering, resource management, physics, sound, interactions with the underlying OS, etc) and provides various tools (level/scene editors, animation editors) + some functionality that lots of games will need (basic pathfinding, a few basic shaders, etc), You can't even make a pong clone in Unity without using a programming language, The editor only lets you create the paddles, walls and the ball and configure their appearance and physics properties and if you set the ball in motion using the editor the engine can make sure it bounces off the walls and paddles.  

You still need to write code that moves the paddles(atleast the AI one, you can probably find a controller component that works for the player paddle in the asset store), counts the score and resets the ball after a player scores.

#5238722 Massive Python Example Script

Posted by on 07 July 2015 - 02:16 AM

I'm not sure if Python supports overloading operators or passing class objects as parameters, forgive my ignorance here, but in languages that do this sort of thing is normally handled as an addition. For example in C++, rather than have a move() method, you would do:

Vec2 a(10, 20);
a += Vec2(5, 4);
In something like Javascript which would not support overloading, you tend to see (not a javascript guy either so this is probably wrong):
var a = new Vec2(10, 20);
a.add(new Vec2(5, 4));
Most of the things you would want to do with vectors when treating them as points in a Cartesian space have an equivalent mathematical interpretation that applies in the far more general sense, where "move" would be the wrong term but "add" is always correct.



in python you can implement the __add__ and __radd__ methods to overload the + operator.  x+y will try to call x.__add__(y) and if the method returns NotImplemented and x and y are of different types it will try y.__radd__(x) instead (if that also fails it will raise an exception)


something like:

class Vector2:
    def __add__(self, v):
        if not isinstance(v, Vector2):
            return NotImplemented
        return Vector2(self.x + v.x, self.y + v.y)
    def __iadd__(self, v):
        if not isinstance(v, Vector2):
            return NotImplemented
        self.x += v.x
        self.y += v.y
        return self
    def __mul__(self, v):
        if not isinstance(v, numbers.Number):
            return NotImplemented
        return Vector2(self.x * v, self.y * v)
    def __rmul__(self, v):
        return self.__mul__(v)
    def __imul__(self, v):

#5237129 If-else coding style

Posted by on 27 June 2015 - 12:11 PM



This isn't strictly game related, but I like you guys so I thought I'd post it here. I work with C# for my job, and we have to undergo code reviews. Yesterday I finished a work item and used code similar to the following in several places:

SomeType GetSomething 
        if (somecondition) 
            return something; 
            return null; 

My code review was completed as "needs work" on the grounds that the above code was "very misleading", which I don't get at all. I understand the "else" isn't necessary here, but I think it not only makes it much more readable, but perfectly follows the way the getter would work if you were to describe it in English: "If this is true, return that; otherwise, return null". Without the else, if you didn't look into the "if" block you might think that the getter ALWAYS returns null. With it, you instantly understand that either the "if" block executes and returns, or the "else" block executes and returns, without even looking at the contents of either of them.

Even if you consider the above to be unnecessary, I still don't get how you could call it misleading. It does exactly the same thing as the alternative he was suggesting (remove the else and just return), only it's much more explicit about it: which is the exact opposite of misleading.

Anyway, I just had to rant about that. I love my job, but everyone I work with is a very experienced coder from different backgrounds, and sometimes our ideologies conflict. What are your thoughts?



Personally i would invert the logic

get {
    if (!somecondition) {
        return null;
    //code goes here
    return something;


This keeps the primary exit point for the function at the bottom and the early return caused by some invalid state sits right at the top.

#5232460 VB.net limitation question

Posted by on 02 June 2015 - 02:45 PM

So if I understand correctly, I am safe to continue with VB.net for my MUDs, but should think about C# if I plan to add pixel-based movement? Most of the graphics in the game i'm working on currently are static images loaded from a file, with only a couple exceptions to some menu stuff that is animated.


Don't worry about it, VB.Net is fast, modern PCs are fast(and by the time you actually release something they will be even faster), pixel based movement and animation is computationally trivial and if you need to do some really heavy data mangling there is most likely a highly optimized low level library available that does it for you regardless of what language you use.


Unless you have a very good reason performance should be the last thing you consider when you choose a language, your primary concern should be platform support(The language you use must work well enough on your target platforms) and after that you should look at things that enhance your productivity (language features, tools, libraries, etc), performance is only a concern if your language makes it difficult to reach your performance targets (and you are almost guaranteed to run into a situation where your chosen language makes it slightly difficult to reach your performance target long before it makes it anywhere near impossible).


I would still recommend looking at C# though but not because it will make your applications magically faster (it won't) and not because it lets you write unsafe code to squeeze a bit of extra performance out(if you need to write alot of unsafe code you might aswell use a low level language) but because it is a very nice language to work with and it has a huge community and tons of great tools.

#5228439 High Score class issues

Posted by on 11 May 2015 - 03:50 PM

Hello, I am having some issues with saving the high score of a game. Can you guys tell me if there is something that looks wrong here? Also, is there a way to read the high score from the existing file when the game starts up, and then set it to a variable so I can display it on the screen? The text file was added as an existing item to the game, it is in the same location as the Game.cs and Game.ico files. Thanks in advance.

    internal class HighScore
        private int number;
        internal static bool onExit = false;

        internal void ReadHighScore()
            FileStream fileStream = File.OpenWrite("HighScore.txt");
            TextReader textReader = new StreamReader(fileStream);

            number = textReader.Read();


        internal void WriteHighScore()
            if (number < Klax.score)
                FileStream fileStream = File.OpenWrite("HighScore.txt");
                TextWriter textWriter = new StreamWriter(fileStream);

                File.WriteAllText("HighScore.txt", String.Empty);


        internal void Update()
            if (PauseMenuScreen.quit == true)       //This is suppposed to trigger the WriteHighScore function in the PauseMenuScreen class
            {                                       //When the user quits, the score will be saved if it is higher than the previous high score



The HighScore.txt file should be in the applications working directory (This is not necessarily the same as the directory containing your sourcecode), if you are using visual studio then the working directory when you run from the IDE will default to the project files directory, if you run from the commandline it will be the directory your executable is in.


The Read method of the textreader class reads a single character (so if your file contains 15345 the read method will return the 32 bit value for '1' (which should be 31 if your system uses any common encoding) , you want to use the ReadLine method instead to read the full line (since you are writing a textfile) and then use Convert.ToInt32(stringYouReadFromTheFile) to get a correct integer value from it.


(There might be other problems with your code aswell)