Programmers can talk all about their craft here
Programmers
I want to start programming
Well I took a c and c++ class in TAFE but I failed mainly due to not showing up and fucking around when I was there, well anyway, I still have the text book "Programming concepts 1&2 Turbo c version 3.0"
and I plan on making my way through that, but what I would also like is if anyone has any tutorials that I could use as well or anything that explains syntax and functions etc etc in great depth because one of my problems is that I had a hard time working out what I was meant to do because all the "stuff" that I was supposed to learn wasnt explained well (For me anyway), the only thing I understood was that a float is a decimal number an integer is a whole number a boolean was either a 1 or a 0 and thats about it.
Also are there any free compilers with a visual interface? So far I have the free version of borland c++ 5 and open watcom 1.2 which are both command line.
By the way I'm not looking to be a master programmer, I dont want to write my own graphics software or anything like that, maybe just the odd simple program or utility.
And If I happen to get somewhere with this, (In a years time or so) what is a good commercial compiler to buy, I'm thinking MSVC++, so how much would that be?
Thanks :)
Hey Fluffy :)
If your interested in a well rounded programming books I would either suggest Games Programming All In One or Practical C++ Programming.
Parctical C++ is a good all around basic C++ book - its the O'Riley series with the animals on the front.
All In One gets into C++ as well as DirectX etc. There has been quite a bit of bad stuff said about this book (Premier Press) but I find it an ok book. You may find out along the way some of the stuff they have you work through may have errors in the code (theirs not yours).
You may also want to give http://www.gametutorials.com/ a peek. They seem to have some decent beginner tutorials.
Personally - I like the All In One because it explains as it goes through what and why - maybe not the best explanation to experienced programmers but to beginners its good!
Opengl tutorials for the beginner->intermediate are at http://nehe.gamedev.net
go forth, go nuts... it is the only way to learn :)
www.gamedev.net has some decent stuff for beginners, flipcode.com has some decent stuff for beginners / intermediate type programmers, and is more focused on university type people.
And yeah, MS Visual C++ is one damn good dev environment, although I personally prefer the 6.0 version, even though its a bit dated, which might meant that you could get it cheaper if you can find it though.
Octrees and Moving Objects
I was thinking of building a 3D engine beased on octrees - mainly because it's fairly easy to implement, and useful for visibility testing, collision detection, ray intersection testing, etc. However, I also realised that managing dynamic/moving objects in octrees is a real pain. Basically you'd have to update parts of the octree in real-time when the object moves. I was wondering if there is a efficient method for doing this? The scenery will be both indoors and outdoors.
I've got quadtree code I've written where I use a map (or you could write your own hash map if you don't like map's performance) to convert from object id's to node numbers (or pointers if you're so inclined) - so I can do a test to see if the moved object is still within the quadtree node, if it's not, I remove and reinsert into the quadtree.
Lots of optimisations one can do from there, but see how it performs first.
It shouldn't be too difficult... all you need to do is go up one (or two if you don't want to worry about passing the node's boundary) nodes and re-test it. As long as your testing isn't slow this should be fine :)
I have some nifty octree code around here somewhere, I'll see if I can find it. IIRC Kalin has done this stuff as well, I'll see if I can get him to post some stuff too :)
If you want to use OctTrees or QuadTrees in a highly dynamic environment I would suggest using the "loose" variety, this means that each node size if double of what it usually is, and the nodes overlap somewhat. There was an article about this in the first Game Programming Gems book.
The looseness helps in a dynamic environment because objects would tend to migrate between nodes less frequently as each node's size is doubled at least. I would try and explain more of it now but it's late and I've just gotten home from New Years celebrations.
It really depends on the complexity & mechanics of your world. Even with an extremely fast subdivision algorithm things can slow down very quickly if you have too many objects moving at once.
Provide yourself with some flexibility; Not all objects need affect the tree. I've written different octtree implementations and one of them was designed with a static octtree and was only affected by static geometry within the scene (Once, at runtime). Dynamic objects used these nodes for world/object & object/object collision/physics testing and the node's PVS was used to determine object visibility.
This example worked well in the context I needed it for but might not suit your needs, especially if you remove the PVS system; Then you're left with a straight Object/Frustum test, resulting with an O(n) complexity.
VC++ Style Inline Assembly under Linux?
I have several projects written under Visual C++ that have in-line assembly optimisations. The project compiles under Linux via gcc, but these optimisations are not used, hence only the genric C++ version of the code is complied. I was wondering if there are Linux compilers that support Visual Studio style in-line assembly syntax? I know that Intel C/C++ Compiler (Linux version) supports it, but I need a free compiler. Thanks in advance!
hey dom,
i did a google search and found this:
[url]http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html[/url]
I thought about using conversion scripts/tools, but meh .. again it's too much hassle. Some tools don't even support the full MASM/VC++ syntax. I want to keep ASM maintenance at minimum.
Btw, most of the ASM code are MMX/SSE optimisitions for image processing, which gives a huge performace boost over the generic C++ code.
Oh well, looks like I have to stick with the Intel C/C++ Compiler...
Programmer's Bookshelf
I thought this may be a a good topic to bring up and find out what books the programmers keep around and what they think of the books.
I have found some very good and bad books out there. Some (like Prima Press) tend to prey on people who are just starting out with little idea by using "games programming" as a catch phrase.
My bookshelf includes:
(Language Specific)
Teach Yourself C++
Practical C++ Programming
Effective C++
Effective STL
(General DX Programming Stuff)
Game Programming All In One
Strategy Game Programming with DirectX 9.0
Programming Role-playing Games with DirectX
Mulitplayer Games Programming
Real-Time 3D Terrain Engines using C++ and DirectX 9
(Maths)
Algebra and Trigometry
3D Maths Primer for Graphics and Game Development - This is a great book :) I have spent just a little time going through it but I have found it well laid out, lots of illustrations to demonstrate, and covers how to code thing. The nice part is that it covers the theory first then shows at the end how to code it. It is written very well and tries to keep the terminology down. Where possible they do explain in plain and concise terms what things are. This is a great book for anyone who needs to brush up on the 3D maths.
(Various Topic Books)
Game Programming Gems One
Game Coding Complete
(Engineering Books)
Code Complete
Software Engineering and Computer Games
Game Architecture and Design
- I'll sit down and write a bit about each book when I get some time.
*thanks to late christmas $$ from the US I got a few more books*
hi...well ive only been programming for a year, and I am still learning even the basics of DirectX, but I have the following books in my collection...
Language Specific
Schaum's Easy Outlines Programming with C++ - A good reference, but no good to learn from.
Visual Basic 6 for Dummies - This was one of the first programming books I bought, I never use it anymore. Good if you want to learn VB.
The Complete Idiot's Guide to Java 2 - Good reference and great to learn Java from.
1001 Microsoft Visual C++ Programming Tips - I got this book because it was on special for $20 at my newsagency! It is possibly the biggest book on Earth...great VC++ reference.
Jumping Javascript - Havent really used this at all, just bought it because it was $15 and about programming!
Game Specific
Game Development and Production - Excellent book on the process of creating a game. Covers all aspects of the game development process down to the finest detail.
Game Coding Complete - Most of the code was way over my head, but I know I have enough programming knowledge to at least basically understand what is going on. Has lots of useful code for game projects, and great advice on all aspects of game development.
Windows Game Programming for Dummies 2nd Edition - Great book to learn DirectX basics from, although LaMothe often doesnt explain the mechanics behind some of his code.
C++ windows programming books are next on my list...
I've been programming for a longish time, but most of what I have read has been on the Internet, so I have a rather small book collection, currently consisting of half University books and half Game Programming Books.
Computer Networking: A top down approach featuring the Internet (1st Ed)
Game Architecture and Design
Game programming Gems 3
Compilers: Principles Techniques and Tools
Operating Systems Concepts
Advanced Engineering Mathematics
Yeah i've been programming for quite a while, and been at uni quite a while so have collected quite a few books on the way, both for uni and out of interest. I was flicking through Game Architecture and Design at a bookstore the other trying to decide whether or not I should get it. What do you think of it Daemin/Jacana?
Language Specific:
Haskell: The Craft of Functional Programming - Not a bad book about Haskell, I haven't looked at it since I had to do Haskell in 1st year uni, but I remember it wasnt't too bad.
The Java Programming Language - This is the book written by Sun, It was helpful for getting started with Java, but afterwards I found the reference at the sun website took over my looking at this book
Java Swing - This book sucks, I had to use swing for a big software eng project and thought this book would be helpful, but nope, used it for 5 minutes before going to the sun website.
C: How to Program
The C Programming Language
- These two books are excellent, they are all folded up and crinkled
and stuff cause I use them a lot.
Algorithms in C - Excellent for learning about Data Structures and Algorithms. I have a feeling nearly every single computer science/ software eng student in the world has this book.
The Complete Reference: C++ 4th edition - Good book for getting into C++ when you've been programming in C for ages, a straight forward reference without any nonsense
Software Engineering:
Software Engineering Principals and Practice - Average book, good for learning about software architectures and process models etc.
Classical and Object Oriented Software Engineering - Basically an intro to OO design, cohesion/coupling etc.
Software Project Management in Practice - Its basically a case study about an Indian software engineering company called Infosys (one of the few companies to reach CMM level 5). It was a textbook for a software eng management subject. It suxorz, due to the fact it had nothing to do with the actual subject + it doesn't give enough general information
Graphics Programming:
Computer Graphics with Java - Computer graphics with java?? pfft! I did a subject at uni which used Java3d and this book was recommended. Its not a bad book, just that the technology sux.
Advanced 3D Programming using DirectX - Okay... though the author really doesn't cover anything too advanced
OpenGL Programing Guide (the red book) - Its the red book, probably every openGL programmer has this. good book.
The Cg Tutorial - Good guide to shader programming, it says "Cg" but is helpful in general.
Focus on 3D Terrain Programming - A very short book thats very easy to read (Read it cover to cover like a story book). Gives a good foundation for terrain programming
Graphics Programming Methods - Made by the Games Programming Gems guys, a collection of articles featuring the latest graphics programming things. Good book
Real Time Rendering - This is an excellent book about the theory behind real time rendering. Its nice because it focuses on concepts rather than implementation.
Maths and Physics:
Calculus: Concepts and Contexts
Elementary Linear Algebra
Advanced Engineering Mathematics
Fundamentals of Physics
- These were just a bunch of textbooks i used in the first 2 years of uni when i had to trudge through all that boring stuff.
Other stuff:
Artificial Intelligence A Modern Approach - This is bascially the default AI book for uni students (much like the algorithms in C book). Covers most topics in AI.
Operating Systems - Written by Tanenbaum (who made the minix operating system). This dude is an excellent writer therefore this book is good.
Computer Networks - Written by the same dude that write Operating Systems, good book.
I would say get it (Game Architecture and Design) if you can. Currently the one you're probably looking at is the Second Edition, but we probably have the first. I say it's well worth it, even if you're not directly involved with the design or management of a game.
The first edition would be getting quite rare now, since the company who published it went out of business, although there is a new second edition that has come out. From what I have read about it, it appears to be very much the same as the first edition, with a few changes and some new additions.
I had an interesting discussion with Burga a bit back about books vs internet tutorials.
I know a lot of programmers who have small book collections because most of what they need they can find on the net. I find that for my learning style books are a bit more useful then the tutorials.
For one I think its a basic thing of wanting to remove myself from the computer to read. I really dislike trying to read/learn while sitting at the computer.
Second, books provide a physical tangible thing. I can hold it, turn the pages, etc. I think this kinda flows over from Sheri's talk at AGDC about learning styles between men and women. Women seem to want to know what it is before they do it where as men will jump in and learn as they go.
Third, I find most books take time to break things down and explain how the different aspects of things work where as tutorials give you the whole thing. I like to examin each bit and try to understand how it works before I go on to the next bit. Explanations of how each bit works helps me to understand, too.
I am really bad for wanting to know how everything works. Not just from a practical side but also theory side. I am sure it slows my work down but at least it can't be said that I do no want to learn :)
I agree pretty much completely.
Internet tutorials are only really good for beginner / very specific things, if you want to learn something advanced or sort of out of the way (like DOS coding etc) you'll have a *very* hard time finding it on the net now. Books are good because people who write them usually include a lot of details about the background and implementation of different topics.
Well my bookshelf (Although i suck badly at programming, except Visual Basic 6) just includes C++ for Dummies with a snapped CD at the back (It just broke cause of the weight of the book).
Plus my other books:
PHP for the world wide web - Great PHP book for newbies
PHP Pocket reference - Just handy for those little PHP bits
3ds Max 4 - Great book for anything 3ds max 4 related
3ds Max 3 Fundamentals - Great book for anything 3ds max 3 related
The last two books (the 3ds max ones) are my newest editions, gladly welcomed [:)] thanks to my favouritest (Is that a word) forum member, i wont forget you and the books you gave too me fellow Sumea member [:p]. Now that i have my PHP books out i wanna read them too [:P].
Hi, haven't many books (2) as I have only been programming seriously for about a year I find most info I need comes from the internet. Although I am finding that I will be needing to purchase some math stuff soon, so this thread helped me out, thanks Jacana!
So my collection is :-
C:How to program, awesome book, I take it and read it everywhere, even my dog likes it (it is a little chewed)
Linux Game programming from prima press, like mentioned before it is written in a pretty straight forward sort of way and I went through it quickly, but it had many mistakes in the code examples which is frustrating (but gladly the internet helped out again)
see ya!
As an AI programmer, I have AI Game Development by Alex Champandard from New Riders which is a great book since it covers all the main areas of AI. Also the AI Wisdom books are good but are written more like research papers but are great at giving you ideas of your own. Also recently bought 'Physics for Game Developers' from O'Reilly (its got a cat chasing a mouse on the cover) which is a good primer for physics engine stuff and 'The Cg Tutorial'. I also still got my 1st year text 'C++: How to program' by Deitel&Deitel
-Vinh
Hey Guys,
Just wanted to share with you what I've scene in the industry. Hands down, the best books to read/what most games are based off of is the information in the Game Programming Gems series. Everything from AI to Filesystems is covered and it's been my experience that the algorithms in there are the basis for almost all of the systems that are used.
Hope it helps.
Not specifically game related, these, but IMO are must-reads for intermediate to advanced C++ programmers.
"The C++ Programming Language" 3rd edition by Stroustrup (very good reference book)
"The Annotated C++ Reference Manual" 2nd edition by Stroustrup and Ellis (slightly old, but excellent all the same)
"Design Patterns" by Gamma, Helm, Johnson & Vlissides
"Large scale C++ software design" by Lakos
Cheers,
Mark
I thought I may as well mention the textbook the University of Tasmania is using for their first programming unit:
Java Software Solutions - bought it because I thought I had to, but was just a waste of money because I have Java programming books already...but a great reference, not good enough to learn from relly though unless you are being taught at the same time...
anybody know of a good C++ WIN32 programming book? i really want to learn how to program WIN32 stuff, at least so I know just how to get a Window on the screen...
Before buying any book that is a reference or textbook for a Uni course is to ask myself will I ever need to use its contents as a reference in the future, if not then I will not get it as it wouldn't really be a good purchase, otherwise I buy it, with all the ownership that it entails!
Right now I'm looking for a good reference data structures and algorithms book, if not that then I'm thinking of writing my own reference type book "Dom's big book of Data Strucutres and Algorithms".
Data Structures for Games Programming is a very good book - mind you they don't get into a lot of the more advance stuff :) Really its a good beginner to intermediate book in terms of that.
I agree on algo books tho. I really would like to find a good one. I'd love to see the guys who did the 3D Maths Primer do an algo book in the same format as the 3D one.
Thought I might as well ask here just in case anyone knows, but does anyone know any good books on differential equations? Mainly things like systems of non-linear differential equations, phase plane analysis and more 'third year uni' style DEs? Before anyone says Mathematics for Engineers... by E Kreyszig, I already have that and it doesn't go far enough into the rabbit-hole.
@Kane: Charles Petzold is the authority for Win32 programming. I forget the name of his book, but its in its 5th edition last time I checked.
ORTHODOX
- Game Programming Gems 1
- AI Programming Wisdom
- Practical C++ Programming
- Expert Programming in C
UNORTHODOX
- Maths 1, Maths 2, Physics Essentials (remember those old 'Essentials' books for studying Year 12 subjects? I still have them :))
- LOTS and LOTS of printed tutorials and stuff photocopied out of various books I couldn't afford to buy (like other Game Programming Gems books). I have mountains of papers.
If anyone wants a fairly straightforward introduction to numerical methods and the like then "Numerical Mathematics and Computing" (5th Ed.) by Ward Cheney and David Kincaid got a bit of a workout when I got started. Very simple book, probably doesn't go far enough into things though, but that's life I s'pose.
I have far too many books (and my wife regularly reminds me) but here are what I think are a few of the most important ones to me.
Game Programming Gems series (1, 2, 3 and 4)
- If you are into games at all these are brilliant.
Computer Graphics - Foley, van Dam, Fiener and Hughes
- This book is the CG bible - is the most thorough CG book I have read. Forget it if you want code samples - all algo.
C++ Programming Lang - Stroustrup 3rd ed.
- Great language reference.
Also, I read a great number of papers at IEEE. I find most of the finest works there. I recommend anyone who needs to understand a topic for implementation on a computer to check there first - brilliant resource.
And another resource ideal for game developers is gamasutra (www.gamasutra.com) - the articles they provide are of excellent quality and are a great pool of information written by the best in the business.
There are a few classic Motorola 68000 series asm books that I dearly love too.. but hardly of much use these days.. ahh.. the Amiga. :-)
You can actually download .pdf instruction set specs and architecture plans for intel processors from their website. A good thing I keep handy in a seperate folder on my desktop.
As sources of information I'd say the best thing is to subscribe to every online programming resource centre you can find. These include 'Flipcode','Gamasutra' and 'Codeguru'. Also 'Citeseer' is really good for downloading papers free of charge. (You can also try ACM but they require subscription). The information there is often more recent than that found in 'tips n' tricks' books you can buy.
As for books, things that I turn to regularly are:
Charles Petzold's Windows Programming book (most recent version)
-extra thick tome on all aspects of windows programming.
Stroustrup (mentioned in previous posts)
-everything you needed to know about C++, and everything that you didn't.
Graphics Gems series/Games Gems/GPU gems
-Contain stuff you won't find on the messageboards.
A single book with a title including the words '3D, DirectX,
Source Code Included'. Check out what's covered in the book, and that it's not written in MFC wrappers. I reckon you only need one.
Never buy any book with the words 'Unleashed!!, In 28 days!!!' in the
title. Just a gut decision ;)
Much useful information can be found in docs. For graphics I found Foley&Van Damme's Computer Graphics a good resource- It's getting
a bit outdated nowadays though.
I've heard Visualisation of Natural Phenomena is quite good. Can't remember details.
quote:Originally posted by Daemin
For the assembly language I would suggest getting the "Art of Assembly Language Programming" it's available for free (well download costs) on the Internet.
I read it a while ago and it's been a good reference.
The following books I have found very very nice to read to improve C++ skills and coding practices.
- Effective C++
- More Effective C++
- Effective STL (A must read if you use STL! (And you should be!))
A nice set of books from Scott Meyers, points out lots
of things you should be thinking of when coding. :)
- Exception C++
- More Exceptional C++
These two are from Herb Sutter, and go into alot of
detail from small code examples. Very nice.
It makes you alot more aware of things when coding.
- C++ Templates - The Complete Guide.
A nice template book from David Vandevoorde, and Nicolai Josuttis.
A bit heavy, but definitely good to read to get started with
heavy template programming.
- Modern C++ Design
This is by Alexei Alexandrescu. Very very nice book.
Shows lots of design patterns implemented with new-style
techniques, lots of template code. A bit advanced, but definitely
worth a read. (Implements design patterns from the Gang of Four
Design Patterns book)
I haven't actually read many Game-Programming books. I find just the
net and lots of practice suffices for that.
Other than those books, looking at documentation for things like
Boost libraries (http://www.boost.org) and seeing code there is
good to learn from.
kalin.
giving something back, physics for games
harro, thanks to the people who have helped/ commented on my post, though i might try to give something back. (ie, finished another step of my physics engine)
setup. have object in game world, and want it to move/ collided/ have forces act on it/ momentum
a potential solution. reduce each object to a 'force diagram' at the begining of each frame (quantify all the forces on the object) and resolve this in the world. (so, i have this force from gravity, this from velocity, now subtract the static coeeficent of resting on an object, if force still left then kinect coefficent and or whatever...)
the math.
SumForce = (velocity(old) * mass ) / time
SumForce += (acceleration forces in world(gravity & whatever)) * mass
SumForce -= restitance force if im resting on another object
Displacement = ((SumForce * time * time) + ( velocity(old) * time )) * 0.5
Velocity = (SumForce * time) / mass
_note. displacement is the average of old and new sumforce * t^2, I just think of it in terms of velocity, as i use it in collision....
perhaps this could be of sue to someone, derived from
F = ma and
x - x0 = vt + 0.5at^2
Hi David, yeah I've been playing around with similar stuff, and I'm doing something similar - although I'm breaking it into two parts - statics and dynamics. Statics being momentum transfer/conservation of momentum, and Dynamics being this force resolution you're talking about. You'd probably also extend this to building up a graph of objects that are touching, and chain the momentum transfer/conservation of energy calculations.
For example, if A is pushing on B and B is resting up against C, you need to resolve the momentum transfer as a chain to get everything moving with the appropriate velocities.
It looks like you're attempting to handle both the Statics and Dynamics in one, which is probably going to be really tricky. The momentum (ie velocity(old)*mass bit above) isn't a force, and including it will essentially mean that the faster an object is travelling the faster it will accelerate.
You probably want to divide SumForce through by the mass (a = F/m) - unless you're assuming everything is the same mass anyway. And think the last line for Velocity = should be Velocity +=.
I've yet to finish the conservation of momentum/energy part of my system, I may yet collapse the Statics and Dynamics back into one lot of code, but want to get it working separately first (much easier to debug :)
Cheers,
Mark
Hey,
I wrote a simple physics engine about a year ago which handled particles, spring-damper systems, and environments (friction, air resistance etc). One word of warning, at present, you're using Euler integration to calculate your values of Displacement and velocity:
s = u*t + 1/2*a*(t^2)
u = initial velocity, s = distance, a = acceleration, t = time change
This is just one of the equations of motion, but your equation:
x - x0 = vt + 1/2*a*t^2 is an Euler integration, which may cause stability issues later down the line.
When I first wrote my physics engine, I though, yeah yeah, stability crap, it'll be fine, but then when my particles somehow started gaining energy in their spring-damper systems and oscillated to a massive speed, I realised that maybe Euler integration wasn't going to work.
You have a number of options:
Mid-point integration
4th order Runge-Kutta integration
Taylor Series expansion
none of them are particularly exciting, but I'm sure if you search for them, they'll pop up all over the place, and won't be too hard to implement!
cheers
Matt
VC++ Intro Edition
hi all...
i use Visual C++ 6 Introductory Edition and it is illegal for me to distribute exectuables i create with it...
does anybody know if the same rule applies to source code, that is can i legally distribute the code to my programs?
it trys to make the code run faster by doing smarter things to the machine code (_ASM ~asembly) , so it might unfold loops, place more code inline, align memory reads onto dword boundaries...
i was use to see 'gcc' do stuff like change loops into two machine instructions, (_dec, _njp ~decrement value, jup is not negitive) and then vc6 do something like( read, move, read, move, sub, cmp, jp....
University stuff
hi all
can someone tell me, do Uni courses teach windows programming?
large code projects, recomended books/ links?
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....
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)
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]
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).
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)
Amateur development on GBA !
Hi there, not sure if this is the right place for this topic...
Like lot of people here, I play with videogames since I am a kid. [:D] Unfortunately, although I am working with computers, this is not in videogame industry.[:(] So I catch up at home [8)]
After having browsed this forum, it seems that GBA is not widely discussed as a development platform. If you are interested with this platform, you can head in the next few days to: http://rmstudiogames.free.fr to download a library I designed to facilitate the development on this console. It only helps in coding itself, not in every aspect of game development like Catapult for example.
Or you can head right now to download the freeware games I wrote with this system which are remakes of classic Commodore 64 and Amiga games... Enjoy it ! Any feedback is welcome !
Well at the AGDC Half-Brick Studios showed off a game that they made for the GBA using Cygwin, GCC, and an emulator. It was a really old-school type platformer named: Fuzz and Rocket (It got my vote!). It seemed to show that GBA development can actually be relatively easy if you want to make a plain game, however for the link API etc I would suspect that you'd need the official GBA kit.
I would say using the good ol' GNU tools would be the easiest way to develop for the GBA.
My dev system is actually based upon a GCC suite. I use HAM compiler chain (GCC 3.2). I am sure that would work with the other wide spread freeware compiler in the scene, DevKitAdvance (GCC 2.8) without any trouble.
The library I provide is a C/C++ library on top of GCC. It "only" simplifies the way you manipulate the hardware, in a convenient way rather than weird binary operations (I do that for you). I know that lots of people wanting to develop on GBA are stuck with all that register stuff. Plus now I have started integrating high level concepts (sprite manager, more to come).
This system works fine both on emulator (at least VisualBoyAdvance) and on the hardware.
For the link API, no need of the official kit[:)] You can perfectly handle this through C, and I will integrate it soon in my system (I have all the specs, I only need time badly [V]).
BTW: I saw screenshots of Fuzz, if gameplay is in par with gfx, it should be a big hit !!!
Nice tetris conversion! Brings back so many memories [:)].. and yeh, I agree, the C64 version of tetris was miles ahead than the others that were around at that time. Nice art, and some great atmospheric/trippy music too!
There are plenty of excellant c64 and Amiga games that beg for conversion or even an update.. I mostly emulate the games that I loved though!
Thanks Souri !
It reminds us that in the good old days, even with low end platforms, you could have some really nice things achieved.
It's why I love to reprogram classics, because it brings back lots of memories, and I enjoy doing that. Not working in the games industry, at least I participate to it. When people tell me they enjoyed my work, there is nothing more rewarding [;)] I just wish I had more time to implement old classics. The list is endless: H.E.R.O., Oil's Well, Archon, Tapper, ...
A few games have made their way commercially though: Manic Miner, Speedball 2, Defender Of The Crown, Classic Arcade collections (Namco, Midway, Konami), Boulder Dash, Ghouls'N Ghosts, Bubble Bobble, ...
Hello there,
at last my website has been redesigned... Also, as I mentionned it earlier, you can download the C/C++ library I wrote in order to help with GBA programming. All my games were written with it.
It's here: http://rmstudiogames.free.fr
A quick games programming competition ?
Just wondering if any programmers would be interested in a short (lets say 1 month) games programming competition with a really crap prize :-)
I've been thinking of holding a small, controlled competition based around some of the ideas I've had from entering other coding competitions over the years.
I don't have any real prizes (maybe just some stuff I won in the raffle at AGDC) so I wanted to see if there would be any interest in it before planning it out further.
The basic idea would be that the comp would be very controlled conditions, and inteded to show a particular side of programming skills as well as general game design ideas.
I'd either hold it in December or January depending on the interest.
What do people think ? I know there are other programming comps out there and there may not be interest in a small one with crap prizes :-)
Some of details I'm currently messing with in my mind:
- Using Java as the language (close enough to C/C++ that people can learn it in a few days if they can already program)
- Target platform would be a mobile phone emulator - or the actual phone if you happen to have one :-) (MIDP 1.0) so that performance is critical. I have a Nokia 6610 so it would probably be that phone :-)
- Limited code/data footprint of 64kb
- Limited total memory footprint of (yet to be decided, maybe 100kb?)
- All entries able to be downloaded and played from the net, but sourcecode is optional.
I'll continue this idea further if there is interest.
Zaph [B)]
quote:Originally posted by Shplorb
Or alternatively: http://www.disasterarea.net/xmascompo/ =]
I think the focus of that competition is very different - it's not got a lot to do with making games (a little, but only part of the job).
I was hoping there would be interest in a competition specifically geared towards gaming, but I guess there isn't much interest at this stage [:(]
I'd like to see this sort of thing get up and going for the coder community - even as a show of encouragement for you lot to get more active [:)]
How about reproduce your own take on the original pong in 2 months? It wouldn't be about nifty effects, or "time attack" (producing something in a ridiculously small amount of time); but rather making an interesting new take on something simple and recognisable in whatever you're comfortable with.
I'm kinda disappointed at the lack of enthusiasm by programmers on here! This sounds like an ideal little challenge to get going, and it's the perfect solution to spark up some programming activity on Sumea. It would be great to have the kind of interest for a programming challenge like we do for the modeller challenge, but it really is up to you coders to make it happen (and there are plenty of you on here!)
25000k
Chekc out the site, and scroll to the last paragraph and read it, should be intresting for you guys http://www.gamedesign.net/newmontharchive.php3?startdate=2003-11-08%200…
quote:Originally posted by codyalday
Chekc out the site, and scroll to the last paragraph and read it, should be intresting for you guys http://www.gamedesign.net/newmontharchive.php3?startdate=2003-11-08%200…
"Each Entrant:
- must be over the age of 18 and must be a United States citizen.
- must be a full time undergraduate or graduate student in an accredited two-year or four year university at least through the Spring 2004 quarter/semester at that school"
WIN32 or .NET
hi all...
i want to start programming windows apps in C++ but I am unsure what to learn to do this...should I learn Win32 first then .NET or skip straight to .NET?
also, if Win32 is the way to go, what books can I get to learn from? and is a book on Win32 published in 2001 out of date, or would it be ok to learn from?
thankses!
For games, my advice would be don't touch .NET - you're always going to want speed, and currently using C++ is the sweet spot on the ease-of-use/performance curve - it used to be assembly, it'll probably move away from C++ in 5-10 years, but the pragmatic choice is currently C++ - no pun intended [;)] I'd also suggest that you avoid MFC for games if at all possible too.
There's very little platform dependent (ie win32 specific) code required to write a game, typically it's just open a window, set up whatever 3D API you're using, and grab messages from the OS.
A book published in 2001 should be fine - you might also like to install the M$ Platform SDK from:
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
It has a very extensive reference library.
Java Programmers
Hi all
I am looking to be developing some mobile phone games in the New Year (2004) and I would like to team up with any Java 2 programmers. I have investors support and I am very serious about moving on the new WAP market for games. The titles are unimportant at this stage you just need to know we are looking at some snow board and race games.
So if you are keen email me at lukeo25@hotmail.com with Java2guy as the subject.
Cheers
The .au xmas competition 2003!
It's that time of year again!
http://www.disasterarea.net/xmascompo
Download the [url="http://www.disasterarea.net/prods/da-auxmas03.zip"]invtro[/url]
MFC Books
hi all,
i am looking ino learning MFC and i was wondering if it is safe to buy an MFC book published in 1999...or would a newer book be more appropriate?
Data Structures
hi all...
i am currently broadening my C++ knowledge by researching data structures, which is a topic that was not even mentioned in my programming course at TAFE...[?]
i was just wondering what linked lists, binary trees and other data structures are commonly used for in games?
Lists and trees of all types are used in games, it's necessary to have some Vector / Dynamic Array, and Linked List class at a minimum. Its very useful to know all the data structures since then you know the trade-offs and peculiarities of each data structure.
For example: Arrays are useful for storing smaller values that are acessed often but not removed often. Linked Lists are good for when large nubmers of items are added / removed, Hash tables are most useful for when fast finding of items is necessary etc.
an area of games where the use of data structures is very important is in organising the geometry of the game universe in some sort of spatial data structure (by spatial data structure, i mean a data structure that conceptually splits the game universe into discreet parts).
an example of a spatial data structure used quite often is a BSP (Binary Space Partition) tree, this is basically a normal binary tree but as the name suggests, a bsp tree is derived by recursively dividing the world into two.
for example, we start off with the first node;
0
the first node encloses the geometry of the whole game universe.
we can then partition the game universe, so now we have
0
/ 0 0
where the two nodes in the next level represent two halves of the game universe, we can subdivide further getting;
0
/ 0 0
/ / 0 0 0 0
where the nodes in the next level are the halves of the halves of the game universe and so on.
anyway, by doing this, we have now divided the geometry of the game world into lots of different nodes.
why wouold we want to do this you ask?
well basically, by using a spatial data structure to organise the geometry of the game, we can accelerate many queries about the geometry in the game universe.
for example, we want to find whether two pieces of geometry overlap (for example a rocket and a baddie, if say you fired a rocket at a baddie), instead of doing a collision test between the rocket and every single baddie in the whole game, we can traverse the binary tree, looking for the node that contains the rocket. now, we only have to do a colliison test between the baddies that are in the same node as the rocket. (thus greatly increasing the speed of the game engine)
this is a pretty basic explanation of BSP trees, but thats the gist of it.
I hope i've made some sense here
[:)]
For general info check out the Dictionary of Algorithms and Data Structures: http://www.nist.gov/dads/
Also, you might want to read the STL container docs, they will explain the pros and cons of each in great detail: www.sgi.com/tech/stl
Basically lists are used for objects that have short life-spans, eg a list off all the characters in a game, or the lists of particles in the particle system.
Trees are used when you need to search for something, such as a tachyon has described, but can be used for other things like NPC chatter in a RPG game (a tree of choices).
Hash tables/maps are used to map one thing to another, with an emphasis on fast searching. eg player name -> player stats
Mel Scripting Site for Programmers
heard of this site and thought that some programmers may be interested (wink wink nudge nudge). http://forums.melscripting.com/ i was going to post it in the programmers area, but that place just scares me (bashful rubbing of toe). so instead i put it here. ** I moved it to the programmers section anyway. Don't be scared of the programmers! They're people too!
#ifndef statement
Hi all,
In a book I have just finished reading I came across the following code and was wondering what it does:
#ifndef MONSTERNPC_H
#define MONSTERNPC_H
#endif
I am not quite sure what the #ifndef statement does, so can someone explain it for me?[?]
Using #pragma's is generally a bad idea if you want to write code that is compatible across multiple compilers, as #pragma's are compiler dependent. However, if you know that the code will only be compiled on a single compiler, then it's fine to use them.
The worst case scenario for using #pragma's is the same command does one thing on one compiler, and something different on another compiler which screws everything up :P
I guess that might be a reason to always RTFM first :)
However, to get back on topic and give a slightly more verbose explanation of what lava_monkey said...
When compiling, the compiler has a preprocessor which goes through files before actually compiling them. The preprocessor keep track of a bunch of pseudo variables that are defined by #define statements. A #ifndef statement checks if a variable exists, and only executes if the variable (token) does not exist.
So,
#ifndef TOKEN
#define TOKEN
// Put definitions here
#endif // TOKEN
is kind of similar to
if ( !TOKEN )
{
TOKEN = true;
// put definitions here
} // if
However, the #ifndef etc. is checked at compile time, not run time. I hope that analogy makes sense.
The basic idea behind this, is that defining a class multiple times with the same name will either cause compile errors or unexpected results. So, if you included the same header file into two source files without the "guards" the class would be defined twice and cause problems. By putting the "guards" in the header file, you make sure that that header file will only be parse once by the compiler, because the second time the compiler tries to parse that file, it will go "oh look, MONSTERNPC_H already exists, so i won't bother looking at anything til i get to the next #endif".
I wonder if that all amde sense :)
Check out the preprocessor in your favourite c/c++ book for more info :)
CYer, Blitz
Mutable or immutable objects
What is the benefit of using immutable objects?
I'm making my Tetris clone and I have a Piece class. Now for the rotations I could have it change its internal data that represents its body, or I could make it immutable and have several objects that each represent a certain piece in a certain orientation.
I'm not sure what the cost/benefits of each option are.
by immutable are you referring to const?
if so, the benefit of a const object is that it is only able to invoke const methods, so your data can not be modified accidently.
if you have members which need to be modified, such as your piece orientation, then you can use the mutable keyword for these.
edit: the above is assuming c++, if its java (which im thinking right now it might be), then the concepts are the same i believe, though im not entirely positive
You would be better changing the internal data (state) of the piece. Think of the piece as an object. To turn the piece around you don't replace it entirely, you're just changing which way it's pointing. I can't see any benefits in doing it the other way. In fact it would seem to me to be fairly messy.
CYer, Blitz
"Immutable" has some other connotations here, too awf - there is a C++ keyword, as shiva points out called "mutable". I'd describe what you seem to be talking about as "const objects" to avoid confusion here. It's been quite a while since I did any java, so I can only speak with certainty about the C++ side (but the same concepts apply to java)
Anyway, this is kind of a mix of the two ideas...
I guess the first thing I'd do here is to look at the Piece class - I find it a bit hard to explain the exact logic I'd use (I tend to do things intutively with design now, so it's hard to describe) - but I'd instinctively break the Piece class into two - one representing the shape of the object, and one representing the other state information about the Piece.
The Shape itself wouldn't know about its absolute orientation - it's up to the Piece object to provide context on this.
When the Piece class is queried about what its shape is, you'd really have a few options here:
* if you're going for 3D pieces, then the Piece would return the orientation information (be that a euler angle, matrix or quaternion) and return the Shape it holds a pointer/reference to.
* for 2D, you could copy the 3D version and have an angle returned, or
* if you're going for 2D pieces, then you could copy the Shape from the Piece class, rotate it, and store the rotated version on the Piece class (this is an excellent spot for the mutable keyword BTW - but more on that soon)
For 2D I'd probably recommend the last option as it simplifies the code where you're actually using the shapes (eg testing if they collide or drawing them)
So the places const crops up here would be:
(A) the "original" Shapes are const with respect to the Pieces (ie Pieces are not allowed to modify them, but you need to be able to delete them later)
(B) the "duplicated" Shapes are not const, but their copy constructor would take a const ref to the Shape they're duplicating
(C) the "duplicated" shape - it makes sense to store this on the Piece until the orientation of the piece changes, but you want to return the "duplicated" shape as a const pointer/reference.
As usual, it's easier to produce some code than describe it properly :-) so I've put some code at the end of this to help you see where A, B and C are.
The point (C) is where the mutable keyword comes in - when a data member is declared as mutable then you're allowed to alter that data member from within a const member function. You should use this keyword sparingly, and pretty much only in the case I've outlined below (for what is called "lazy evaluation"). Pretty much anywhere else I've seen mutable used is usually a total hack.
[Note 1 that applies to the code below: It's good practice to order your data members in order of classes, pointers and references, then decreasing float/int sizes - this will reduce the size of the object - so the mrsShape and mrsActualShape would usually be best ordered the other way around]
Cheers,
Mark
[code]
class Shape
{
public:
Shape(/*info on the actual shape would go here*/);
Shape(const Shape &rtShape) { /* copy the bits needing copying, clear the rest */ }
Shape & operator=(const Shape &rtShape) { /* copy the bits needing copying, clear the rest */ }
// or perhaps you might just go for just one rotate(int angle) - this modifies the internal state of
// the shape
void rotateRight() { /* do whatever's appropriate for your representation of the shape */ }
void rotateLeft() { /* do whatever's appropriate for your representation of the shape */ }
private:
// whatever representation you choose
};
class Piece
{
public:
//////////// (A) - original shape is const with respect to the Piece ////////////
Piece(const Shape &rsShape) : mrsShape(rsShape), mbRotationDirty(false)
{
}
// Make the member function const as we don't need to change state of the
// object to get the rotation...
int getRotation() const { return miRotation; }
void setRotation(unsigned int iRot)
{
// Ensure rotation is < 360
miRotation = iRot % 360;
// Remember that the mrsActualShape is no longer valid by setting a flag
//
// This is used for "lazy evaluation" - we _could_ do all the rotations of our
// copy of the shape here, but perhaps we're going to adjust the orientation again
// before we need to know the final Shape to use/draw
mbRotationDirty = true;
}
// Make this routine const because this isn't changing the "core" state of the object
const Shape & getShape() const
{
// If the rotation hasn't changed since last time we were in this member function,
// then it's safe to use our cached copy of the rotated shape
if (!mbRotationDirty)
return mrsActualShape;
// By using the mutable keyword down below against the "mrsActualShape" member
// we allow ourselves to change the member from within a const member function
//////////// related to (B) - duplicated shape is not const ///////////////////////
//////////// related to (C) - use of the mutable keyword //////////////////////////
mrsActualShape = mrsShape;
switch (miRotation)
{
case 0:
// do nothing, mrsActualShape is already in the right orientation
break;
case 90:
mrsActualShape.rotateRight();
break;
case 180:
mrsActualShape.rotateRight(); // probably want to do it all in one go
mrsActualShape.rotateRight(); // but this is just for example
break;
case 270:
mrsActualShape.rotateRight(); // probably want to do it all in one go
mrsActualShape.rotateRight(); // but this is just for example
mrsActualShape.rotateRight();
break;
}
mbRotationDirty = false;
return mrsActualShape; // Implicitly converted to const Shape &
}
private:
//////////// (A) - shape is const with respect to the Piece ////////////
// (see Note 1 regarding order of this and the following member)
const Shape & mrsShape;
//////////// (B) - duplicated shape is not const ///////////////////////
//////////// (C) - use of the mutable keyword //////////////////////////
// (see Note 1 regarding order of this and the previous member)
mutable Shape mrsActualShape;
// What rotation is the
unsigned int miRotation; // 0, 90, 180, 270 degrees
//////////// (C) - use of the mutable keyword //////////////////////////
mutable bool mbRotationDirty;
};
[/code]
(Apologies for the 4-space tabs being converted to 8-spaces!)
I think I get it. A piece object contains two shape objects. One const and one mutable. The const shape is the original orientation (one of the seven tetris types) and is never changed.
The mutable shape is what you would return after a rotation. The mutable is like the current orientation of the piece. So this is changing the internal state.
Not sure about lazy evaluation and why you would need to rotate by more than 90. Wouldn't each time through the game loop have only one rotation? Is lazy evaluation for generating each rotation as a new piece object? If so then that seems to be like the many objects scenario.
Thanks for all the help.
Awf, yeah that's correct what you've said.
I mainly went for the lazy evaluation to explain when to use the mutable keyword - but yes, you could well remember the rotated object's shape and rotate by 90 degrees when the user rotates the
piece.
The reason I'd shy away from not recalculating the new Shape from the original one is that if you used the same idea with a 3D program, you would have to worry about numerical error building up.
As you're suggesting, rotating by 90 degrees would work fine for a 2D tetris game.
The lazy evaluation is of the new Shape from the original Shape. So in the code, the "mrsActualShape" is being lazily evaluated. Yup, you're right that it's like the many objects scenario - but you're also changing the actual shape's internal data.
Cheers,
Mark
Games programming in Darkbasic
I have been looking at Darkbasic as a quick developing software. I understand its good with directx and Nvidea stuff ( shaders etc ) but I don't know of anybody who is raving about it. Does any one use it exclusively and is it any good.
...um, why nut just use c++ and directx, it is not _that_ scarry... in a few days i had a working data driven framework which loaded geometry, animations and basic controls...
have done content for a darkbasic game, loads .3ds files fine and can play back their animation....
you can do stuff with it, and make a game, but IMHO, you will end up with something that runs at 25% of the speed or a real c++ 'well programmed' game....
I've never seen anybody seriously use DarkBasic to make a game, well except for the people that sell it or are affiliated with it. I suppose it might be a useful tool if you will only program the game for yourself and aim never to actually get into teh games industry as a programmer.
However if getting into the industry as a programmer, or making a decent game that you can pawn off as shareware or something then I would strongly urge you to just use C++ and DirectX or something, maybe even OpenGL to start off with. It's not that hard, I mean even an artist guy like david got something working - I mean really! ;-)
What is everybody coding?
So, it's over half way though the year, and the NYG is also closed (well it will be very soon), so what is everybody working on now. I mean programming wise. I'm sure that there are many interesting and whacky projects that people are doing!
just read a huge book on software engineering and thought to try programming again.
having a go at a robust data driven 3d fighting game...if i get time to finish it, could be interesting
reality. (actaul progress) log file. variables from init file. parse scene file (geometry, animation, lights, camera). directx framework. (ie, really primitive stuff that real programers i imagine won't find impressive, but never seem to be present in any project i work on as an artist)
current task. atempt2 at animation control class. (managing what keyframes are active and what objects are effected) state based....
dreams. everything as dynamic bones (ones with active animation are not as elastic, have a dot product limit on bone movement). continious time collision ( i can dream can't i?)
and spending 5 days a week making triangles for money.
Right now i've taken a much needed break... but i'm sure i'll return to it with full enthusiasm to work endless days and nights once again. except for the 3 weeks coming as i have a job serch training program to do :( They might just help me get some kinda part time work in the mean time until i make it in the industry :)
Models
----------------
I've been working on my game demo 'wastelander' (possibly only working name depending on what i actually make from it). Recently i've dived into the world of key frame animation using md3 as a base, using existing custom models and working them into my game. works great and looks nice (SLERP and quarternion rotations were nice to beat)... if i get far enough to actually have a game to lure animators to work on my project, i'll be looking at a 3dsmax plugin and my own keyframe animation based model format as i'm gunna need afew special animations for starters. Weapon's load and switch.. err just like Q3 atm. When i get my map format sorted i add object placement (such as weapons, static models etc)
Maps
----------------
I've written a map compiler for my format, pretty basic sofar, mesh data, textures, and map specs. Later to include object placement etc. As far as the mesh goes it's got no LOD and there's no tiling so it's nothing special. It takes a raw image file with a bunch of parameters and creates the mesh from that. The game engine takes care of the oct tree creation.
I am just doing programming for school stuff :)
The past month or so life has been too hectic for "spare time".
While its not programming - I have been working on some stuff for students for the AGDC as well as stuff for students with the GDAA.
Right now programming is being left for school and spare time for other things!
virtual function table pointers and memset
not that i write code (cough) but was writing something suspiciously big over several days, in vc6, and today stated to use memset in my object constructors (got bored initilising stuff to 0).
was also using virtual functions in some objects, and after a while i stated to wonder where the virtual table pointer for the compiler to know which 'virtual function table' the base object was using, as it would be really impressive if it was outside the object, as each base pointer needs some unique way of knowing _which_ table to use
and now i'm currently having a break, as just steped through some code, and the virtual function table pointer seems to be zeroed by a call to memset(this,0,sizeof(KeyObj))
not happy.
summary, don't use memset in constructors of classes with virtual functions. if i read this before, i now know to pay attention to it.
DSC
Yeah, tha's one of those big no-no's, to use memset to set all of an object's contents to 0. It's okay to do it in plain old C code because they have no such thing built in, but not in C++.
Generally though an object has a vfpt (Virtual Function Pointer Table) if the class has inherited or has any virtual methods. It will have more than one of these pointers and tables if it has inherited from more than one class containing virtual functions.
thanks for comments everyone. was just surprised that the vtp didn't behave like malloc base (which i think puts a link list and flag infront of any memory returned...)
good point redwyre about not letting classes get too big (though unnamed struct in class looks evil :) i like evil.
threw out a days worth of codeing just to redesign it tomorrow, and even went back to clean up one of my base classes
//slightly disturbed buy redwyre having a GUID
If i understand you correctly...
It doesn't behave like malloc, because the memory returned by malloc is allocated natively by the operating system. VFP tables are handled at the application level, and memset etc. are handled at the OS layer and so have no knowledge of the app (and vfp table)...
Perhaps a C++ version of memset could be created to handle VFP tables :P
I think thats about right.
CYer, Blitz
Two Possible Solutions
I'm not entirely sure about this, but you may be able to rely on the fact that (most/all?) compilers will layout the internal fields of the struct/class in the order they are declared. If you memset the area between the first and last declared members (inclusive), you can effectively set the data area of the class. This technique will also have the side-effect of clearing any internal padding between members, which may or may not be desireable.
Note that we don't use 'sizeof' since it returns the memory area *including* any trailing padding (and of course the space occupied by the class' v-table).
Lack of supporting polymorphism aside, this should do the trick.
[code]
// macro shamelessly ripped off from microsoft
#define offsetof(s,m) (size_t)&(((s *)0)->m)
class Foobar
{
int a; // first member
char b;
float c;
double d; // last member
public:
virtual ~(){} // we want a class w/a vtable
static Clear(Foobar* pFoobar)
{
size_t ofsFirst = offsetof(pFoobar,a);
size_t ofsLast = offsetof(pFoobar,d) + sizeof(d);
memset(pFoobar + ofsFirst,0,ofsLast - ofsFirst); }
};
void main()
{
Foobar a;
Foobar::Clear(a);
}
[/code]
Another way would be to override the new operator, which may not be desireable but is by far less of a hack. This works well since the allocation *has* to ocurr before the constructor can run, and before the vtable can even be assigned to the newly allocated slice of memory. Of course, this won't help any statically declared objects that never call 'new'.
[code]
void* operator new(size_t size)
{
void* p = malloc(size);
memset(p,0,size);
return(p);
}
// 'delete' included since some compilers complain when you don't
// implement a matching 'delete' for your overidden 'new'.
void operator delete(void* p)
{
free(p);
}
[/code]
offsetof is part of the standard () :)
another alternative (just FYI, this is all getting to be quite hackish):
template< class Ty > class ExplicitDefaultCtor
{
proteced:
Ty m_object;
public:
ExplicitDefaultCtor() : Ty() { }
operator Ty& () { return m_object; }
operator const Ty& () const { return m_object; }
};
class Foo { ExplicitDefaultCtor foo; }
actually, I think vc7.0/7.1 calls the default constructor of built in types now, so none of this should be nessisary..
When and why did you start programming?
From my experience, trying to learn basic on the c64 when I was 9 or so (and then assembly on the Amiga) was too much work and effort, just to see any results. Even getting something to show up on screen was a lot of work. I'm a pretty visual kind of person, and I like seeing the progress and results of my work instantly, so by not seeing anything from my programming efforts, it wasn't much encouragement to get into it more. I should say that the internet wasn't around then, so trying to find documentation and tutorials was pretty hard, and the documentation I did have weren't really tutorials that guide you, but more like manuals.. I eventually gave up, and that's not to say I didn't give it a fair shot!
So how and when were you introduced to programming, did you find it as challenging as I did (maybe it was a breeze to you?), and what made you decide that this was what you wanted to do?
On a side note, reading [url="www.sumea.com.au/sprofile.asp?member=70"]Jacana's profile[/url] - she only touched code about 2 years ago. I think it's great that she picked it up so quick. I know that a lot of programmers start off at an early age, and I wonder if picking it up later in life is more challenging..
I was mighty taken with the graphics power of my friends Apple II, and was quite pleased when I got my spiffy new 386 (20mb HDD!!) when I was ~7. When I got it out of the box and turned it on, it booted to dosshell. I didn't know what to do from there, so I mashed keys until something happened... browsing c:dos I found gorillas.bas and thought gorillas sounded cool, so I ran that. That opened the qBasic (yay!) code to gorillas, and after I had played that I wondered what all the code stuff was.
I got hooked making silly little games so I saved my pocket money and bought Turbo Pascal (The doc from mission to mars said it was made in pascal!) and then onto Turbo C.
Since my pc wasn't capable of running any kind of windows or any drawing program, I drew things with code commands. That skill helped me make my first quake 1 map in notepad, and I started modding for quake 1. Since then I've sworn a solemn oath to waste my life making games. [:)]
Scott.
Yeh I used do play with code for my C64 when I was a kid, but I didn?t really start playing with code until I got a 486 when I was about 12. Found qbasic and started to make text based adventure games, then asci maze games.
Went through the languages, VB, turbo pascal, ?my hp calculator?, C?.
Then I found this wicked library for C called ?Allegro? and I used that to make heaps of dos games, it was a graphics + sound library that was designed to make indie games and that?s what I did for a long time. Until I tried to make a 3d game, in dos its not that easy, so I had to move to windows so I could play with opengl + directx.
I coded all the way through high school and ended up failing every subject because all I did was code and drink beer. But that?s good because now all I do is code and drink beer too, so I?ve had my priorities right for a long time.
I just feel sorry for the kids out there today, with these new windows machines that don?t come standard with a compiler of any kind, and no dos so they don?t have to play around with commands, what are the coders of the future going to turn out like?
quote:Originally posted by lava_monkey
I just feel sorry for the kids out there today, with these new windows machines that don?t come standard with a compiler of any kind, and no dos so they don?t have to play around with commands, what are the coders of the future going to turn out like?
HTML monkeys *snicker*
[;)]
I started learning how to program when I was in grade 9 at high school. Ever since then I just havent been able to get enough of it [:)]. I picked everything up fairly easily. Starting with C (because that's what my mate Ty knew), and then finding a really good C++ primer book.
Edit: I should note that I didn't learn AT school, just at that age [:)].
i did some pascal when i was in highschool, but i started *real* programming when i started my software engineering degree in uni. Uni has served me well, i'm in my final year now and do think i am a pretty competent programmer in most of the common languages (c/c++/java) and in the more obscure ones (prolog/haskell/mercury). I really got into games programming around the middle of last year when i did a subject on computer graphics theory.
I mainly started programming when i started my comp. sci. degree at uni in '99, although i did do very minimal QBASIC coding when i was in about yr7 and yr8 (about '93). I didn't really know what i wanted to do with my life until around last year or the year before (other than it would involve computers), so i wasn't hugely motivated about coding through uni. I enjoyed programming, but i didn't program anything i enjoyed (if that makes sense). Since i've gotten into programming for games, i've become a lot more motivated about it, and have pushed myself a lot more to learn things.
Thats me...
CYer, Blitz
I started programming QBASIC when I started high school, then next year I progressed to Visual Basic, then to C and Assembly in the next year then C++ etc... I learned Java in the first year of Uni, and then in the next year I've learnt some others like Miranda, Lisp, COBOL, SQL etc (now I am in third year of Uni). But the same as AndrewM I didn't learn them *at* school, just at the same time as school.
And now I mainly program in C++ / Assembly and Java for Uni, although it depends what subjects I am doing.
(Compressed version)
I started around grade 6 with Apple basic, then learnt GWBASIC on the 286, then QBasic, then a little bit of C (My dad bought me Microsoft Visual Studio 1.0!) couldn't hack win32, so then Visual Basic (around grade 9), then went back and learnt C++ in the latter half of year 12, in which I did very poorly (failed english, and lost first in IPT because I wasn't paying attention), as all I did was code my first game engine, which was lost due to a partition failing (actually was a good thing, early code is yucky).
That's all I can remember, and I'm not sure if the times are correct...
quote:Originally posted by Souri
On a side note, reading [url="www.sumea.com.au/sprofile.asp?member=70"]Jacana's profile[/url] - she only touched code about 2 years ago. I think it's great that she picked it up so quick.
Wow people do read that *grin*
I had a Tech Support job that I did for about 20 months. I started off doing phone support and just hated it. I was then moved to inhouse support which I liked better - but not enough.
In that 20 months I was thinking about what else I wanted to do. And my logic to get where I am went something like this: "Hey, I picked up HTML kinda quick. I don't see why programming could be much harder." Yes yes! Pick yourself up from the floor now and stop crying with laughter.
But really that was my logic at the time. So I quit work, took some time off, and started back to school.
While I was waiting to get into the Software Dev course I spent one semester doing an Electronics course. I got to learn all about components and even make my own circut board. That was fun :)
So after I got into the dev course at mid year intake I picked up the stuff quite well. So the next logic was: "Ok, I like programming. Now what do I want to program."
Its scary to think I am just hitting my two year mark for programmming. I started the software dev course around July 01.
Wish I could answer better on it being harder to do as you get older. But the way I have gone is the only way I know :) I think its working for me.
Man some of you have a way more illustrious history than me! I was first exposed to code at about the age of 6 or 7 maybe? Little bit of GW-Basic on a very old 286.
But really I was a weiner...I moved on to QBasic shortly after and stuffed around with that for a few years never actually making anything but my brother's primary school enivornment project where we made a game called "Environmental Apes" and it was the most pants-tastic game.
I have the code printed out somewhere in this house, but I'm ***not*** going to show anyone how crap that truly was.
Then I moved on to Visual Basic where I realised that it's only good for making (very slow) 'appz'. Eventually my brother grabbed C for Dummies and he learnt C without a compiler over a couple of weeks, then he programmed something in C, I looked at it, and that was basically my first lesson in 'C'.
We kept going with C (Borland C++ compiler) for a while, right up until about 5 years ago - we even made a DOS texture mapper which ran like garbage because Borland was a 16bit compiler with flaky 32 bit support. I learnt alot of assembly in my DOS programming forays - I find with Windows programming a *lot* of the overheads nowadays aren't really within the CPU as such - it's more about good algorithm design, also Windows compilers have become quite good. Then I played around with OGL and MSVC++ to make some crappy little graphics - not any games though. Lately I just toy around with DJGPP and trying to finish my DOS-based magnum opus, and then play with windows.
I've never really diced with Linux, but it looks like a bit of a mess :)
Overall - I've never really finished a single game (except for that Apes hack) and I'm hoping to change that by the end of this uni break...
To answer the whole "picking up programming later" issue - the best programmer I know picked up programming about 2 years ago. He's not much of a games programmer, really lacks the interest, but he's just insanely smart and constantly amazes me. I'm glad he's around because he's a good learning resource :) He teaches me a few things and I've been programming for a lot longer!
I actually still don't know much C++ except for some basics. We learnt Java at Uni (and I really passionately dislike it for games programming purposes) and I learnt some Pascal at one stage. But I wouldn't proclaim to be anything but a C/ASM programmer.
Hmm, first started with BASIC on the TRS-80 Colour Computer when I was.. ohh.. 9? I don't know why, I guess just because it was there. That got me interested. Got a C64 a few years later and because C64 BASIC was so horrifically limited I was forced to learn assembly to do anything fun. What a shame. [;)]
I started to write a lot of games on the '64, but never got very far with them. I later wished I'd heard of the demo scene at this time - if you're trying to write a game, and you get bored after just doing a 50fps parallax scroller, you got nothing. But if you're trying to write a demo, you got a routine!
Got an Amiga 500 when I was 17 (this was in 1991..) but didn't immediately start to program it. For a while there I was using the Amiga for BBSing and gaming and still coding on the '64. Finally bit the bullet, started to learn 68000 assembly and Amiga hardware, got into the demo scene, did stuff with Cydonia (hi Souri!).. I was active there for a few years but gradually lost interest as the Amiga died out..
From then on, it was nothing but boring corporate IT programming until last year, when I started doing some PS2 stuff (as well as PC/DirectX, Xbox & Gamecube) with Hemicube..
I was introduced to QBasic in high school about 6 years ago. I decided that I liked programming and wanted to learn more about it, so I managed to get my way in to a little-known computer course in the NSW curriculum (3 unit Computing Studies, my friend and I who did the course were the first and only two people to do it at our high school) where I learnt some basic computer science and was introduced to Visual Basic. I learnt pretty quickly that normal application programming is major boring shit, and also learnt to stay away from Visual Basic for games making purposes. For my assessment I wrote my first proper game in QBasic (which I later rewrote because the ASCII art annoyed me and I wanted to try out some proper graphics). Programming took a dive for me for the next few years, touched the basic stuff at TAFE and taught myself the basics of C. Finally got my act together and moved up to QLD in the dying months of 2001 to apply for the QANTM course I'd been wanting to do for a couple of years, got in first time on a scholarship, crammed an incredible amount of information in my head in a year, got a job, wrote out this brief history of when and why I started programming.
When:
1979 at Carringbush library (Richmond, Melbourne) after school - in basic... followed shortly by building my own Dream 6802 (which I still have!) It had a hex keypad and all programming was done in hex - you really learn a lot about computers when you program in hex :-)
Then I moved on to mark-sense cards when they got a computer at school, then a TI-99/4A, then PC's and Unix machines
Why:
It just seemed to be something I loved doing and I was good at, from the moment I first used a computer I was hooked. I wrote hundreds of programs that nobody ever saw - games/tools/graphics just for my own pleasure (got a few published in a book too)
I started back on the C64 when i was presented with some (photocopied) books on basic. I only really learned a handful of functions and wrote afew text based adventures, though since i didn't know how to read/write from disk i found myself running out of memory very quickly. I also made use of the C64's ellaborate charcter arrays that were printed on the side of the keys to make ascii art slide shows (animated :p)
It was in 1998 that i got my self a 'real' computer a pentium 200Mhz with 48mb ram during my first stint at TAFE doing the CertIII in IT. After discovering Quake2, i was totally amazed at the 3d world possibilities on a personal computer and when i first saw Half-Life i was hooked started mapping for it and while learning VB at TAFE i wrote my first released tool for half-life (PlayListEd).
My interest in games took up most of my time during the Tafe course and i finally got a portfolio together that was good enough to get me a scholarship at QANTM in 2002. There i learned C++, STL and DirectX and i have been programming games ever since. Why?, because i grew up on games and my curiosity as to how they are done never let go :)
heh, I was the calculator king in high-school, I built the link cable for my TI-83 and so I had all the games which got spread around. I also modded my calc, it has a built in little speaker :) Which isn't good when trying to play linked games :(
I also learnt some Z80 assembly too, Z80 is teh rox0r
lava_monkey: is it RPN?
My uncle programmed with punch cards when he was at uni, back in the 70' or something. He said it was a real bitch debugging...you had to line up for about an hour to get access to the machine, then if one of your cards was wrong, you had to fix it and line up all over again!
I did a tiny bit of programming in Hex at uni...programming (emulated)IC's for digital technology class or something :P
CYer, Blitz
quote:Originally posted by Souri
It's interesting to read how you all started out. Seems a lot of you had tried QBasic first. Zaph, you programmed in Hex? Holy crap! *waits for someone to chime in that they wrote programs in binary or on punch cards!*.. debugging must've been a bit of a challenge.
Yep - and I've still got the computer - I'll see if I can dig it up and post a picture to it - don't think it works any more though (too much dust and crap over the last 20 years)
I actually used punched-tape when doing Work Experience for GE back in '82 - and mark-sense cards at High School (never had to use punch-cards though)
I vaguely remember dabbling with C64 code way back, before I was old enough to know what I was doing, I do remember always wondering why the books had '10, 20, 30' instead of 1,2,3. Then about 4 years ago my friend started doing 'computer programming'. I thought that sounded fun (I was addicted to computers by then already), and left school and off I went. A few weeks in pascal, then I found C/C++ and I was smitten ;)
I've pretty much been at the compiler every day since then, after I plotted my first pixel the games just started rolling out, and here I am now about to finish my course and try and get into the industry.
yay!
Like a few other folks here, I was first turned on by those 30-games-in-one BASIC books for the C64. I was something like 7 at the time. Years later, once I was old enough to understand what a programming language was, I tried hacking around in GW-BASIC on my old 286.
A little time after that (about around 1993), I was introduced to Pascal, the demoscene, c/c++ and x86 assembler all within the span of about 2 years. I scrapped my old GW-BASIC programs an quickly evolved my style from crummy text-mode projects to c++ using assembler graphics routines in 256 colors. (which was almost a necessity to do anything since that 286 topped out at 12Mhz)
College opened my eyes to the internet, and what it was capapble of. So my horizons were further broadened by backend MUSH programming/hacking, HTML and Javascript. Going into the workforce during the dot-com boom thereafter granted me further skills with ASP, PHP, PL/SQL.. and throw in a little COM for futher measure.
I got into programming at first becuase of my love for videogames. That interest has expanded to include a genuine love of how systems are designed and implemented. I look at programming as a creative process, not merely a mathematical or engineering exercise; and so I consider myself an artist of sorts.
I love what I do.
I got my first computer when I was nearly 7, having seen some stuff running on the Microbees back in primary school and thinking "hmmmm.... that looks more interesting than the TV" (in glorious light-orange on dark-orange monochrome) :)
My first machine was a C16, I got it for christmas but then we couldn't find any games to play on it and didn't figure out how to load any of the ones that came with it. So eventually my parents took it back to the store (Grace Bros :) and got a C64 instead. Oyeah! I started programming on it soon after because it came with some books and I liked the idea of making my own games. I spent many afternoons of my childhood reading computer magazines and copying programs from them.
The C64 BASIC was pretty bad and I couldn't do much with it. I didn't have an assembler but found out about Simon's BASIC which r0x0red. That kept me happy until I got my Amiga in 1990. That was really cool - the graphics and sounds were awesome. I did a little AmigaBASIC but not much and spent alot of time just playing games until I got AMOS. The biggest thing I tried to code in that was an adventure game engine (I was in year 9 by then) inspired by the Sierra games like Leisure Suit Larry. I still have copies of all the old stuff on my HDD. By then I was also using a PC laptop in school (an 8088 with no hard disk and only battery-backed up himem as a sort of non-volatile RAM disk). I did a little GWBASIC but soon found my language of choice for the next few years - Turbo Pascal. Did a few little games in that, including a text mode space invaders.
Then I did Java and VB and the other languages they made us do at uni, liked Java and did that for awhile. Now I'm at the AIE and firmly settled on C++/DirectX for now.
Before AIE I was doing Ada at my old job.... but I'd rather forget that thanks :)
I started programming on an Apple ][+ with 48K RAM and a TAPE drive. I learned BASIC first but it wasn't good enough to write games, which was my main purpose to learn programming, so I turned to Assembly Language. I had to enter machine code (hex numbers) directly just like what Zaph did. In fact I wrote a mini Assembler myself in order to enter 6502 mnemonics later on. I did this kind of low level programming for few months before getting a disk drive and 16K RAM card and a real Assembler called Lisa. These days probably not too many people know how to use "debug" in a Windows' command prompt [;)]
It's really fascinating to look back the good old days and see how technology has advanced over the years.
Well, seeing that bunch of lads having started with a good old Commodore, here is my path...
Started with a C64 also, it was ... hmmmm ... Christmas 84 !!! What, 19 years ??? [:0]
Did a little bit of Basic (mostly poke and peek) when I was not playing (which was pretty rare). My biggest project was a very nice Sprite Editor [8D]. Played with 6502 assembler, but never did something of importance.
Then on the Amiga, only gaming, no programming.
At university, bought a 486 (awfully expensive) and learnt myself C and wrote a Tetris on DOS.
After that, I landed a programming job in the finance industry [V] and learnt C++. That was ten years ago and since I have developed on Solaris, then Mac and Windows for the last six years. Started a bit of Java as well. But because finance is so boring and it's impossible to switch to video game industry now, I started last year development in C/C++ (and maybe assembly soon) on the GBA. What a pleasure to write games (even small ones) !
Crystal Space, Cal3d, Open Dynamics Engine
Has anyone used any of these open source projects?
[url]http://crystal.sourceforge.net/[/url]
[url]http://cal3d.sourceforge.net/[/url]
[url]http://opende.sourceforge.net/[/url]
And for anyone at a game company, do you use any open source projects in commercial games? I think the game STALKER:Oblivion Lost uses an implementation of Open Dynamics Engine.
We currently use ODE for our physics at school...currently our physics is BROKEN and does NOT work!! But i don't think thats actually to do with ODE :)
I haven't worked with it much myself, but from my glancing experiences with it, it is quite good and accurate, the only major problem i've found with it is that it is a little to realistic for use with games. All collisions are completely elastic so if you run into a static object that can't move, you end up bouncing away, which isn't so good for a car crashing into a building. Basically this just means you have to do a little bit of extra funky stuff on top to try and dampen the reaction. Also, it does not offer dynamic collision detection (not sure if thats the correct phrase), by that i mean, it can't test if two objects will collide over a period of time, it can only test if two objects are currently colliding. I'm not sure if other physics engines offer this type of CD, but ODE doesn't. This has the unfortunate effect that for fast moving objects you need to do 10-20 physics updates per frame (at about 60fps) to avoid objects moving completely through each other and not registering a collision.
CYer, Blitz
Code Improvement Problem #1 : Virtual Task Manager
for those who don't know what this is read this thread : http://www.sumea.com.au/forum/topic.asp?TOPIC_ID=558
The code I have written is a virtual task manager, meaning that you can update the game in virtual time... which allows it to go in fast forward, or run ahead/behind to compensate for latency when doing client side predictions in network games.
here's the source,
www.members.optushome.com.au/hmmklord/code/taskmanager.zip
I apologize for all the extra code I had to throw in, but i don't want to have people needing to rewrite what i've already done just to get it to work.
To use the code in its current state, simply make an implementation of Task that sets the next update time, the (update delay time to something useful) and implements Update(TimeValue t).
Then add it (and many more tasks) to a TaskManager and tell it to update to a certain point in time (must be after the last time you updated it to, and always greater that 0).
note that this code is probaby visual c++ specific cause i'm using __int64's for time values. I also wrote in on vc7 so i don't know if its gonna work for vc6 or other compilers.
If you have troubles getting it to work (which is likely given i finished it at 3am this morning) just let me know.
I'm looking forward to alot of improvements... cause this took me a while to put together so i hope people actually take the time with this thing.
-- edit
What i forgot to mention is that this code, and any changes made in this minichalenge are free to use by anyone... the aim is to create a very nice peice of code that everyone can use. Its not a competition about ability (although its a good place to show you have it)
hi...
just so you know, i done the Cert. 4 in IT (Programming) course at TAFE last year (2003)...
i don't have any tutorials, but if you go to [url]http://www.cpp-home.com[/url] you could probably find heaps of good tutorials...
during my TAFE course I used the MinGW C++ compiler, which is also command line, and like you wanted something more visual...Bloodshed Dev C++ is free and is based on the MinGW compiler, download it here [url]http://www.bloodshed.net/devcpp.html[/url]
i think Visual C++ is what most commercial places use, you can pick up a copy of the latest version for about $200 i think...but don't quote me on it