Jump to content

  • Log In with Google      Sign In   
  • Create Account

Servant of the Lord

Member Since 24 Sep 2005
Online Last Active Today, 06:07 PM

#5170969 Isn't "delete" so pesky to type? Wish there was a better way?

Posted by Servant of the Lord on Today, 03:26 PM

delete Foo, Bar, Baz;


Oh wow, is that the result of the 'batch-delete' proposal from the new C++14 standard? I didn't know it made it in the final release! happy.png

There's so many great features that made it into the latest C++, I haven't looked through them all.


[Edit:] After hearing about the potential speed gains, I made a quick performance test, and found that ApochPiQ's version runs almost three times faster than the old method! It must allow some additional compiler optimizations (probably using SSE4's deallocation parallelization) under the hood, since it's batch-deleting them.


I've already gotten started converting my code base over, and so far the results are very promising. Unfortunately, the latest Boost builds don't yet use it - someone really needs patch the major opensource libraries to take advantage of the new speedgains. mellow.png

#5170800 OK, so... what now?

Posted by Servant of the Lord on Yesterday, 11:36 PM

The only languages I've ever actively screwed with myself are HTML and CSS.

HTML and CSS aren't programming languages. If you have ever used Javascript, that is a programming language.

When I have Python, I'll tackle C#

There's no need to plan to do both - they are both different tools, but both are powerful and flexible enough to make games. Yes, sometime down the road you might need to learn another language, but try not to lock yourself into a set-in-stone path until you have gained enough experience and knowledge to make an informed decision.

C# is not better than Python, Python is not better than C#. Neither is a stepping stone to the other - but both have enough similarities that learning one will help make learning the other easier, regardless of which you learn first. They also have enough differences that you have to invest time in learning each one individually in-depth to fully leverage their strengths.

Really, you could jump from language to language and you'd actually do yourself a disservice, if you aren't investing in learning at least one language really deeply. Unless you go below the surface level 'syntax' (visual presentation and layout) of languages, you can miss out in really learning important programming concepts.

I recommend choosing a language - whichever common main-stream language it might be - and sticking with it for at least two years; otherwise, if you switch languages only six months in, you haven't really discovered the language's strengths, even if you 'understand' all the surface-level 'features' the language might offer.

I have read the FAQ and see that C# and Python are good beginner points.

Yes, they are good languages to learn. But don't think of them as "beginner" languages that you'll discard later. They aren't. They are both languages with different strengths, and you'll probably find opportunities to continue to use them for years to come, regardless of how many languages you might know. Just because I have a screwdriver and screws, that doesn't mean I no longer use my hammer and nails.

However, I am a quick learner - and I do know some of Python already from him so I don't expect that to keep me busy for too long.

Learning what a class is and a function is doesn't even begin to scratch the surface of programming.

Syntax varies from language to language, and many concepts are shared between languages, but there is alot to learn programming-wise that has nothing to do with syntax.

Syntax tells you, "How do I write a piece of code in this language?". But you need to actually learn, "When should I write this piece of code instead of another piece of code, and how do I get all the pieces of code to flow together as a cohesive whole?".

Learning how to nail two boards together (syntax) doesn't tell you how to build a house. If you try to just wing it, the house will be all out of shape, the floors will probably collapse, the rooms won't line up properly, water will leak from the roof, the walls won't be straight, and everything will creak when walked on.

I've been told several times that, for what I would like to do, I need to learn [ActionScript].

You haven't actually told us what you're trying to do. wink.png For all I know, none of ActionScript, Python, or C# could be good choices.

#5170798 Pixel art tutorials for the visually challenged?

Posted by Servant of the Lord on Yesterday, 11:20 PM

In what way are you visually challenged? Color-blind? Informing us might help us suggest ways to overcome it. Or was the thread title meant more tongue-in-cheek? I often jokingly say I'm musically-challenged, but I don't have any real hearing impairment other than a lack of experience and exposure to music (driven by a lack of real interest). Is that what you mean, or is there a physical problem you're having to work around?


As a technical person with no natural skill in art, I can relate. With my own work, it really is that the more I've done it, the better I've gotten. My original art was really terrible, but I accidentally put myself in a position where I was required to make alot of tile-art, and over the years the art has improved alot. This is one of those areas where you really do need to put in your 10,000 hours of practice.


