Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 20 Mar 2012
Offline Last Active Today, 03:05 AM

Topics I've Started

visual studio c++ class view showing classes from outside project

09 December 2013 - 09:15 AM

I'm hoping there is a solution to this: wacko.png


I've recently started using visual studio 2013 (I *think* there was a similar problem with visual studio 2010 though), so I'm a complete noob to this IDE (it does seem to have, dare I say it, far too many options!!).


The problem I'm facing is that when viewing multiple projects within a solution, classview doesn't just show the classes from within that project. It is *so* intelligent it wants to show me classes from other projects as well, that are used within that project (but are not part of it).


Attached File  classviewproblem.png   63.4KB   4 downloads


The problem with this is it makes it incredibly difficult to navigate within classview, as all these irrelevant classes are getting pulled in. Is there a way around this problem? Ideally a way to switch this behaviour off.


If not, I see you can create folders within classview. So maybe I can just drag the classes I am actually interested in into these? Unfortunately when I drag classes into the 'user folders' I get a red cross icon, like it doesn't recognise it or something.


And incidently if anyone had a way to make the class member variables actually appear in the treeview as part of the class (instead of a separate window), I would be overjoyed.smile.png

Integer scaling

19 September 2013 - 03:10 AM

Hi, this is probably really easy, but..


how do I best do a fast, accurate integer scaling (0.0 - 1.0) of 2 unsigned chars (8 bit values)?

[Note: this is the same problem as doing accurate alpha-blending. But it is also useful in other areas, e.g. audio.]




a = 100; // test number

b = 250; // scale factor 0 - 255, which should correspond to a 0.0 to 1.0 factor


result = (a * b) / 255;


However in this case the divide by a non-magic number (2, 4, 8, 16, etc) is presumably not as good as dividing by 256 which can be a bitshift? Although perhaps these days in most CPUs this is not an issue as memory bandwidth is more important?


And finally, what is the *best* way of doing this, allowing floating point stuff (and perhaps SIMD, maybe there is an instruction for it?).



Variations I've seen:


1) Just divide by 256 (the bitshift)


(and ignore the fact that 255 x 255 will come out as 254 as the result)


Pros: Works fast

Cons: Might be ok in many uses but isn't accurate.


2) result = (a * (b+1)) / 256;


Pros: Should be almost as fast as the above.

when b = 0

e.g. 255 * 1 = 255,

255 / 256 = 0 CORRECT

when b = 255

255 * 256 = 65280

65280 / 256 = 255 CORRECT


Cons: Are there some cases where this gives different results than the 'true' result? Not sure



Content policies in games and censorship

05 December 2012 - 12:46 PM

I'm currently writing a little indie cartoony 2d adventure game, and have come upon some interesting questions about censorship... The game is currently set based on exploration in victorian africa.

If I were making a movie on this basis, I'd feel covering subjects such as racism, slavery and violence would not be considered out of the ordinary, but part of representing the time period and part of the 'art' of the movie.

However for games there are 'content guidelines' for selling your games via certain outlets. If you include certain elements, certain outlets won't touch the product. I know for consoles you can get the more mature ratings and be allowed a reasonable amount of leeway, presumably with the idea that a 'shop owner' would be responsible for not selling to younger customers.

But for mobile games, there seems to be a bit of a 'disney child friendly' thing going on, where stores won't touch your game if it is at all risque. Posted Image I'd guess this was particularly true for iOS, but I just had a look at the google play guidelines, and they say:

Sexually Explicit Material: We don't allow content that contains nudity, graphic sex acts, or sexually explicit material. Google has a zero-tolerance policy against child pornography. If we become aware of content with child pornography, we will report it to the appropriate authorities and delete the Google Accounts of those involved with the distribution.

Violence and Bullying: Depictions of gratuitous violence are not allowed. Applications should not contain materials that threaten, harass or bully other users.

Hate Speech: We don't allow the promotion of hatred toward groups of people based on their race or ethnic origin, religion, disability, gender, age, veteran status, or sexual orientation/gender identity.

So basically that seems to rule out gratuitous decapitation, cannibalism, racism and beast action.Posted Image

