Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 09 Jan 2001
Online Last Active Today, 04:51 AM

#5226344 Random Number Generation

Posted by MarkS on 29 April 2015 - 02:18 PM

MarkS:  You're making the incorrect assumption that just because a person is not breaking any laws, that automatically means that the government doesn't want to stick their nose into it.  Also, a lot of what you're saying implies that keeping the algorithm secret, rather than just the key itself, is somehow necessary for security.  It shouldn't really be that way.  Although keeping the algorithm secret technically does add a small amount of security, it's the secrecy of the key and the quality of the algorithm that really protect data.

First off, I made no assumption. Secondly, this algorithm is unique. It requires a key the same length as the data and completely random. It is not breakable without the key. The key is, well, key. Without the key decryption is not possible. If I don't know you are using this algorithm, I'll waste time and use whatever methods I have at my disposal that I know will work at breaking encryption. However, once I know that you are using OPC, the only way to break it is by intercepting the key. That, as it turns out, is rather easy when you have access to, and/or control over, the delivery methods. So, yes. In this case, keeping the algorithm secret is paramount. If I do not know that you are using OPC, and no one does, so I wouldn't have reason to suspect it, then I have no way of knowing that the random data I just intercepted is the key and not more encrypted data.

Again, the key can only be used once. This isn't like RSA encryption where you send the public key to your recipient and keep the private key to yourself. There is only one key and that key MUST travel to the recipient for decryption. It is the fatal flaw in the OPC algorithm.

#5226324 Random Number Generation

Posted by MarkS on 29 April 2015 - 01:28 PM

(Edit: MarkS, I don't do ANYTHING illegal, but in regards to your interception proposition, I'm proceeding to expose my buttocks for smooching purposes, metaphorically of course.)

You totally miss the point. There is no other reason to require such a draconian encryption method other than to hide it from the only people that could possibly break it, i.e., law enforcement and government. I'm not insinuating that you are doing anything illegal, but there is simply no legitimate reason for the average person to use this method when the world's governments, military and spy agencies do not.

The interception comment was to show the fault in using this method. Let's assume that you have data that all of the world's governments would kill to possess. By keeping the fact that the data is encrypted via a one pass cipher a secret, you effectively prevent their ability to get access to the data, $5 wrench method not withstanding. A one pass cipher requires that the cipher (remember... ONE pass) be transmitted prior to each encrypted message. Therefore, you must get the cipher to the recipient in some fashion. Now that I know you are using this method, decryption of your data becomes a simple task of interception. Governments are good at interception. REALLY good!

The only solution to this would be to encrypt the cipher with some other method prior to transmission. That then negates the whole purpose! If another method is acceptable to encrypt the cipher, then it is probably acceptable to encrypt the original data. ;)

I go back to my original comment. Nothing you are encrypting requires this level of encryption. It may be important to you, but it is highly doubtful that it is that important to anyone else. However, this *is* a public message board and is undoubtedly monitored, so you just raised quite a few red flags somewhere.

#5226314 Random Number Generation

Posted by MarkS on 29 April 2015 - 12:49 PM

I'll be quite blunt. The only "legitimate", and I use that word VERY loosely!, use for such an extreme encryption method is to prevent forensic snooping. In other words, the data you are trying to hide is illegal. Nothing else makes sense.


That being said, a one pad cipher requires secrecy. You've just told the world you plan to use this. I will now intercept every letter, package, e-mail and data stream emanating from you. ;)

#5226135 Random Number Generation

Posted by MarkS on 28 April 2015 - 01:15 PM

braindigitalis, this isn't actually for a game - that's why I put it in the general programming section, but wasn't really sure where it belonged - I just thought you all might have some ideas, that's all.


>And, nobody really needs that much random data.


samoth, http://en.wikipedia.org/wiki/One-time_pad


Now you're just sounding paranoid! The only organizations with the need to use such a method are not going to ask how to do so here! Whatever you're trying to encrypt isn't nearly as important as you may think. ;)

#5225499 How to use a unique_ptr as a member variable?

Posted by MarkS on 25 April 2015 - 12:52 PM

All of the examples that I can find online shows unique_ptr defined within a function, but never within a class. I want to use this to store the frame image data for a sprite, but doing so is a little unclear. I am aware of make_unique, but I am using VS 2012 and it doesn't offer it, or if it does, it is very well hidden.

This is what I've got so far, cobbled together from bits and pieces around the net:

class frame_data{
frame_data(unsigned long width,unsigned long height);
std::unique_ptr<unsigned char> _data;
unsigned long _width;
unsigned long _height;

frame_data::frame_data(unsigned long width,unsigned long height) : _height(height), _width(width)
std::unique_ptr<unsigned char> temp(new unsigned char(width * height * 4));
_data = std::move(temp);

My question is with the construction and assignment of the unique_ptr in the constructor. Is this the best or only method without using make_unique?

#5224733 Remaking Mario 64 from scratch, how long?

Posted by MarkS on 21 April 2015 - 01:13 PM

I am not really bothering with the elephant because I don't believe that the OP will even start this project, let alone carry it out. It sounds like a hypothetical question. ;)

I mean: who can reserve 10 years, or even 2 years, for a project like this? Real Life is sure to come along and mess it all up. And you gotta eat and have a place to crash, and you need electricity for the computer..



Mmm, you guys are replying to someone named Onequestiononly2, with 1 post. Smells of troll.

Silly question by the way.

I know I am more than a little naive, but I don't immediately assume that posts like this are the work of a troll. To me, this seems like a kid, probably in their teens, that has made a few simple games and thinks that they can totally take on a project like this. Not going to happen.

#5224627 Remaking Mario 64 from scratch, how long?

Posted by MarkS on 20 April 2015 - 11:29 PM

Everyone seems to be side stepping and/or ignoring the elephant in the room, so...


Let's say it takes you two years to make a Mario 64 clone. Then what do you do? You can't share your work here or anywhere else. Nintendo defends their IP with a religious fervor. At best, you'll get a nice cease and desist letter from their attorneys. At worst, you'll find yourself in court on a case you will most definitely lose.


Come up with your own idea and start. You're done when you get done.

#5223002 What language is this made in?

Posted by MarkS on 13 April 2015 - 01:49 PM

FRex answered the question, but I am curious why this even matters? What language are you comfortable with? If your goal its to make a game like this, use that language. This could be made in C, C++, BASIC, Pascal, Assembly, Java, or a host of others. It really doesn't matter.



I was typing as you posted, but still...

#5222189 Starting Using OpenGL Or DirectX?

Posted by MarkS on 09 April 2015 - 03:02 AM

Which should you learn? Are you wanting to restrict yourself to Windows for life? Probably not, so I'd say both.


As far as which you should learn first, that is a personal choice. They both do the same thing, but in different ways. Pick one to start, but learn both.

#5221906 Using Vector Graphics for games

Posted by MarkS on 07 April 2015 - 12:44 PM

If you haven't already, I would take a look at the source to both Cairo and Inkscape. This is a non-simple problem to say the least. The complexity of the renderer is quite high to take all usage cases into account. This doesn't even touch the fact that vector graphics, while being of "infinite" resolution, typically lack visual detail. To get the visual detail that is typically associated with raster images, the resulting SVG file would be massive and take a very long time to render.


I applaud you for taking the matter of high resolution displays seriously, but I think you are going about this all wrong. The VRAM on modern day graphics cards is more than enough to accommodate high resolution raster textures. Since you are making a 2D game, there will be even less textures required. I seriously doubt that you'll run into trouble.


One thing you might want to consider is a texture atlas.

#5221525 How can I create a text based adventure game?

Posted by MarkS on 05 April 2015 - 04:30 PM

Well, I've been wanting to make one for years, but...

Attached Thumbnails

  • 20101115002739_181_necropost.png

#5221495 C\C++ - win32: how create regions by images?

Posted by MarkS on 05 April 2015 - 12:24 PM

The same member has voted down all your posts across multiple threads. Normally, I would tell you to ignore it, but looking at his reputation, he votes down more than he votes up. This goes against the purpose of the rating system.

He appears to be a troll. Consider messaging a moderator about this.

#5220866 Voxel Engine - Function to DrawLine in 3D space

Posted by MarkS on 02 April 2015 - 01:52 AM

This might help you:

 * C code from the article
 * "Voxel Traversal along a 3D Line"
 * by Daniel Cohen, danny@bengus.bgu.ac.il
 * in "Graphics Gems IV", Academic Press, 1994

/* The following C subroutine visits all voxels along the line
segment from (x, y, z) and (x + dx, y + dy, z + dz) */

Line ( x, y, z, dx, dy, dz )
int x, y, z, dx, dy, dz;
    int n, sx, sy, sz, exy, exz, ezy, ax, ay, az, bx, by, bz;

    sx = sgn(dx);  sy = sgn(dy);  sz = sgn(dz);
    ax = abs(dx);  ay = abs(dy);  az = abs(dz);
    bx = 2*ax;	   by = 2*ay;	  bz = 2*az;
    exy = ay-ax;   exz = az-ax;	  ezy = ay-az;
    n = ax+ay+az;
    while ( n-- ) {
	VisitVoxel ( x, y, z );
	if ( exy < 0 ) {
	    if ( exz < 0 ) {
		x += sx;
		exy += by; exz += bz;
	    else  {
		z += sz;
		exz -= bx; ezy += by;
	else {
	    if ( ezy < 0 ) {
		z += sz;
		exz -= bx; ezy += by;
	    else  {
		y += sy;
		exy -= bx; ezy -= bz;
From the book "Graphics Gems IV", "Voxel Traversal along a 3D Line, p. 366-369". The books and source are available here: http://tog.acm.org/resources/GraphicsGems/ (So there is not confusion over copyrights and stuff...)

#5220263 How to map a trapezoid texture area to a rectangle correctly

Posted by MarkS on 30 March 2015 - 01:02 PM

The reason for this are the triangles of unequal area. Look closely at the mapped image. It is correct, using the texture coordinates you give it. To fix this, divide the quad into more than two triangles, each as close to equal area as possible.

Thank you but I have tried this before and it didn't work.

Sorry, I posted this after having been awake for 18 hours and couldn't think straight. No, it will never work perfectly. You are trying to emulate perspective by warping a 2D image. This is doomed to failure. You can subdivide the triangles into smaller and smaller triangles, but there will always be distortion. Google "affine texture mapping". It has been a long time since I've dealt with that, so I'm a little fuzzy, but unless you are dividing by z (perspective mapping), you will always see distortion.

This requires that you interpolate a third coordinate and divide in the pixel-shader, for example:

float2 TexCoord = float2(InputTexCoord.x, InputTexCoord.y / InputTexCoord.z);
Check this topic, and in particular make sure you know what behavior you want to achieve, a "stretched" texture over a quad (2D in the quad's space) or a perspective-correct texture-mapping.


Um, use the corners of the texture (ie, square area) instead of a trapezoid, then just tilt the quad and let the hardware do the perspective for you.


#5220122 How to map a trapezoid texture area to a rectangle correctly

Posted by MarkS on 30 March 2015 - 01:50 AM

The reason for this are the triangles of unequal area. Look closely at the mapped image. It is correct, using the texture coordinates you give it. To fix this, divide the quad into more than two triangles, each as close to equal area as possible.

Attached Thumbnails

  • rect4152.png