Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 09 Dec 2005
Offline Last Active Today, 01:37 PM

#5314321 help me think of cultures for my world

Posted by on 08 October 2016 - 05:57 AM

I dunno, you ask for cultures and you list biomes and races as examples.


I would think 'cultures' would go more along the lines of these, each as a distribution on a range, some with examples from history.






centralized/distributed (think 17th C. France vs. Roma or Diaspora Jews)


closed/open (think Amish vs. late 19th C. America)


monotheistic/polytheistic (1st C. Jews vs. Romans)


militaristic/peaceful (7th C. Arabs and the spread of Islam vs. the Tang Dynasty under Xuanzong in China)


sedentary/nomadic (Han vs. Mongol)




subsistence/abundance (18th C. !Kung vs. Salish)






Then there are subcultures.  Think of Caribbean pirates of the 18th century or the Church and Thieves subcultures in Hugo's Hunchback of Notre Dame.

#5314191 Self Referencing Template as a Base Type

Posted by on 06 October 2016 - 07:03 PM

Second, sadly, this doesn't seem to work for a struct inside the derived class.

Did you make the inner class public?  You didn't in your example.  It would have to be public.

#5313848 Junior Dev Job Interview: Which shirt do you think would be best?

Posted by on 04 October 2016 - 06:22 AM

I have never docked points from someone showing up to an interview because they have overdressed.

#5313846 When should I use int32_t rather than int

Posted by on 04 October 2016 - 06:20 AM

If 'int' does not match the register size of the machine then that is a defect in the compiler and is your warning sign to stop using it because there will be worse problems coming.

So, any and every compiler on an ARM processor, inc which register sizes can change depending on thumb?


Every SPARC compiler, in which the register sizes can vary up to 128 bits but addressable memory was always in 32-bit quantities?


IBM 370 with its 192-bit registers but variable-size memory addressing scheme?


What exactly is the size of a register on x86 anyway?  Is it the size of the A/B/C/D regs, or the AX/BX. or the EAX, and do you include the segment registers?  Should you really have all ints fixed at 8/16/32/64 bits (pick your register) even though your address bus is limited to 24/32/48 bits (depending on processor)?


I dunno, sounds complex to me and a simplistic solution might just not apply.

#5313082 Cleanup and return from main in case of a crash or just display error message...

Posted by on 28 September 2016 - 12:34 PM

So in your opinion, which one you would do? Throw an exception or return an error code?

Don't let exceptions leak out across DLL boundaries.  Return an error code or error event.

#5311654 Class segmentation fault

Posted by on 20 September 2016 - 10:58 AM

delete[] myBullets;

I don't see where you initialize myBullets in the constructor.


If you convert to using std::vector instead of rolling your own version of the same thing, does the problem still occur?

#5311063 Getting started with OpenGL development in linux

Posted by on 16 September 2016 - 06:41 AM

I have few questions about getting started with OpenGL development under Linux. Please bear in mind that I have never used Linux in my life until two days ago. I have done a lot of research but I'm confused about few things.
1- What is mesa? Is it a driver or something like GLEW? if it is a driver why would you use it rather than Nvidia or AMD driver? Also how can I use OpenGL without installing libgl1-mesa-dev package? doesn't libgl come with Nvidia or AMD drivers or even with linux itself?

Mesa is a big amorphous thing.

