Jump to content

  • Log In with Google      Sign In   
  • Create Account


Mussi

Member Since 12 Oct 2004
Offline Last Active Today, 04:23 PM

#5029363 [Tutorial] Instant-Insertion Quadtrees

Posted by Mussi on 06 February 2013 - 06:04 AM

Bookmarked. Thanks for sharing!


#5025826 A star

Posted by Mussi on 26 January 2013 - 12:44 PM

Are you sure you don't have a using namespace std; somewhere? Possibly inside include.h? Alternatively you can rename your map variable.


#5018581 How is my programming format

Posted by Mussi on 07 January 2013 - 07:51 AM

Looks good, I would however recommend learning something more powerful than VB if you expect to make responsive high paced games that those of us with older computers (You know the majority of your potential players) can play. Yes the obvious functions are always better to have.
That's not VB, I think it's Boo.


#5011623 Using multiple header and .cpp files

Posted by Mussi on 17 December 2012 - 04:04 AM

Or place this at the top of your header files:
[source lang="cpp"]#pragma once[/source]

If that doesn't fix your problem, paste the complete error/errors you're getting.


#5011423 Extracting LookAt Vector from View Matrix

Posted by Mussi on 16 December 2012 - 05:53 PM

Okay, let me start by saying that your mixed use of 'look at' and 'look' is confusing. Use look for directions and look at for positions or distinguish them in some other way.

This link I posted before, shows how the view matrix is built. You want to build the view matrix with the look direction, you get this by subtracting the eye position from what point you're looking at and then normalizing that. Basically, what eppo said.


#5010767 NULL vs 0

Posted by Mussi on 14 December 2012 - 04:42 PM

I used NULL in the past, but now I'd just define nullptr if it wasn't available. So that when you transition to a modern compiler, your code base stays consistent.


#5007308 Namespaces good for anything else?

Posted by Mussi on 04 December 2012 - 11:30 PM

One of the reasons I like namespaces is that I can count on my IDE to pop up a lovely list to quickly reference functions, classes, etc.


#5000091 C++ - Is Goto a Good Practice?

Posted by Mussi on 11 November 2012 - 08:29 PM

You don't need an object to get rid of your goto. Take a step back and look at what you're trying to accomplish. You basically want to loop when some condition is met, this is exactly what while/do while/ for loops are meant to do. You can make a function out of the battlemenu section, return true when you have to execute it again or false otherwise. Then you simply call while( battlemenu() ) {}.


#4993648 Favorite little known or underused C++ features

Posted by Mussi on 24 October 2012 - 09:17 PM

I don't know how often it's used, but man do I love auto.


#4983935 Yes, I'm still trying to make pong, and yes, I do have another bug.

Posted by Mussi on 26 September 2012 - 03:58 AM

You don't have to justify asking a 'noob' question, that's what this forum is for. Don't hesitate to ask questions when you run into more trouble :).


#4978450 Swapping addresses between pointers and cache locality

Posted by Mussi on 09 September 2012 - 07:56 PM

I'm probably being really stupid here but how is this code exactly working out? From the way I understand it I have my 32 objects and when all of them are active all bits are supposed to be set. A quick look at _BitScanForward says that it search for the LSB that is set so each loop I would find this index and use it when I updated my player. Do I understand it correct? Also I understand you said this is just an alternative but I was wondering how it would differ in general from having something like this:

The loop keeps looping until the mask becomes 0. Every iteration the first bit that's set to 1 is set to 0, going from least significant to most significant. The offset value is simply the position of the first bit set to 1, again going from LSB to MSB, this gives you a value between 0 and 31 for a 32 bit mask. It's quite ingenious I must say.

How this differs from your example is that you have a single memory address to check for availability, instead of the many addresses within each object. If I'm correct, the cache will not only load the bytes to those addresses, but also some bytes around them(that you might not need), quickly filling up your cache-lines. Please correct me if I'm wrong.


#4977674 Simple & Robust OOP vs Performance

Posted by Mussi on 07 September 2012 - 09:30 AM

This is also faster in C/C++ (many ways to compare against 0, and those instructions are smaller and faster), but in Java it is a major help. It reduces the size of the code itself significantly while also providing a faster iteration.
If the order of the loop does not matter, you should always always always do it this way.

Not on my machine using C++.

#include <iostream>
#include <Windows.h>

using namespace std;

int main()
{
const int arraySize = 10000;
int a[arraySize];
int b[arraySize];

for(int i = 0; i < arraySize; i++)
{
  a[i] = 0;
  b[i] = 0;
}

LARGE_INTEGER li, start;
if( !QueryPerformanceFrequency(&li) )
  return 0;
double freq = double(li.QuadPart)/1000.0;

QueryPerformanceCounter(&start);
for(int i = 0; i < arraySize; i++)
  a[i] += i;
QueryPerformanceCounter(&li);
cout << double(li.QuadPart - start.QuadPart)/freq << endl;

QueryPerformanceCounter(&start);
for(int i = arraySize; i >= 0 ; --i)
  b[i] += i;
QueryPerformanceCounter(&li);
cout << double(li.QuadPart - start.QuadPart)/freq << endl;
return 0;
}

Multiple tests indicate that the second iteration is slower, sometimes as much as 2 times slower.

Edit: code not showing up
Edit2: that wasn't a fair comparison, strangly enough switching the order of the iterations makes a difference


#4975249 Game UI

Posted by Mussi on 31 August 2012 - 04:09 PM

But is it possible to make high quality one using 3rd party libraries?

What do you mean? Can you make a UI that looks and feels like the UI in WoW using an existing third party library? Yes you can.


#4974581 VC++ F5 and Ctrl+F5, I'm mad...

Posted by Mussi on 29 August 2012 - 03:29 PM

I can't remember the last time I ran into a problem like this. Rather than finding ways to ensure that variables are initialized to something random(should a boolean initialize to true or false?), I'd recommend you to train yourself in recognizing and avoiding code with undefined behaviour.


#4971817 Game engine gui design

Posted by Mussi on 21 August 2012 - 07:25 AM

I'd use an existing library instead of writing my own. Right now you're abusing OOP, I'd recommend you to look into composition. There is a great thread going on about this here.




PARTNERS