Following tutorials helps somewhat, but no tutorial will make you a skilled artist unless you also put in alot of practice. Unless you have innate art skills (which alot of people seem to!), you can't just start doing and expect to make awesome art overnight, or even in so short a time as several months. You should notice your art getting better, from month to month, but you probably won't be able to just churn out really great art for a year or so. At least, I couldn't! laugh.png


When you say you've tried to follow tutorials but "it just doesn't seem to be working for me", do you mean you've only been working at it for a few weeks, or do you mean you've already been trying hard for a few years? There is no shortcut to actually putting in the 10,000 hours of practice it (supposedly) takes to master a skill. Even if you're not wanting to 'master' it, and just become semi-competent in it, that still requires more than a few weeks of dabbling around.

#5170782 Chance, Choice, or Conspiracy?

Posted by Servant of the Lord on Yesterday, 09:29 PM

Assuming the event cards are drawn by chance, then there is already some chance in the results regardless of which game design method you go with, so I wouldn't go with the dice roll.


Instead, I'd use the player-choice option, with the tokens, and I'd make events cards that are predominantly negative, predominantly positive, or a mix of positive and negative. What I mean is, both events you showed are predominately positive - though the first card has a low chance of being negative, a small chance of doing nothing.


I'd theme the 'color tokens' as player attributes (for example, Strength/Constitution, Intelligence/Knowledge, Speed/Agility, Luck/Favor), or perhaps as proficiencies and skills (Computer knowledge, Wilderness knowledge, Military knowledge, etc...). Each event gives the player 3-5 possible outcomes, and the player can either choose the 'default' option, or spend one or more tokens to 'buy' a more favorable outcome.


I'd make events like this: (MS Excel mock-up)


(colors given just as an example - actual costs and colors would vary from event to event)


...with various tweaks depending on the cards. Some very bad events might give you no way of escape, only paying to mitigate the damage done, or some events may let you (get harmed, no harm (small cost), harm different player instead (high cost)), and so on. Some cards, perhaps drawn at the beginning of every round from a different deck instead of a specific player drawing it, could do some really good benefit to the highest bidder among players - demanding a specific color of pay, or could benefit every player that opts-in to pay the specified fee, or could damage every player who doesn't pay the fee, or could damage everyone player except the highest bidder (using a card-specified color).


You could toss in conspiracy cards as well, but I'd focus most the cards on player choice. I'd probably make the event cards focus less on, "Do you have X or Y color tokens left, or did you already use them?" and more on, "You have enough for A or B, which equal benefit (or which equal detriment) do you choose?" and also on, "You have enough to benefit yourself +1 point or detriment a competitor by -1 point, which do you choose?".


Perhaps in this regard, the color-tokens reduce choice, so players should maybe just have one type of token, and choose between {No token option A, no token option B}, {1-token option A, 1-token option B}, {2-token option A, 2-token option B}, {3 token option}, and so on, depending on the specific card.


Some randomness is good, but you already have randomness by drawing from a shuffled deck.


