Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


BitMaster

Member Since 08 Aug 2000
Offline Last Active Today, 04:50 AM

#5145300 I have some new habits.

Posted by BitMaster on 08 April 2014 - 05:55 AM

...


Taking anything to the extreme will always get you into hell's kitchen. Thinking of OOP as something everything must use will. Thinking of OOP as something that must be avoided at all cost will too.

The hallmark of a good developer is not blind religious obedience of a few dogmas. Instead it's about finding and putting the correct pegs into the relevant holes (unfortunately real-life problems seldom boil down to "round vs square").


#5145290 DRM protection

Posted by BitMaster on 08 April 2014 - 05:14 AM

Personally I require a clear "no DRM" before I buy any game nowadays. DRM translates to an instant "no" regardless of how much I would otherwise want a game. Considering GoG.com appears to be the second most important online distributor behind Steam and there is little reason to buy from GoG over Steam when you do not care about the DRM-issue, I don't think I'm exactly alone in that boat and going no-DRM opens a largish part of the market to you which would otherwise be completely closed to you.


#5144315 Problem with multyple function with same name but different parameters and i...

Posted by BitMaster on 04 April 2014 - 05:54 AM

Both are valid, it's just that putting them into the implementation is in almost all cases useless (and equivalent with not having them at all). The compiler needs to see the default parameter to use it (which it can only do if they are in the header when it is working on a different compilation unit).

The error probably happens because the OP is calling the function with three parameters and the only overload that makes sense in that case is the (int, SpecialEffect&, int*)-version, which obviously does not work out.


#5144265 OpenGL Tutor

Posted by BitMaster on 04 April 2014 - 12:12 AM

The point of an open forum is being a resource. I do not mind spending some of my free time here answering questions because it's ultimately a good cause.

However, you are asking for private tutoring. That has absolutely no benefit for the community as a whole. In general you will find that actual professionals or competent hobbyists are unwilling to do something like that. You'd have to pay them and you cannot pay their rates. The people who are willing to do that for cheap or free will often be people who will ultimately be of no (or negative help).

If you have questions or problems there are a lot of resources out there (if your Google-fu is weak, consider just looking at the OpenGL Wiki as a starter) or ask questions on forums like this. This also has the added benefit of keeping things more correct.
In a one-on-one session as a newbie you have no chance to detect misconceptions, outdated or plain wrong information. If it happens in an open forum like this chances are high it will be called out an corrected. It is not uncommon for the would-be teacher to learn something as well when they find their information is outdated.


#5142876 MSVS's preprocessor vs gcc's preprocessor

Posted by BitMaster on 28 March 2014 - 10:26 AM

You are currently sitting in several distinct holes:

(1) you appear to be learning your first programming language

(2) you are learning C++

(3) you are trying to use the non-default compiler for your platform

(4) you are trying to work with an API you don't know yet

(5) you are trying to work with a library of a 3rd party

 

Now, ideally you want to limit the number of holes you are in at the same time. Especially hole (1) does not really interface well with other holes. Personally I think combining holes (1) and (2) is not a good idea, but apart from a friendly warning (consider it given) I will not stand in anyone's way.

 

I won't go into extensive discussions about the merits and future of free Express Editions of MSVC. To be honest, I don't really care and at this point neither should you. What you produce at this point is not worth keeping. I don't say this because I believe you are stupid or because I try to be unkind. I say that because learning C++ takes time. If Microsoft shuts down MSVC Express a year from now and none of your code works on other compilers you have not really lost anything.

You did gain a little bit of proficiency in the language though. Enough to try your hands at hole (3) for example. That's an interesting hole. It's annoying at first but with sufficient understanding of how your tools are supposed to work and a bit of googling it's solvable.

 

I would strongly advise that every decent programmer tries their hand at hole (3) - once it is in their skills. But that is something you have to solve/research yourself. If you have to run onto a forum without any idea what's happening, it's too early.




#5142501 MSVS's preprocessor vs gcc's preprocessor

Posted by BitMaster on 27 March 2014 - 01:48 AM

