Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 03 May 2009
Offline Last Active Today, 03:27 AM

#5197124 Which of these games would you like to read more about?

Posted by adt7 on 09 December 2014 - 04:00 AM

Based how on how great the series has been so far I'm happy to read about anything you're willing to write about! The first two parts have been fantastic and I'm looking forward to the third. Keep up the good work.

#5069116 SDL 2.0 undefined functions and constants problem

Posted by adt7 on 12 June 2013 - 06:47 AM

A lot of methods/constants have been changed/removed for SDL2. For example, SDL_GL_SwapBuffers() is now SDL_GL_SwapWindow().

You need to update your code to use the new SDL2 methods.

#5062032 MVC: Struggling to remove graphics from the model

Posted by adt7 on 15 May 2013 - 07:14 AM

For my latest (small) project I thought I'd try out a slightly different way of doing things, namely I've decided to try using MVC for a game.
I've got a reasonable handle on it in terms of observers and events in the model and communicating these to the view (and controller), however I'm having a bit of difficultly in figuring out how to completely eliminate data about the graphical representation from the model.
Take this (massively simple) example of a fairly basic RPG. Since my model is data-driven, I have a single "Unit" class which contains information about the units (no need for Troll, Goblin, etc subclasses).
class Unit
    string name; //Friendly name, e.g. Dave
    int hp;
    int damage;
int range;
    Unit(string name, int hp, int damage);

Then in my model I keep a list of these Units as well as a method to retrieve them so the view can access them.
class Model // LevelState or similar would be a better name for this
    Unit[] units;
    Unit[] GetUnits();
The problem occurs when I come to drawing the units, as far as my model is concerned it doesn't care about if the unit is a goblin, an archer or a giant salamader, all it cares about is the unit's stats which define it's behavior.
However, the view very much cares about if the unit is a goblin, an archer or a giant salamader as it will have to draw different sprites for each of them.
What is the best way to solve this? I could add an enumerated "type" field to the Unit class, but this feels wrong as it's polluting the model with data that it doesn't care about, but I really can't see any other way of doing this.
Am I just overthinking and getting too concerned with what is "right" and "clean"?

#5041848 XNA - Texture2D won't get rendered after ~10 frames.

Posted by adt7 on 11 March 2013 - 08:32 AM

I noticed you mentioned you removed some Dispose() calls. I can't think of any regular situation where you'd need to call Dispose on a Texture in XNA, so this rings alarms bells for me.


Could you post up some code or link to your repository? It might offer some clues to what's going on.

#5040817 How feasible is using the NDK?

Posted by adt7 on 08 March 2013 - 08:10 AM

I'm currently using the NDK with SDL2 (ex. 1.3) and it's been a piece of cake. Sure, the debuging options are limited, but so long as you setup some defines for logging (so you can use the logcat) and learn how to use gdb it's not too bad. It helps if you can help your project for a different platform (e.g. Linux or Windows) and debug on there, but this may not be possible depending on what you are doing.


I'm sharing code between Windows, OSX, Linux and Android (all non-NEON devices, as SDL doesn't build correctly for them) at the moment, using CMake to build all of the projects except the Android one - where I use the NDK tools on Linux, but I've tested Cygwin and that works too. Eventually I'll add iOS in the mix, but I thought I'd leave that for a while (this is probably a massive mistake) as I wanted to get on and actually start developing.


At some point I'll clear out all the project specific code and upload a blank project template to bitbucket or github, since it's taken a little bit of work to get it all working, but now it is all setup it's a doddle.

#5038011 How many draw calls per frame are possible without awful performance?

Posted by adt7 on 01 March 2013 - 08:02 AM

You could try sorting your tiles by texture before drawing them and seeing how that effects performance.


It would be helpful if you could post some of your drawing code (i.e. the bits that are called every frame) to see if there are any obvious issues in there that could be causing problems.

#5017099 Drawing a square in DX11

Posted by adt7 on 03 January 2013 - 07:54 AM

You also need to change the line that reads "d3d11DevCon->Draw(3,0);" so that it knows you want it to draw 6 vertices instead of 3.

#5009797 c# help

Posted by adt7 on 12 December 2012 - 06:35 AM

The post above is 100% correct, you really need to take the time to learn C# and it's syntax before going any further.

As for your code, I believe something along the lines of the following is what you were actually trying to achieve:

class Lexington
    private String weapon = "lazarus revolver";
    private String armor = "military uni";
    private int level = 70;

#5009067 Can't draw a simple cube

Posted by adt7 on 10 December 2012 - 07:24 AM

At no point are you drawing anything. Unless I've missed something there are no calls to any of the Device.Draw....() methods in your code.

EDIT: Just noticed you have your DrawPrimitives call commented out.

#4995820 error X3087: texture object does not have methods

Posted by adt7 on 31 October 2012 - 07:46 AM

You need to use a one of the Texture object types listed here:

Texture2D should work in this case (rather than just texture).

#4984701 SFINAE equivalent in C#?

Posted by adt7 on 28 September 2012 - 06:16 AM

I believe Marshal.SizeOf and the typeof() operator should do what you need, it's been a while since I've used it though and I'm not sat in front of a computer I can test this on, but hopefully the following should work.

int size = Marshal.SizeOf(typeof(T));

#4758226 New Forum FAQ

Posted by adt7 on 13 January 2011 - 04:29 AM

A big note saying "Post your code if you want better (any) decent help and/or feedback" would be a good start.

If specific DirectX/XNA things can be included then:

  • Debug runtimes setup "tutorial", for DirectX/SlimDX/XNA
  • PIX setup "tutorial", for DirectX/SlimDX/XNA
  • An explanation of the differences between DirectX, SlimDX and XNA

#4689085 Component Based Entity System Design - Phase 2: post 30

Posted by adt7 on 09 August 2010 - 02:14 AM

I've personally only just started on a Component system over the weekend, with a few iterations, and I'm very much of the opinion (so far) that the "best" way to go is that a component is small, focused, data-only object, with the Subsystem for the component managing any behaviors and dependancies on other components/subsystems.

I could be wrong in this, and only time will tell, but even setting up the components and subsystems has been a far more rapid process than any OO approach I've tried in the past since I don't need to plan out my inheritance tree and interactions in advance, I only have to worry about these when I add a new component type/subsystem.

The problem I'm having at the moment though is how best to make the subsystems communicate. Currently I have a Game class that contains all the subsystems, which every subsystem holds a reference to so they can all find each other, but it doesn't seem clean to me. Then again, I could just be fussing too much over it since, well, it works and at the end of the day I guess that is what matters.

#4499429 DirectX in Six Different Languages

Posted by adt7 on 28 July 2009 - 04:11 AM

Original post by MJP
How about some Fortran? [grin]

Why not COBOL while you're at it?