In Mesa you will find a software implementation of OpenGL and OpenGL|ES, the official Intel video drivers, the official Gallium video drivers, and an unofficial implementation of the OpenGL development libraries (it's unofficial because the Khronos group, who owns the OpenGL brand, requires a fee of US$ 10 000 per year for official recognition, and Mesa is a penniless Free software project).

Generally speaking on desktop-oriented Linux-based and BSD-based OSes, you develop against Mesa and you run against the official OpenGL or OpenGL|ES drivers, which may or may not include Mesa, Free, or proprietary binary blob drivers from chip vendors like those from AMD or nVidia.  What your OS ships in its userspace is up to the distributor, but libGL.so is usually defaulted to the one supplied by Mesa and softlinked to the AMD or nVidia binary blobs during setup.
You still need an extension wrangler library like GLEW because OpenGL uses plenty of extensions.

If I try to compile my code without installing libgl1-mesa-dev package I get an error saying "cannot find -lgl". Doesn't Linux already have the latest version of OpenGL? and if it does how can i link to it? where is it located?

The classic Linux desktop OS, like all POSIX systems, has a case-sensitive filesystem. The correct linker switch to pull in libGL.so is "-lGL".


2-Why would you use GLEW under linux? I thought GLEW only job to implement functions that links to the driver under windows. The reason for this is because windows only support OpenGL 1.0. So GLEW gives access to OpenGL 1.0+ functions. So Linux doesn't need that since Linux support every version of OpenGL natively. Doesn't it?

The job of an OpenGL extension wrangler library like GLEW is to wrangle extensions for OpenGL. Not only do different version of OpenGL have different sets of optional functionality (extensions), but different vendors supply different extensions to take advantage of their specialized hardware designs. The use of GLEW to wrangle extensions is independent of the OS on which you are using OpenGL.  If you have access to a shell command line, try typing 'glxinfo|less' and return to see, among other things, a list of extensions the driver you are currently using offers.


3- What does the "-l" stands for in "-lgl" or "-lX11"? does it stand for library?

Yes, the "-l" command-line switch tells the compiler driver (which in turn drives the symbolic linker) to look for a certain library in its library search path and use it to resolve any outstanding unresolved symbols. A switch of "-lGL" would tell it to look for a library named "libGL.so" which would be installed by the development package for GL. On Ubuntu, that would be the package called libgl1-mesa-dev but your OS or distribution may differ.


What I want to do is basically create a window and an OpenGL 3.2+ context under Linux. So I assume I only need to use glx and OpenGL. I don't want to use any other dependency that I don't have to. Can I do that under Linux? I know in windows all I need is glew, wgl and windows API.

Yes, you can just assume that Linux == X11 and write software like it's 1999. I'd strongly recommend that if you're going to write software for Linux, you target Linux and not X11 because the assumption that they're the same thing has not been a valid one for years.  If you're just writing for yourself and don't plan on distributing your code or upgrading your system, of course you can stick with GLX.  It's bundled as a part of Mesa.

I would recommend that if you want to write software for Linux and need an OpenGL context (or better yet, and OpenGL or OpenGL|ES context), you use libSDL to handle your context creation and input. The overhead is not large, the code is minimal, and your software will also work with a modern Linux OS running Mir or a Wayland display server, on desktops, laptops, tablets, phones, refrigerators, and so on.  Also, it will work on Windows and Mac OS.  One code base to rule them all.  That's a good thing.


so I my final question is, How can I find glx.h and link to OpenGL under Linux without using mesa or GLEW?

You can't. Well, you could grab the header from khronos.org, but you're still going to need the development libraries to link to.  Using Mesa is how you do it.


You will need to install the development packages required to develop against OpenGL.  I really strongly recommend not using GLX directly, but use libSDL2 instead.  If you install the libSDL2 development packages (on Ubuntu, that's 'sudo apt install libsdl2-dev') it should pull in all the other required development packages as dependencies -- that's how Linux distribution package managers work.

#5309508 How to structure my pure client/server model properly?

Posted by on 05 September 2016 - 06:30 AM

Why is there even a link between CRT refresh rates and network transfer speeds?  Are you making the mistake of having a fixed timestep?

#5308448 Why can't I print out my std::string vector?

Posted by on 29 August 2016 - 05:03 AM

MapManager &MapManager::GetInstance()
  MapManager temp;
  return temp;

This is the cause of your problem.  You end up with a reference to a deleted object because the referent goes out of scope after the return statement.  Very bad.

Global variables need to be in static storage. Either make temp a static local, a cass variable, or move it out of your class entirely and make it a namespace-level variable. It's your disguising the global as something else that's hiding your problem in the first place.  Another lesson in why globals are poor practice.

#5307359 Errors that effect a computer's system.

Posted by on 23 August 2016 - 05:03 AM

Here's the most likely scenario a develop will encounter that will damage their computer irreparably.


(1) Write a program with a tight infinite loop that taxes the GPU to the maximum of its ability.

(2) Leave the program running on a laptop and go an make a soothing, relaxing mug of chai latte.

(3) Sit down and relax, inhaling the intoxicating aroma from the mug in anticipation.

(4) Pull the laptop on your lap to check how far to completion of the infinite loop has gotten.

(5) Scream in pain and jump to your feet cursing uncontrollably as the heat from the processors sears your sensitive lap flesh with second degree burns.

(6) Spill your sugary sweet and deliciously spiced chai latte all over your laptop keyboard.

(7) Watch as the laptop shuts down, never to boot again.


Sure, it's a complex series of steps but it's about the only likely way you;re ever going to fry your computer as a game developer.

#5307357 IFSTREAM: take coordinate from file and convert 3 digit coordinate into integer

Posted by on 23 August 2016 - 04:51 AM

C:\Users\Jeff\Documents\project\main.cpp|60|error: variable 'std::istringstream stream' has initializer but incomplete type

That error message usually means you forgot to include the appropriate library header before using the class.

#include <sstream>

int main()
    std::istringstream istr("100 x 300 [1]");

    int x;
    istr >> x;
    // etc....

#5305086 Ide For Linux

Posted by on 10 August 2016 - 05:50 AM

Ah, yes, the vi vs emacs game. It feels good to be back in the 1980s again, Ronald Ray-gun and electropop, skinny ties and lofty hairstyles.  Let's do tar vs. cpio next, that's another good one.

#5304649 Ide For Linux

Posted by on 08 August 2016 - 06:39 AM

QtCreator does everything in your list.  It's also the IDE recommended by Ubuntu and shipped as a part of their SDK, so you know it's supported.  I see many of the Ubuntu developers themselves using it.


Personally, I've been developing on Linux for over 20 years and never felt the need to be limited by an IDE, but to each their own I guess.

#5303074 Cross Platform Library Question

Posted by on 29 July 2016 - 05:42 AM

that's what i thought so too, like in windows, SDL uses win32 api, etc. i asked coz i thought they are using another way..


It's not just a compile-time option.  For example, on Linux, libSDL2 autodetects whether the system renderer is X11, Mir, or Wayland automatically, then instantiates the appropriate back end (by loading a DSO) to handle the required operations.  On top of that, there's an EGL layer for handling OpenGL vs. OpenGL|ES and EGL itself needs to know the native renderer and window manager for context creation.  That gives you nine possible combinations of dynamically determined back ends on Linux alone.  None of that is compile-time, although the order in which back ends are autodetected is set at compile time (and at Ubuntu we switch the order so X11 is tried last instead of first).


Other supported platforms are simpler because they have a choice of one system renderer.

#5303005 Xml Parser, C++

Posted by on 28 July 2016 - 04:19 PM

Libxml2 -- hey, it's what I've used. You asked.