( a lot of ppl here use gcc and i just don't get why tbh...)


I use MSVC at work. It's an important skill to keep up when you intend to earn your living in this area.

However, for my own projects I'm using gcc. I do, however, never use the command line (unless I need to compile some external libraries, but running 'make' in directory would hardly qualify as really working with the command line). There are plenty of IDEs available to pick from, personally I have come to like QtCreator after a few initial difficulties. In the grand overall I would actually consider it more useful for my needs than MSVC, with the sole exception of debugging.

That said, there are ample reasons to pick the gcc compiler over the MSVC compiler. Most of them have to do with the suboptimal (to avoid saying 'non-existing' in areas) C++11 support. In a time where C++14 becomes very relevant Microsoft's flag ship compiler still avoids some areas of C++11. Also, gcc makes your life easier writing standard compliant code, especially if you crank the warnings up.
Additionally I have a decade or two experience with various flavors of MSVC IDEs. Getting used to a new version does not take a lot of time with previous experience (the most important learning step I had to go through for MSVC 2012 was googling how the hell you get rid of the CAPSLOCK in the menus).
On the other hand my work project needs to work on Windows, Macs and two kinds of smartphones (both working with gcc or the extremely similar clang). And while I'm currently only needed in the Windows-part, it's nice to keep some emergency skills ready.

Also, both the work project and my personal projects use CMake. Should I decide I need to switch out the compiler it's taking a few minutes to generate a new suitable project file for the new target compiler/IDE (some more time to rebuild all required dependencies might be needed).


#5142336 MSVS's preprocessor vs gcc's preprocessor

Posted by BitMaster on 26 March 2014 - 10:28 AM

How exactly does triangle.cpp look now?


#5141181 Compiling opengl code using gcc through the command line

Posted by BitMaster on 22 March 2014 - 03:11 AM

There are plenty of good, valid reasons not to use MSVC. What you wrote up there is not among them.

 

That said, Dev-C++ is the most useless replacement you could pick. It's ancient, unmaintained and full of bugs. There are some forks of Dev-C++ which are still actively developed but other tools have several years of headstart on them.

Before using Dev-C++ I would rather use a current gcc without any extra help, just a text editor and the command line. gcc 3.4.2 (which is what you are using) is ten years old. For all intends and purposes it is completely useless to get something done nowadays. Whatever problems you have probably originate in obsolete tools.

 

Investigate Code::Blocks or QtCreator if you want a modern, free IDE. Several other options exist.




#5139410 DrawLine args name confusion

Posted by BitMaster on 16 March 2014 - 05:34 AM

one thing i noticed one day is that namink like x0, y0, x1, y1
are somewhat logicaly wrong becouse  logicaly it is (should be) more like
0.x 0.y 1.x 1.y  [not x.0 y.0 x.1 y.1 ]


I assume you never had formal mathematical education? Because writing x0 (the closest you can get to a subscripted index usually) is probably the most native and canonical way for a mathematician to deal with the issue.


#5137088 Room Based Euclidean Map

Posted by BitMaster on 07 March 2014 - 02:40 AM

When considering Rogue Legacy, there are a few things to consider first (the following is based on observation, not being involved in the game). The individual rooms are not randomly generated. There is a (large) set of handmade rooms available. These rooms have several exit locations. These exit locations can be 'open' or 'closed'. Exits in 'closed' state seal off an (again handmade) area of the room with blocking tiles.
Each room has an integer size in map-tiles (I believe from 1x1 to 3x3, although I haven't played the game for a while). One map-tile is always NxM room-tiles big (the actual number does not matter, the point is you can easily fit rooms together in a map like that and exits are always in the center of a map-tile edge).

These design decisions make a Rogue Legacy-like map generation actually a lot easier. In pseudo code:
Place the starting room.
While the map is not big enough:
   Pick a random 'closed' exit E in any room already placed
   Pick a random room R from the library of possible rooms (all exits of this new room are 'closed')
   Pick a random exit E' (opposite direction of E) of R and try to place it in the map so that E and E' connect
   If that is possible without overlapping with existing rooms in the map: (*)
      Place R in the map
      Iterate over all other 'closed' exits of R
         If there is a corresponding 'closed' exit in the room in that direction, set both to 'open'
The check at (*) is actually extremely simple. Since everything is neatly on map-tiles, there is exactly one way how you could place the room in the map and the check could be as simple as a bitmap with one bit for each map-tile.


#5136484 Providing a download link

Posted by BitMaster on 05 March 2014 - 04:01 AM

If files are intended to be used in following activities it would be much better to protect the "usage" of these files.


That implies implementing some kind of DRM. First, implementing even halfway working DRM is far from simple. Second, when it works it usually annoys your honest users more than any illegitimate users.

Nowadays I flat out refuse to buy DRM-protected software and sites like GoG do quiet good business to cater to my needs (which implies I'm not exactly alone in my dislike of DRM since there are far more convenient places to buy games if you don't care about the DRM state).
It should also be noted that they don't have a widespread problem with pirating of their DRM-free games. For example when The Witcher 2 was published (simultaneously DRM-free on GoG; as well as other channels, including a DRM-protected hard copy) there was a pirated version of it available within hours. The pirated version available was the cracked hard copy though. The DRM-free download version did not make it into any kind of widespread circulation.


#5135814 Memory overwrite after allocating 4k ints

Posted by BitMaster on 02 March 2014 - 02:36 AM

Your class violates the Rule of Three (depending on your needs Rule of Five in C++11). Either the class must be noncopyable or implement sane copy semantics.

 

If you have access to C++11 I would rather suggest to use std::vector instead of an int* pointer in the class and trust the compiler-generated copy/move constructors/assignment operators.




#5134992 Converting password to number

Posted by BitMaster on 27 February 2014 - 04:12 AM

You will want to read about hash functions, specifically cryptographic hash functions.


#5134835 GLSL

Posted by BitMaster on 26 February 2014 - 02:14 PM

First, while this looks (on first glance) like a reasonable fragment shader, there is no vertex shader. Do you have one? Have you verified that both compile correctly? If not, what are the error messages? Have you verified that the program is linked correctly? If not, what are the errors?




#5134709 Inheritance question

Posted by BitMaster on 26 February 2014 - 04:04 AM



virtual ~Base(){};
...although I shouldnt need a destructor unless I allocate dynamic memory within the class, right?


No. A simplified real world example I once encountered was

class Base { };

class Derived : public Base { std::string m_myString; }

// ...
Base* p = new Derived;
// ...
delete p;
The std::string inside Derived never gets destroyed. If it allocated memory (which it likely did) then that memory is not freed.

Even beyond indirect memory allocation you can get problems. File handles might not get closed. Other scarce system resources (like sockets) might remain open until your application terminates.




PARTNERS