This is me just throwing out creative ideas (using what you've already mentioned), rather than suggesting any kind of balanced design mechanic. tongue.png

#5170676 Understanding Qt At a Deeper Level

Posted by Servant of the Lord on Yesterday, 02:24 PM

Then, there are, signals and slots. It sounds like they have some sort of special definition that's triggered by the Q_WIDGET macro.

The Q_OBJECT macro actually; any QObject-derived class can make use of signals and slots. The Q_WIDGET macro implements the Q_OBJECT macro for QWidgets, adding additional QWidget-specific features.

The 'signals' and 'public slots' 'private slots' macros actually generate basically no code.

'signals' is:

#define signals public

(It just makes the following functions publicly-accessible)

And 'slots' is defined as:

#define slots

(It doesn't create any code)

The benefit is that Qt's preprocessor (qmoc) can search for the 'signals' keyword and the 'slots' keyword, and then know that any function declarations that follow it are signals or slots.

Also, QWidget::connect()...

You mean QObject::connect() - QWidgets inherit QObject's functions.

Also, QWidget::connect()'s 2nd and 4th parameters are of type const char*, and it's common practice to use the SIGNAL() and SLOT() macros to pass through prototypes of functions (not methods because they don't appear to be associated with any class). I understand that that I'm calling two functions that these widgets seem to have, but how does that work under-the-hood, exactly?


Here's a link I found interesting in the past: http://woboq.com/blog/how-qt-signals-slots-work.html

#5170427 How video game level architecture fundamentally differs from reality

Posted by Servant of the Lord on 30 July 2014 - 01:40 PM

The ol' Fallout 3 Paradox.  How did this wasteland get so... densely populated?  biggrin.png


I'm currently struggling with this problem.  There is a fine line between Stuff! Everywhere! and a hiking simulator.  I don't want either, and I'm not finding the middleground.


The Elderscrolls 3: Morrowind had alot of travel between different towns and dungeons. Sometimes it'd take 15-20 minutes to hike to a location you were needing to go for an optional sidequest or that you happened to read about and wanted to visit. But it didn't feel too much. Maybe it was slightly nearer to the 'hiking simulator' than it should've been, but overall it was a good balance. (Warning: It's been nearly a decade since I played it, so my memory might be influenced heavily by nostalgia)


Morrowind had limited quick-travel, which I thought was cool. You could only quick-travel (via Mage Guild teleportation) to major cities, or quick-travel by boat to (some) coastal villages, or ride on silt striders to (some) towns. A good portion of your time was spent walking around exploring and traveling, but in an actually enjoyable way.


There was really only one thing that made the travelling not enjoyable - that lack of variety of enemies to fight. Sure, you'd encounter the occasional bandit, but mostly you just got woken up at night by rats that you can 1-hit KO, or get attacked by the most annoying flying creatures ever that'd always interrupt your travels with non-challenging and purely annoying inconveniences. Rarely did you encounter an exciting travel enemy.


This kind of open-world game doesn't work as well for heavily-linear plots.

#5169935 Modding Mass Effect: what do i need to know?

Posted by Servant of the Lord on 28 July 2014 - 08:54 PM

You may want to try a mod-specific community; especially if you can find a community with experience with Mass Effect. We can help with abstracts, but can't give detailed instructions unless one of us happens to have modded Mass Effect in the past.


Most 'modding' happens by replacing or modifying existing files, without doing any programming. Things like, "Change X to Y", whether they are images, sounds, 3D models, or damage amounts, constant game values, and so on.

Backup the entire game directory before you begin, so you can undo any changes if you accidentally bork your install.


The more complicated modding requires programming, and it requires access to the game's source code, and requires learning the basics how that specific game's code architecture is laid out. People who have already explored that architecture can help you in much more specific ways.


Likely the game language is C++, so yes, you may need to learn bits and pieces of C++. However, since you aren't writing the game from scratch, and since C++ is in some ways similar to C#, you really only need to know enough to half-way understand it, unless you intend to make serious modifications. Many games also use scripting, and if Mass Effect uses scripting, you may need to learn bits of that instead (or in addition).

Learning the basics of a second language is much easier/faster once you know the first language. You won't be able to master the unique strengths of each language overnight, but you can pick up the basic syntax fairly quickly.

#5169851 Passing Objects

Posted by Servant of the Lord on 28 July 2014 - 02:39 PM

For instance, a button class requires the graphics library, event manager, sound manager, its x and y position, width height, filepath etc...

Are you aware of initializer lists? They help clean up your constructors a decent amount.
Also, if you are using C++11 (which you should start using if you're not already), you can initialize class members directly in the class declaration:

class MyClass
    int x = 0;
    int y = 0;
    std::string imageFilepath = "../My/Default/Path/To/Image.png";

Coupled with function-overloading the constructor, these C++ features should help clean things up. You might also have some higher level architectural problems, but I'm not sure.

You haven't even seen his code. How would you know if it's coupled? This whole post is built on a baseless assumption.

Oh yeah? Well then your code is too coupled also! tongue.png

#5169814 [SOLVED] What is a browser?

Posted by Servant of the Lord on 28 July 2014 - 11:18 AM


While they likely do use DirectX and OpenGL on some level, they don't have to. They could've just as easily done their rendering in SDL or any other graphics library.

Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D.

So it's kind of the same thing, just a wrapper.

Everything is a wrapper over something else. Even DirectX is just a wrapper around each videocard's unique card-specific hardware assembly language.
If you dismiss something as "just a wrapper", then you can't say they are written "in" DirectX. Ultimately, everything is made of assembly, as you know. Different assembly languages for CPUs and unique assembly languages for GPUs. With CPUs we have an intermediate assembly language, so many types of CPUs can share that "lowest common denominator" in common, but that's not really the point.

The point is: Web browsers are made of the exact same "stuff" videogames and Microsoft Office, and Notepad and

They can use any language and any API they want to, as long as the resulting program runs properly on our computers. The fact that some of them just so happen to use C++ and some of them maybe might use DirectX unintentionally at some point of their multi-layered APIs is inconsequential.

You asked multiple questions, so we're giving different answers to different questions.

Your questions were:
A) What is a browser?
See my first post.

B) Browsers like firefox, chrome, etc. Aren't they simply DirectX/OpenGL applications?
No, they are regular computer programs, but they don't need to use DirectX or OpenGL.

C) So [people in general] could use C++ and Direct3D 11 to make a browser like firefox?
Yes, they can choose to use that language and that API and make a browser if they wanted to. They wouldn't be bad choices.