In a movie for instance, it is regarded as ok to have, for example an obnoxious racist character. Usually this will be reinforced because they'll get their commeuppance in the movie. But is this kind of subject too far to even broach in a game? This is what characters are all about, some you will root for, but some might be unpleasant characters. Just because a character does some action, it doesn't mean the movie condones that action. But is this even allowed in games?

I know the big publishers won't risk things if they aren't sure it will be allowed, but as an indie you have more freedom.

Anyway what do you guys think of this situation, any views / experience? I'm currently considering hedging my bets with 2 sets of content for conversations for example.

Where do you think the line should be drawn?Posted Image

Running a LUA script one part at a time

03 December 2012 - 02:07 PM

Hiya, I have some experience writing my own scripting languages in the past, but wanted to have a go at using LUA for a little 2d rpg type game.

It was very easy to get it loading a script and running it within the game, so far so good. Posted Image

Next stage is, instead of running an entire script at once (via lua_pcall), I want to be able to run through a script, up until it reaches certain time consuming functions, when I want to pause the script until the c++ tells it to resume again.

Here's the flow:


TextOut("Hello I am a monster")
TextOut("Now I'm going to eat you")
TextOut("Yum yum")

So within most scripts run by characters etc, I need to pause the script, get on with running the rest of the game, other scripts etc, then resume again when the wait condition is satisfied.

The example above has 2 'waiting' functions, Wait (number of seconds), and MoveToPlayer (which may take a varying amount of time).

Hopefully this should make sense.

Does anyone have any idea how I should achieve this in lua? I'm having inkling feelings it may be to do with the yield and resume commands, but I haven't seen any decent explanations.

Many thanks.

DoodleTrace autotracer alpha version

29 August 2012 - 12:31 PM

I've just started playing with 2d animation using Anime Studio, it's an animation package for vector art. Was having lots of fun and decided I might be able to use it to make a 2d game. Next stage was trying to draw some characters. Although I could do it with the mouse and the wacom tablet, I found it slow going, and quite difficult to get what is in my head onto the page.

It struck me there must be an easier way - I quite like doodling on paper, so I wondered whether it was possible to doodle on paper, scan it in, then autotrace the line drawing to something I can edit.

So I tried it .. unfortunately nearly all the autotracers I tried (Anime Studio, Inkscape) converted brush strokes into an outline, i.e. with a path at each edge, rather than a path down the centre, which is what I wanted for easy editing. After a bit of research, it turned out to be a common problem, and the solution was a different technique called centreline autotracing.

I gather Adobe Illustrator and Corel Draw can do this, but I don't have those programs. There is also an open source 'autotrace' command line program, but it crashed when I tried to run it, and I couldn't get the java GUI version of it to work either. So In my frustration, I did what anyone would do, I decided to have a go at writing my own.

After 2 or 3 days of playing about, I had a command line program that was just about workable (for me). Then it struck me why not release it as freeware. I could have stuck with the command line, but I read a lot of frustrated posts by artists not able to use autotrace because it was so 'geeky', so I thought I would try it as a testbed for building up my GUI system (I have been writing a simple windowing system).

Posted Image

So two weeks later, here it is for you guys to try out. I spent most of the time building up / debugging GUI stuff rather than on the autotracer itself lol. But I'm happy for it because I can reuse the GUI system to easily write new apps.

Anyway the program loads black and white images as TGA files (this is the only lossless image format I have a handy loader for, but I am planning to support PNG and maybe a couple others). Then you can set the parameters and set it off, and finally it saves in either Adobe Illustrator (.ai) or Scalable Vector Graphics (.svg) format. Actually the .ai file may be a little dodgy, as I reverse engineered it, and only got to test it with the Anime Studio importer, but I'm *hoping* it will load into illustrator too lol. Still the .svg seems to be working fine, and the .svg files loaded into google chrome ok.

So if you want to try the program it is about 400K.

You can download it here:


I also have created a facebook page to see if I can get some feedback and where I will post new versions:


Many thanks if you guys can try it out. It should run on most flavours of windows, and the only requirement is opengl graphics.