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.


zacaj

Member Since 18 Sep 2008
Offline Last Active Sep 28 2013 03:05 PM

#4959272 (C++ Beginner) I hate to post here, but... why won't my "if" stat...

Posted by zacaj on 15 July 2012 - 09:05 AM

You need to do
if (username == "Tiffany" || username =="tiffany"


#4958511 Programming Burden for FFT or Tactics Ogre Game

Posted by zacaj on 12 July 2012 - 01:00 PM

Yeah you're probably not going to have access to the original code. A lot of the complexity is going to depend on whether you want 2D isometric (SNES/GBA style) or 3D isometric (FFT for PS1)


#4956707 Hybrid Ray Tracing Feasability

Posted by zacaj on 07 July 2012 - 12:50 PM

Can you make a real-time polygonal ray-tracer? Yes.
Can you make a real-time SVO-based ray-tracer? I'm not sure if anyone has yet... John Carmack seemed to think so.

I was pondering writing an SVO ray-tracer/renderer for complicated objects in my rasterizing polygonal renderer, never got around to it though


#4952457 total noob here. Can you recommend a c++ compiler?

Posted by zacaj on 24 June 2012 - 04:16 PM

This is known as an IDE. A compiler just takes the name of a file and makes an exe, it doesnt include an editor. For Windows the best IDEs are Visual Studio (which is made by Microsoft), Code::Blocks, and Eclipse. I don't know about eclipse but I know Visual Studio and Code::Blocks include a compiler with them. Id recommend you download Visual Studio 2010 Express edition to start.
Alternately, there are lots of text editors that you can code in, such as Notepad++ which you can also configure to run a compiler, or even just open a command prompt to run the compiler from


#4952435 handling keyboard input in WndProc

Posted by zacaj on 24 June 2012 - 03:14 PM

Personally I have an array of each of the keys

bool keypressed[512]

and when a key is pressed in WndProc I set the appropriate variable in the array to true, and when its released I set it back to false

Then your Character class can just say

if(keypressed['W])
//walk forward

You may have to manually convert non alphanumeric keys to some constant in WndProc ie
#define KEY_UP 257
#define KEY_DOWN 258
I dont remember what the VK_* is for the keys


#4952213 Please simplify my code.

Posted by zacaj on 23 June 2012 - 09:37 PM


OK, let me start by saying this, very clearly: This is not C++. This is C. You should learn C++ instead. What book or reference are you using, which claims that this is C++? Throw it out the window, whether literal or virtual, and get a reference of C++ instead.

C++ is an object-oriented programming language. This means that you should look at things as real-world object, created from blueprints called classes (or structs). If you have a game with a slot-machine, then that slot machine is an object, I think you'd agree. (In fact, the game itself is an object, isn't it?) So what you need to do is to write a class called SlotMachine, and create an object from that class. And pulling the lever on a slot machine should be represented as a member function (or a "method", as it's called in some languages) of the SlotMachine class. So when you want to pull the lever, you write slotMachine.pullLever().

You have pretty much crammed everything into the main() function. That is not the C++ way, but the C way.

I'd love to re-write it all in C++ for you, but... well, I think you should do it, frankly. Otherwise you'd not be learning, I think.

EDIT:

Oh, don't get me wrong, I'll help you if you need it, and I'm sure others here will aswell. Just try some on your own, with a decent C++ reference in your back, and if you run into problems, we're here.
Just... start over, and do it in C++.


Sorry I've no clue what your talking about. Seems its advanced stuff.


He thinks you should be structuring your program the same way you would structure a much more advanced program, so that you get into the proper habits. Probably something you should do soon, but right now it looks like you're still getting a grasp of basic programming to me.

@antiHUMANDesigns

You have pretty much crammed everything into the main() function. That is not the C++ way, but the C way.

This isn't the C way either. This is the way you write stuff that fits in a single function, on not much more than a single page of code


#4952200 Please simplify my code.

Posted by zacaj on 23 June 2012 - 09:04 PM

Why do you return three times in Random()? the r1 and r2 lines dont do anything, return r0 ends the function. Also, shouldnt all these lines "money = (3 * bet);" be "money += 3*bet;" ?


#4952000 Old Style 3D Game Engines / Graphics

Posted by zacaj on 23 June 2012 - 07:17 AM

Wolfenstein used raycasting.
You are mistaken about Doom and Quake, they do not read a plain grid from a text file. Doom still used a more advanced version of raytracing, I'd recommend googling "doom 2.5d engine" or something similar. Quake uses a plain software renderer, and is fully 3D.

When a 2D picture rotates to always face the player, this is known as a billboard


#4951109 Seperation of Render and SceneSystem.

Posted by zacaj on 20 June 2012 - 02:21 PM

In my engine I do this:
class Scene
  Object[] objects
class Object
  vec3 pos
  Quaterion rot
  Model *model
  virtual void draw()
class Renderer
  vec3 cameraPos
  Scene *scene //draws scene at cameraPos
  virtual void draw()

class Model
  vec3 verts,norms,etc
  virtual void process()
  void load(string path)
    do stuff
    process()
 
I then make custom implementations of Model and Renderer for each API (and even rendering technique, deferred vs forward, etc). You can have a load that's API independant and then subclass Model to make a DX11Model that would store any necessary info and override process() to handle uploading the data to the GPU, and have different subclasses of Renderer that override draw() to handle the different APIs, etc


#4950338 Fast rendering of cubes at points

Posted by zacaj on 18 June 2012 - 12:54 PM

You'd most likely want to use instanced rendering.


#4945670 Polygons shifting position in PS1 games

Posted by zacaj on 02 June 2012 - 04:36 PM

http://www.reddit.com/r/gaming/comments/bkedc/heres_a_question_why_do_3d_models_on_the_ps1_tend/


#4945373 How Are Non-GPU Graphics API's Written?

Posted by zacaj on 01 June 2012 - 11:39 AM

Nowadays you'd have to pass on your framebuffer to a window manger or something similar (SDL,SFML,GL,etc). Even most games back when software rendering was used only used assembler for the most important bits, now you could get plenty of speed in C, or even an interpreted language. I just started programming a software renderer last week, and I simple did this:

u32 *pixels=new u32[width*height];
(u32=unsigned 32bit int)
Each u32 is made up of four bytes (u8 or unsigned char), which I use to represent RGBA.
You can use bit shifting to pack your u8's into a u32:
u32 color=r<<24|g<<16|b<<8|a
You can access a specific color by doing
pixels[x+y*width]=color


#4944776 C compiler as back end

Posted by zacaj on 30 May 2012 - 02:58 PM

www.tinycc.org is extremely small: it can compile code at run time even. However I don't think it includes any of the C headers, which are probably what are using most of your space in the first place


#4944417 OpenGL vs DirectX ?

Posted by zacaj on 29 May 2012 - 01:59 PM

Obviously the best way to go is a SIMD software renderer


#4941551 XNA Realistic Bouncing

Posted by zacaj on 19 May 2012 - 06:38 PM

You're multiplying BOTH axes of the vector2 by -1? So no matter what angle the wall is the ball just bounces back the way it came? Are your walls always horizontal/vertical or can they be at any angle? In any case, check out http://www.gamedev.net/topic/510581-2d-reflection/




PARTNERS