D) So say I could [on my own] make a [feature-complete] browser like firefox [from scratch]?
Not really, they are very very large multi-person projects. Making them from scratch AND making them feature-complete is nowadays too complex of a job for a single person. Even Google when making Google Chrome used WebKit so the vast majority of the complex work was already done for them. Later, they forked WebKit, and the forked version is what Chrome currently uses.

E) So say I could [on my own] make a [simple, not feature-complete] browser?
Yep. See Karsten_'s answer.

F) So say I could [on my own] make a [feature-complete or semi-feature-complete] browser like firefox [using pre-made components like Google did]?
Yep - see my first post for the API I suggest.


You are misunderstanding DirectX and OpenGL.

If that's the case then I'm struggling to figure out what they are. The way I see it they are the two main Common Denominators for Graphics that actually render(in the sense that it's not CPU/software rendering but using a GPU). Am I wrong, what the deal here?

You're very close. They don't have to run on the GPU, and even when they are running on a GPU, they don't have to have all their code running on the GPU. They both define specifications, and others write 'drivers' to fit those specifications. How the drivers go about doing what the specification says is up to the driver - and what mix of hardware they use is also up to the driver.

Also, browsers don't need to be hardware accelerated. It wouldn't be unreasonable to make a pure-CPU browser, and until recently most browsers were running on the CPU (now they are mostly CPU with a little bit GPU).

#5169586 [SOLVED] What is a browser?

Posted by Servant of the Lord on 27 July 2014 - 02:10 PM

A 'browser' in general, is a program used for viewing ("browsing") certain types of files. For example, Windows Explorer, or MaxOSX's 'Finder', are file browsers.
Picasa is an image browser.
Web browsers are just regular computer programs - regardless of what programming language or APIs you use, most allow you to compile to executable files for the computer to run.
The name 'Web browsers' is reminiscent of back fifteen years ago when the world wide web was a collection of static HTML documents that you downloaded. Your browser would download an html file from a remote server, and then display the file. You click on a link and it'd go download a different file. Think of it almost like a huge inter-linked collection of Microsoft Word documents.
Nowadays, most webpages are generated on-the-fly to make them dynamic on the server side, and have embedded scripting to make them dynamic on the client side.
The 'world-wide web' is all the websites you visit that are hosted on internet-accessible computers. The 'web' is a subportion of the internet. When you play Counter Strike, or Call of Duty, or whatever, you are playing those games on the internet using certain protocols. And when you access websites, you are using different protocols. So the web is part of the internet, but it is not the whole internet. Everyone nowadays calls the web 'the internet', which is perfectly fine in common talk, but in technical terms, the internet is much larger than just the web, but web browsers mostly only browse the 'web' part of it.
To write a web-browser requires alot of work - you have to be able to talk back and forth to web servers using standard protocols, and be able to parse overly complex and cutting-edge modern as well as archaic deprecated file formats, knowing how to lay out and render a web page in many different window resolutions, handle scripting, data storage, and other things of that nature.
It'll save you loads of time if you let existing libraries handle the complex stuff for you in a standard way, and just write the code for the buttons around the webpage stuff.
Infact, Qt even integrates WebKit, making simple web browsers easy enough that they have a basic web browser as an example application.

#5169377 Problems with a multi race empire

Posted by Servant of the Lord on 26 July 2014 - 03:43 PM

The aliens could have evolved space travel already, when the game starts? Either they have built little empires themselves, or just colonized various planets, that are sort of independent of each other (or a loose federation-style).. this way you dont need as much species as you have inhabitated planets.

Yes, I was thinking about it too, but it has one important problem, it does not really allow assimilating planets one by one. Imagine a player wanted to make one planet that already belongs to a federation to join his/her empire, wouldn't rest of the federation react? Wouldn't they oppose it? Especially if the player wanted to conquer that one planet... The whole/primary idea behind a federation is mutual defence.

If China invaded Taiwan openly, would Japan, South Korea, and Vietnam just watch in silence? They'd know that they are next, so would join forces rapidly to collectively oppose China.

Or, when Germany invaded France, did the British do nothing? Nope, then sent all the soldiers they could rapidly muster to go oppose them. Ofcourse, you also have people like Chamberlain trying to make peace where no peace can be made ("Oh, Germany's never going to attack us, they'll just invade a few of the smaller nearby nations...").

Plus, even if we talk about peaceful assimilation, I find it unlikely that an alien race would want to leave a federation composed 100% of their brothers to join an empire of some aliens...

There are always differing viewpoints. Some in Ukraine want to join Russia, most don't. But there's always the "some" who don't like the current government. Every so often a bill appears before Texas (and gets struck down) about seceding from the United States.

What about having the planets immediently near the player's starting point be single-planet races, but then as the player goes farther out he encounters multi-planet races.

10 races owning 1 planet each is 10 planets (nearest to the player)
5 races owning 3 planets each is 15 planets (medium-range)
5 races owning 5 planets each is 25 planets (farthest from the player)

50 planets total, with only 20 races, and it helps ramp up the difficult slowly, and also brings added game dynamics as you play. Early on you didn't have to worry about attacking one planet, but later in the game you have to worry about possible counter-attacks even after you conquer your target.

#5169337 Chances of getting Blackmoor Bay crowdfunded

Posted by Servant of the Lord on 26 July 2014 - 11:13 AM

I didn't mean it to sound personal at all -- it wasn't about me and you, it was more of a comment on crowd-funding's bizzaro finances.  I've had the same criticism of it from the start, even though I back plenty of things.  Many people think it is a fine model for accomplishing projects, but the inner capitalist in me just thinks of it as investment without ownership, equity, or royalties.


Does the same thought process apply to developers using KickStarter merely to "launch" projects that are only a month or two out from release? That is, it's more clearly a pre-order, because the game is at this point almost entirely created.

#5168786 What is a 3rd dimensional array?

Posted by Servant of the Lord on 23 July 2014 - 08:01 PM

My game uses a 1 dimensional array to render levels and this was cool but it not enough anymore.


I find 1D arrays easy and more powerful than 2D, 3D, or 4D arrays. Sometimes simpler tools are more effective. wink.png


How does a 3rd dimensional array work? How should I use it.

You probably shouldn't use it - it's likely not something you need. Technically, you can have a six or seven dimensional array. For 99.9999% of programmers, they'll never need to use a 6D array.

Note: Just because we offer refer to 3D in terms of space: width, height, and depth. We're actually describing space using dimensions. The dimensions just describe data. The 4th array of a 4D array doesn't mean 'time', even if some physicists use the 4D to describe time.

Memory in your computer is 1-dimensional. Your RAM is 1-dimensional. When you create a 2D array, you aren't creating a 2D block of memory - you're just mapping [y][x] to a 1D block of memory.

If you create your own 1D array that is large enough to hold your data (width * height), then index into it using similar math to what C++ is using behind the scenes ((y * width) + x), you get all the advantages of a 2D array, and all the advantages of a 1D array.

std::vector<char> myArray;
myArray.resize(Width * Height, 'X');

//Indexing as a 1D array:
for(int i = 0; i < (Width * Height); ++i)
   myArray[i] = (i % 3)? 'O':'X';

//And also indexing as if it were a 2D array:
for(int y = 0; y < Height; ++y)
   for(int x = 0; x < Width; ++x)
       std::cout << myArray[Index(x, y)] << " ";

   std::cout << std::endl;

[Test the code]

Also, just incase you weren't aware, std::vector< std::vector<int> > is not a 2D vector. It is a 'vector of vectors', with each vector potentially having a different length - probably not what you want. That used to confuse me. happy.png

#5168749 Weird Syntax Tricks

Posted by Servant of the Lord on 23 July 2014 - 05:02 PM

I'm rather partial to Duff's Device. I was positive it wouldn't compile the first time I saw it. tongue.png

switch(count % 8) {
case 0:	do {	*to = *from++;
case 7:		*to = *from++;
case 6:		*to = *from++;
case 5:		*to = *from++;
case 4:		*to = *from++;
case 3:		*to = *from++;
case 2:		*to = *from++;
case 1:		*to = *from++;
	} while(--n > 0);

Interweaving a while statement with a switch statement is just weird. blink.png


"This code forms some sort of argument in [the switch-case fall-through] debate, but I'm not sure whether it's for or against." - Duff

#5168725 What now?

Posted by Servant of the Lord on 23 July 2014 - 02:31 PM

Still, if I am going to make a pong game, I need in one way or another to load sprites etc.

Wouldn't that be a very primitive engine if the code does all the basic stuff?


When it comes to engines like Unity, I have no idea how they are made.

(Could anybody explain how?)


Either way, I guess I will start out simple with some Tic Tac Toe, Tetris and Pong.


'Engines' are siren songs to new programmers lured by the idea, but they just lead to you crashing on rocks.


Games don't require 'engines'. What even is an 'engine'? Some mythical concept you once heard somewhere that sounds appealing and impressive? smile.png


Games are made out of code.


After making several games, you start to realize that that you are re-writing a few of the same portions of code (how to load an image, how to open a window, how to play a song, and so on).


You then realize that these pieces of code that you've rewritten several times could be written in a way that they can be reused by multiple games, instead of being recreated over and over. So you start collecting these reusable pieces together in a 'library'.


As that library grows, and you reorganize it multiple times, you start to realize that some of the reusable components actually describe common game logic at a higher level. Things like movement and collision and cameras and scripting and AI. You also start to realize that some common architectures (higher-level code structures) are taking shape.

So this game logic and architecture is organized to form an 'engine' that is specific to certain types of games.


  • Games don't require engines (especially smaller games). Games are made out of code. 
  • When you start to build up your own library of reusable code functions and classes, they help speed up development (allowing you to use the extra time to make bigger games).
  • When the code library starts to gain game logic and higher-level architecture, then it should be reorganized into an 'engine'.
  • An 'engine' is a fancy term to mean pre-boxed game architecture and logic.
  • Different games require different architecture and logic, so it is possible that for some game projects choosing the wrong engine will leave you fighting against the engine to make the game.
  • Some pre-boxed architectures are more generic (like Unity or GameMaker), and some pre-boxed architectures are more genre-specific (like RPG Maker).
  • You don't set out to build an engine, you set out to build a game. After several games, you can refactor out common components.
  • Engines aren't built from scratch apart from games, unless you've already built so many games (and by extension, game-specific engines) that you're really experienced at it. Otherwise, people tend to have the habit to put in all the things they think they need, or write architecture the way they think it should go, without the experience (from dozens of completed game projects) of knowing what they actually need or what actually works.


Some people build engines for fun, instead of building games for fun. That's fine! If that's what you enjoy (the architecture side of things), go for it!


But if you think you need to build an engine to make your game, you probably aren't seeing the forest because all the trees are in the way. wink.png


If you want to learn how to make good engines, then write (and finish) lots of games and then observe what features and architectural structures you find are common between their codebases.