Jump to content

  • Log In with Google      Sign In   
  • Create Account


We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.

Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Member Since 09 Jun 2000
Offline Last Active Dec 23 2014 04:42 PM

Posts I've Made

In Topic: Programming a website?

30 November 2014 - 07:24 PM

There is a dirty little secret.
Creating a webpage is really just playing around with HTML (and CSS). No programming involved really.
You can make really really nice looking professional websites with just HTML and CSS and a few images.
HTML is just a markup language meaning its just a bunch of tags enclosing text (just like the bbcode tags we have on this forum).
CSS is used to manipulate the properties of every HTML tag to change how the browser renders it.
Now if you start creating websites with animations and drop down menus and stuff then you will need javascript. 
I'll save you the shock. Javascript is nothing like Java. Its a scripting language where every variable is a var type (has hidden data types internally) and classes are really functions. It's totally weird.
If you want to have connectivity to a database and use forms and the like then you will probably want to learn PHP which is a scripting language that is ran by the webserver and stdout from your script is feed to the web browser (your script prints out the webpage).
Now you can have it where all of the logic happens on the server (in your php code) and HTML is printed out to the browser OR you can have javascript call your script and parse data printed out from your PHP script and it can repopulate fields on the screen (more advanced).
However, C++ won't be of any use to you unless you take a walk on the wild side.
There is this ancient concept called the CGI-Bin or CGI binary: basically your web server calls up an executable on the command line passing the get string in the command line and passing the post string as stdin. The CGI-Bin will print out the webpage as stdout. It will also have environmental variables set by the webserver (like what browser they used etc).
I used the CGI-Bin way to create an e-commerce site entirely in COBOL for a school project (showing off of course).

Or you could use a web development methodology from this century :)

Things have long since moved past PHP and cgi. There's no reason to use either of them unless you're maintaining a legacy project. PHP in particular is an unholy abortion of a language.

On the client side, you need to know HTML, some CSS and JavaScript. But really most development uses various js libraries, so you'll want to learn jquery, node.js, etc. if you want a framework to tie it all together angular.js is pretty cool.

On the server side, REST is the way to go. You can use pretty much any language you want, as long as you provide a RESTful web api. You Can even use C++ is you want

In Topic: Multiple Inheritance or lots of pointers?

27 November 2014 - 10:24 PM

Ask yourself a simple question when deciding to use inheritance: is a dog an animal, or does a dog have a tail?


So in your case, an entity is not a mesh, it's not physics data, etc. But it does have those things.


In general, this is what's know as "favouring composition over inheritance".


edit: damnit, ninja'd

In Topic: C# .Net Open Source

24 November 2014 - 02:41 PM

One thing that hasn't been considered in all this GC discussion is that the GC only knows about memory.

That's it.

The C++ "RAII" idiom actually can clean up any resource immediately. And this is incredibly important. It is, in fact, so important that .NET has the IDisposable idiom to perform RAII-like tasks in its GC world.

Yep, and that means you get scoped RAII the same as C++, so I don't really see why that's an issue?

And they don't do anything for you with non-memory resources.

Not entirely true. Consider the following class

public class Resource<T> : IDisposable
    where T : class, new()
    private readonly string _id;
    private T _resource;

    public Resource(string id)
        _id = id;
        _resource = new T();
        Console.WriteLine("{0} acquired", _id);

    public void Dispose()
        if (_resource != null)
            _resource = null;
            Console.WriteLine("{0} released", _id);

In this case, the resource can either be manually scoped (i.e. using) or if we're not concerned about when the Resource is released, we can let the GC take care of it

new Resource<object>("global");
using (new Resource<object>("local"))

// output 
global acquired
local acquired
local released
global released

In Topic: Building A Game Engine + Game

23 November 2014 - 09:19 PM

Now, if you're talking about using C++ effectively/efficiently, then I'd partially agree.  For me, learning C++ wasn't so hard, but learning to use it properly was a bigger challenge, one that I'm still learning as the language evolves.

Well, I wasn't talking about writing "hello, world".

Learning to use it == learning to use it properly.
The very fact that you feel you have to differentiate between the two is symptomatic of the issues with c++.

Maybe you were some kind of c++ savant, but I've seen hundreds of beginner and junior programmers make mistakes in C++ that just don't happen in other languages. It is demonstrably difficult to learn for most people. If it wasn't, we wouldn't see those kinda of threads.

In Topic: Building A Game Engine + Game

17 November 2014 - 09:34 PM

In all honesty, I'm interested on why you dislike C++ (especially with the experience you have in the field). I'm not trying to be an ass or anything, I'm genuinely curious.


rolleyes.gif Did you read my posts?


I don't dislike C++.


I simply recognise that there are a lot of corner cases in the language that can make it difficult to write bug free code. Because of that, I don't recommend it as a beginner language. A lot of the things that are features in C++ (control over memory management, for example) actually make it more difficult for beginning programmers. 


These issues are well documented. There are more than enough threads on this site alone about problems with C++. Again, it's not that C++ is bad, it's simply that it's designed for people who know what they're doing. 


You will be far more productive initially in C# or Python than you will in C++. Part of that is the language, part of it is the library support.