Skip to main content

large code projects, recomended books/ links?

  • Had a break from learning c# by making a new player model, britanny of gold digger.
    Model, basic texture, animation in 3 days (less actually, time also spent rewriting bone spring code (to get tail to work well), like 2 days plus one recovery…

  • combat prototype is done (cough, after a work/ life related pause of 7 months)

    turn based hex combat, 3 stats (rock paper sizzors/ body mind soul) though still needs tweaking, but need to make some contents tools first. have movement,…

  • slowly implementing a hex based combat mode, have player movement (calculation of what movement cost to get to each square, interface for move, interface for changing facing) and player/ opponent take turns

    also lost some time to changing…

  • Nothing that exciting, still a bit to go before seeing game character fight, but the framework for the turnbased combat, and triggering it by walking around in the world, and then generate a hex grid over the current location is slowly…

  • Used up a weeks worth of holiday time from work, but still did not even get started on the combat prototype.
    Took a day to tidy up the prototype code to be more generalise, then another day to refactor the code to run under a state machine…

  • well, there is more i would like to do on the player movement prototype but need to move onto the next prototype, combat.

    did get physics update seperate from the rendering, the animation states being driven by an xml defined state machine…

  • still working on the character movement prototype, adding a few animations and tweaking physics, currently adding push object state, have the jump animations with jump scalled by time the jump button is down, land animation scalled by time in air…

  • have changed to using ogre game engine, and this is after a few weekends of mucking around and making content, with smatterings of code

    some history. got my own 'from scratch' game engine up to runing but was going to be a pain to support…

  • One day to make the model
    (lightwave, drew a front and side profile of a Fred Perry character, 'Gina', from his comic 'Gold Digger', it is rather sexist, but also a lot of fun. converted the tga into a point cloud to have in the modelling…

  • an interesting little exercise that i did back in november, was to make a pac man clone.

    it was good to actually 'finish' something, but a pain in the kahoonas to make something on the pc not using directX (as i already knew how to use…

Submitted by davidcoen on

just a quick style query~ don't have much of a background in software eng. so was wondering if there are some recomendations on resources to help teach how to manage large code systems. (book recomendations?)

noticed what i am working on is up to 74files of code, and have just been doing the headers like

//===
#ifndef GEOM_H
#define GEOM_H
typedef class geombase GeomBase;
typedef class geometry Geometry;
typedef class geomskin GeomSkin;

#include "pos.h"
.
. // includes for all the types in the classes bellow
.
#include "dynamic_manager.h"

class geombase{
Collision *p_col;
.
. // class reference follows
.
};

#endif
//======= end file

doing (typedef)(includes)(class def) seems to work ok, but when i want external objects inside the class/struct in the header, having big probles with linking to try and get it to work (have a bit too much couplling of my data structs i guess, but for example, geometry objects have a possition object, and wanted pos objects to have a pointer to a geom object (geom has heirachy info) and with all the linking, can eventually get it to work, but add another embeded object to another class or change header order and this method seems to fall down real quick?

is there a better way? or just decrease code couplling....

Submitted by Jacana on Wed, 26/11/03 - 5:53 PMPermalink

I was told Code Complete is a good Software Eng book :) I have ordered it but have not got it in yet. It was written by an MS guy.

Precompiled headers would save you from having to include your classes all over the place - instead you could just do it in one place!

Submitted by Zaph on Wed, 26/11/03 - 7:38 PMPermalink

quote:Originally posted by Jacana

I was told Code Complete is a good Software Eng book :) I have ordered it but have not got it in yet. It was written by an MS guy.

"Code Complete" should be required reading for all developers!
http://www.stevemcconnell.com/

"Writing Solid Code" is another great book to read
http://www.microsoft.com/mspress/uk/books/book108.htm
but I thought there was meant to be a newer edition than that one (1994)

Submitted by CombatWombat on Thu, 27/11/03 - 12:13 AMPermalink

quote:Originally posted by davidcoen

doing (typedef)(includes)(class def) seems to work ok, but when i want external objects inside the class/struct in the header, having big probles with linking to try and get it to work (have a bit too much couplling of my data structs i guess, but for example, geometry objects have a possition object, and wanted pos objects to have a pointer to a geom object (geom has heirachy info) and with all the linking, can eventually get it to work, but add another embeded object to another class or change header order and this method seems to fall down real quick?

is there a better way? or just decrease code couplling....

Hi david, it's been 5 yrs or so since I read "Large-scale C++ Software Design" by Lakos, but I seem to remember that this was quite relevant to this topic. I don't remember any particular rocket-science in the book (but I'd also make this comment about most of the C++ books out there anyway) but definately worth a read.

Just a quick piece of terminology before I jargon myself to death below - "typedef class geombase GeomBase" is known as a forward declaration of geombase. I'd usually skip the step of doing the typedef - and just forward declare my classes with "class GeomBase;" - this has the advantage that you don't need to know what class actually implements GeomBase in your other headers.

A couple of rules I use:

* When designing a class, prefer data members that are pointers or references where it's clean to do so (you'll only need the forward declaration if you do this)
* Only inline very basic functions in your class declaration that don't require you to bring in extra header files
* Every include file should fulfil its own needs for definitions (eg if it needs the full declartion of FooClass from foo.hxx then ensure that the include file includes foo.hxx) - you should get a clean compile if you passed the header through a compiler by itself

This breaks down a bit with using the STL (one of the hassles with C++ and large-scale development is how you're not able to forward declare templated classes) - so you just have to pull the STL headers in rather than foward declaring them.

Just another quick note on terminology - linking is the step where you grab the output object files from the compiler and roll them into an executable file. When you're saying problems with linking most programmers will understand this as problems with undefined symbols, but I think you're only talking about compilation problems here.

I agree precompiled headers are useful, but you do limit your portability, and lose some of your ability to break the source code up into modules. Where these things aren't important to you, precompiled headers are your friends :)

Cheers,

Mark/CW

PS the mod's I'd suggest to your code:

[code]
//===
#ifndef GEOM_H
#define GEOM_H

class GeomBase;
class Geometry;
class GeomSkin;
class Collision;

#include "pos.h"
.
. // includes for all the types in the classes bellow
.
#include "dynamic_manager.h"

class GeomBase{
Collision *p_col;
.
. // class reference follows
.
};

#endif
[/code]

Submitted by davidcoen on Thu, 27/11/03 - 8:49 PMPermalink

Thankyou for the recomandations, will have to case up those books, now to get back to finishing the particle system :)

Submitted by Kezza on Wed, 17/12/03 - 8:01 AMPermalink

quote:Originally posted by Jacana

I was told Code Complete is a good Software Eng book :) I have ordered it but have not got it in yet. It was written by an MS guy.

Precompiled headers would save you from having to include your classes all over the place - instead you could just do it in one place!

a software eng book written by an ms guy... i can't imagine how that would be a good thing.

also watch out for precompiled headers, they often get kidna big... and can force your compiler over the stack limit (easy to fix but annoying).

Submitted by davidcoen on Thu, 18/12/03 - 11:48 AMPermalink

actually 'code complete' is quite good (and evil, reading a code style book halfway through a big project is not a good idea)

just spent the last 10 hours implementing my IK system. note to self, when getting bored, implement small fun stuff, have been giggling to myself as the person drops to the ground in a large cloud of dust (also added objects being able to release particles when being collided with) at least that is working

also just purchased a copy of 'visual C++.net' and lost quite a bit of time reformating computer and finding the build setting i need to get it not rebuild the entire project on each change (hmmn, nortan anti virus can get upset when you start playing hatchet in the registry)

Posted by davidcoen on

just a quick style query~ don't have much of a background in software eng. so was wondering if there are some recomendations on resources to help teach how to manage large code systems. (book recomendations?)

noticed what i am working on is up to 74files of code, and have just been doing the headers like

//===
#ifndef GEOM_H
#define GEOM_H
typedef class geombase GeomBase;
typedef class geometry Geometry;
typedef class geomskin GeomSkin;

#include "pos.h"
.
. // includes for all the types in the classes bellow
.
#include "dynamic_manager.h"

class geombase{
Collision *p_col;
.
. // class reference follows
.
};

#endif
//======= end file

doing (typedef)(includes)(class def) seems to work ok, but when i want external objects inside the class/struct in the header, having big probles with linking to try and get it to work (have a bit too much couplling of my data structs i guess, but for example, geometry objects have a possition object, and wanted pos objects to have a pointer to a geom object (geom has heirachy info) and with all the linking, can eventually get it to work, but add another embeded object to another class or change header order and this method seems to fall down real quick?

is there a better way? or just decrease code couplling....


Submitted by Jacana on Wed, 26/11/03 - 5:53 PMPermalink

I was told Code Complete is a good Software Eng book :) I have ordered it but have not got it in yet. It was written by an MS guy.

Precompiled headers would save you from having to include your classes all over the place - instead you could just do it in one place!

Submitted by Zaph on Wed, 26/11/03 - 7:38 PMPermalink

quote:Originally posted by Jacana

I was told Code Complete is a good Software Eng book :) I have ordered it but have not got it in yet. It was written by an MS guy.

"Code Complete" should be required reading for all developers!
http://www.stevemcconnell.com/

"Writing Solid Code" is another great book to read
http://www.microsoft.com/mspress/uk/books/book108.htm
but I thought there was meant to be a newer edition than that one (1994)

Submitted by CombatWombat on Thu, 27/11/03 - 12:13 AMPermalink

quote:Originally posted by davidcoen

doing (typedef)(includes)(class def) seems to work ok, but when i want external objects inside the class/struct in the header, having big probles with linking to try and get it to work (have a bit too much couplling of my data structs i guess, but for example, geometry objects have a possition object, and wanted pos objects to have a pointer to a geom object (geom has heirachy info) and with all the linking, can eventually get it to work, but add another embeded object to another class or change header order and this method seems to fall down real quick?

is there a better way? or just decrease code couplling....

Hi david, it's been 5 yrs or so since I read "Large-scale C++ Software Design" by Lakos, but I seem to remember that this was quite relevant to this topic. I don't remember any particular rocket-science in the book (but I'd also make this comment about most of the C++ books out there anyway) but definately worth a read.

Just a quick piece of terminology before I jargon myself to death below - "typedef class geombase GeomBase" is known as a forward declaration of geombase. I'd usually skip the step of doing the typedef - and just forward declare my classes with "class GeomBase;" - this has the advantage that you don't need to know what class actually implements GeomBase in your other headers.

A couple of rules I use:

* When designing a class, prefer data members that are pointers or references where it's clean to do so (you'll only need the forward declaration if you do this)
* Only inline very basic functions in your class declaration that don't require you to bring in extra header files
* Every include file should fulfil its own needs for definitions (eg if it needs the full declartion of FooClass from foo.hxx then ensure that the include file includes foo.hxx) - you should get a clean compile if you passed the header through a compiler by itself

This breaks down a bit with using the STL (one of the hassles with C++ and large-scale development is how you're not able to forward declare templated classes) - so you just have to pull the STL headers in rather than foward declaring them.

Just another quick note on terminology - linking is the step where you grab the output object files from the compiler and roll them into an executable file. When you're saying problems with linking most programmers will understand this as problems with undefined symbols, but I think you're only talking about compilation problems here.

I agree precompiled headers are useful, but you do limit your portability, and lose some of your ability to break the source code up into modules. Where these things aren't important to you, precompiled headers are your friends :)

Cheers,

Mark/CW

PS the mod's I'd suggest to your code:

[code]
//===
#ifndef GEOM_H
#define GEOM_H

class GeomBase;
class Geometry;
class GeomSkin;
class Collision;

#include "pos.h"
.
. // includes for all the types in the classes bellow
.
#include "dynamic_manager.h"

class GeomBase{
Collision *p_col;
.
. // class reference follows
.
};

#endif
[/code]

Submitted by davidcoen on Thu, 27/11/03 - 8:49 PMPermalink

Thankyou for the recomandations, will have to case up those books, now to get back to finishing the particle system :)

Submitted by Kezza on Wed, 17/12/03 - 8:01 AMPermalink

quote:Originally posted by Jacana

I was told Code Complete is a good Software Eng book :) I have ordered it but have not got it in yet. It was written by an MS guy.

Precompiled headers would save you from having to include your classes all over the place - instead you could just do it in one place!

a software eng book written by an ms guy... i can't imagine how that would be a good thing.

also watch out for precompiled headers, they often get kidna big... and can force your compiler over the stack limit (easy to fix but annoying).

Submitted by davidcoen on Thu, 18/12/03 - 11:48 AMPermalink

actually 'code complete' is quite good (and evil, reading a code style book halfway through a big project is not a good idea)

just spent the last 10 hours implementing my IK system. note to self, when getting bored, implement small fun stuff, have been giggling to myself as the person drops to the ground in a large cloud of dust (also added objects being able to release particles when being collided with) at least that is working

also just purchased a copy of 'visual C++.net' and lost quite a bit of time reformating computer and finding the build setting i need to get it not rebuild the entire project on each change (hmmn, nortan anti virus can get upset when you start playing hatchet in the registry)