« first day (480 days earlier)      last day (3012 days later) » 

1:06 AM
so, did you fix it?
bugs in physics are awsoem
MindWorX did you play Flashback?
3 hours later…
4:32 AM
@PabloAriel, Just got back, ready to start fixing it now. :) And no, I've never played Flashback.
13 hours later…
5:06 PM
You around @Jimmy?
cool, there is a chat, what do people talk about here? is it also like Q&A?
Nah, this is for random chatter
Good place for things that doesn't fit on the site itself.
@fiftyeight There is some Q&A here, but for the most part it's more of a community hall.
Often, if you have a question, the response in this chat will be "That would be a good question to post to the site."
5:10 PM
OK good to know
I'm actually searching for some open-source game to look at, something with clean code
but there's a question for that I found
But it seems most answers aren't realy from experience, but I hope I'll get lucky and find something good
i remember that question. unfortunately, there's not many open source games (that are anywhere near "finished", at least), and most of the ones that exist have somewhat messy code
most ludumdare.com games have the source released, and a few people have posted the libraries they've used/written over the years.
the games were all written in 48 hours, though, so the code almost always has some hacks or general messy-ness
Yeah the main problem is the messy code
Thanx though
good luck. is there any specific type of game you're looking for the source code for?
A simple 2d game, I mainly want to look at the game loop, the draw function, and the user input handling
Mainly I want to learn the best practices
I got most of the logic in my head, but I'd like to go through the code for a basic simple game that hopefuly uses the best practices or something close
Is there any ways to view a .fla file without having to install the flash developer tools?
@fiftyeight, I used to do that. But after a while, you realize there is rarely best practices when it comes to game development. It's a lot of tinkering, to get the feel you want. And most of what you do, even if you find best practices, will have to be adapted to work with the rest of your code.
5:25 PM
@fiftyeight There's an article that gives a pretty good overview of various game loop concepts: gafferongames.com/game-physics/fix-your-timestep
@fiftyeight ah. I'd almost suggest checking out gamedev tutorials, then, since most game code is large and kind of confusing. and as MindWorx said, "best practices" doesn't really exist in gamedev....
OK thank you very much, I'll read the tutorial
Since you seem very nice, I'll try to ask some basic questions in hope that you'll want to answer :)
In 2d games, on the lowest level, like what the libraries do, are all the pixels sent one-by-one to the monitor?
Like, are there functions to set one pixel on the screen to a certain color?
That's something the GPU handles.
that's usually handled by the display drivers these days.
5:32 PM
Even in 2d? like you send the whole bitmap to the display drivers?
instead of each pixel? like you send a pointer to the bitmap or something like that?
each command to the display device takes time
if you had to send millions of separate commands, it would be too slow
@Jimmy, I had an idea. We discussed modding for my game, where I said that I didn't like the idea of modding tiles, since I'd like Grass to be and do the same always. But how about I add the option, for servers/mods to utilize 32 of the tile indexes for custom tile types? This way I have plenty of room for the built-in tiles, and modders can add some too.
It's kind of a meet-you-half-way solution.
well, these days, there's a few layers between you sending a bitmap to a function and the display driver handling that bitmap and the driver putting those pixels onto the screen
OK thanx, so what are the most basic commands that are usually sent in 2d games to the display drivers?
@MindWorX: I'm not sure if it's completely necessary - you might want those 32 extra types to be available for your own updates or expansion packs etc.
5:34 PM
And is it done with a specific system call?
@fiftyeight that usually depends on the library you're using for graphics.
at this point, the only time you'd interact directly with the display driver code would be if you were writing a game in pure DOS or something
Say I'm not using a library, like on the most basic level how do things work, on Linux for instance or some other OS you know best
Yeah I'm mainly trying to understand how things work
@Jimmy, Well, I have 256 indexes, 0 is locked to the Void type, to always know what's in an uninitialized array. That leaves 255 types. 32 for modding, leaves 223 indexes for builtin types. Terraria does very well and only have like 28 types currently.
@MindWorX yeah I don't see a problem with that. does that mean that your tile methods have to be virtual?
@fiftyeight if you really want, look at the code for a graphics library to see how it's done (i'd suggest SDL or OpenGL, since both of those should be somewhat open source in terms of graphics output)
5:38 PM
well I guess it depends on how you have your current tile behavior set up
@fiftyeight they all use system specific calls, but exactly what those calls are, I really don't know.
OK Thank you so much
Well, currently, only few tiles has any need for methods. I was thinking of a OnAdd/OnRemoved kinda deal, and then the tile could opt in for different events, like if they want to do something every second, they can subscribe to that event. The the tile data is static right now, and I only have grass which needs a periodic check to see if it needs to spread to the tiles around it.
Next question :)
User input - does it also work on a low level by attaching a handler to something
like, on the lowest level, you make a system call and give it a pointer to a function or something?
@fiftyeight how much do you know about operating system design?
5:42 PM
I think I have a pretty good understanding, with some holes though
But talk away, if I don't understand something at least I'll have the term and I can read about it in Wikipedia or something
@fiftyeight Congratulations on actually wanting to learn this stuff. So many people don't care enough--they just want their ideas to magically materialize on-screen.
Thanx, I really find that I do things best when I understand why they work
I'm still waiting for my game to materialize. :(
well, most input these days are handled with events. if you're interested in how user input works on a lower level, look up event queues and such
On windows you can look at Direct Input and how WndProc handles input messages.
5:48 PM
OK thanx, I'm looking into it
Thanx a lot for the help thedaian
I appreciate it
What kind of platform are you considering? You're asking a lot of lowlevel things, which isn't really important when getting started with game development.
@fiftyeight: at some low level, the graphics hardware has some portion of the virtual memory space allocated to it. part of this is the frame buffer, which is about as low-level a representation of what is on the screen as you can get.
In linux, I believe you can write directly to the frame buffer.
OK Thanx
Right now I want to make some simple games for PC
Like 2d stuff
Do you know the game star control 2?
I really like it, so maybe do something similiar to that
Personally, there's nothing wrong with wanting to know low level stuff, but very few games interact at that low of a level these days, so unless you want to write drivers, operating systems, or libraries, there's not much need to learn that sort of thing.
on modern systems, the GPU handles rendering slightly higher-level commands to the frame-buffer, including rasterizing 3D shapes or blending 2D images.
5:52 PM
@fiftyeight there's an open source port of Star Control 2: sc2.sourceforge.net
Yeah I know :) Thanx
low-level programming APIs like OpenGL and DirectX handle sending individual commands like drawing images or triangles to the GPU
I don't know how clean the code is, but I'll check it out for sure
Yeah I saw an OpenGL tutorial, but it was mostly about 3d, from what I understand these days most graphic cards have native support for 3d
it's a pretty mature open source game, so it's probably about as "clean" as you're going to get.
That'll be great, I hope you're right :)
OK, sounds like the GPU does just about everything
Don't computers work fine without a GPU though?
5:55 PM
I don't think you can get a computer without a GPU.
I mean without a graphics card
well, the fundamental abstraction here is the frame buffer. Write a byte to the frame buffer, change a pixel on the screen.
They work, but most onboard GPUs tend to be slow.
almost every system has some hardware acceleration though.
OK, I'll read about the frame buffer too
5:55 PM
all computers have a graphics card these days.
OK, so if I take out the graphics card, the computer won't work at all?
some of them have built in graphics cards that don't do much beyond the very basic stuff
it can't display anything?
K thanx for clearing that out
5:57 PM
older computers (from say, 1995 or earlier) had something different in place of a "true" graphics card
@fiftyeight: if your motherboard has a display port, it probably has a graphics chip onboard.
but they still had something that took commands from the CPU and converted them into graphics
@fiftyeight: if you're mostly doing 2D, you might find SDL/SFML/Allegro tutorials more accessible
prior to that, you had flashing lights and a printer
Thanx Jimmy
OK I understand
But even libraries like OpenGL, they can't communicate directly with the graphics card right?
they just send comannds to the CPU and it passes them to the graphics card
5:59 PM
OpenGL is actually implemented by the graphics card driver.
OpenGL exposes things like "CreateBuffer" or "WriteVertex" and translates it into bytes which the CPU sends to the graphics card.
in order to be effective, both OpenGL and DirectX have commands that are batched, so the CPU could send, say, 400000 data points to the GPU, and tell it to store that in a buffer on the GPU end. And then later, it can tell it to just render the command in buffer 10 or something. So you don't have to repeatedly send large quantities of data across.
Great information, thank you
actually command usually follow this path : "program->graphics SDK->(OpenGL||DirectX)->graphics driver->cpu->gpu"
and after that it's directly sent to monitor
K thanx, I'll go reaad some more on "event queue" and "frame buffer", and then check SDL/SFML/Allegro - I'll check each one and decide which to learn first,
Really, if you just want to write games, then learning the code used in graphics drivers or researching WinProc events is like a someone who wants to be a writer spending time learning how the english alphabet evolved through the thousands of years. yeah, it's nice to know this stuff, but none of it's actually going to apply to "how to write a book/game"
Yeah I won't spend too much time on it, but I'll read a bit, I enjoy knowing that stuff anyway
6:08 PM
If you actually want to make a game, pick a target platform/audience, pick a language/library to work in, and start making a game.
Yeah I know i want to make a 2d game right now, so I'll check SDL/SFML/Allegro, I'll read about each one and I'll try to decide which one to use
Thanx for the tips
You've really helped me, really, all of you
Good luck.
Also, the most crucial, start small.
yes, please do not start off making the next best MMO ever.
I can't count the amount of times I've seen new people decide they want to make an MMO as their first project.
Hah, lovely Jimmy. :P
6:13 PM
I'm trying to discourage competition ;)
I won't try and make an MMO right now don't worry
But I did ask some questions about MMOs, since I'm interested in how they work
just re-create star control 2, right? :P
(please don't ask about networking layers... i've tried to forget that stuff :P )
I've finished my questuon for now don't worry
Jimmy you're making an MMO? good luck
seems you have bad memories of network programing @ohio!
6:16 PM
If your game is open to modding, you don't have responsibility for what users make for your game right?
I remember my first SDL project. it was a 800x600 window with a single graphic as the background, and a train track in the middle. the entire thing was a program where you could hold down the "right" arrow key to move a train along the track
@MindWorX from what I know.... the answer is yes and no
@Ohio, Very helpful. :P
might be worth figuring out the result of the Marvel vs City of Heroes lawsuit
@Gajet Mostly just bad memories of tests and having to memorize the 7 networking layers
I'm not sure if you count snake as a first game or not, but it was almost the first game I've ever made! and It was built using turbo pascal! though I Had implemented level editor! and nice graphics for my game
every thing was design pixel by pixel with another program I've developed myself!
Horrible packet loss though.
6:21 PM
And who in their right mind would call 3G fast?!
people who are on dialup?
Poor those people.
6:58 PM
If I look at the source code of star control 2, does it matter that it was written like 20 years ago? are there stuff that might be irrelevant today?
stuff written back then might not have been written for readability.
OK, except for being unreadable
they might be using optimizations that don't matter as much these days
OK but the logic was always the same, like game loop, user input, drawing functions
I can't say, I haven't looked at the source code.
one problem older games had was that they'd not bother with timing
7:03 PM
as far as i know, the actual source code for star control 2 isn't public
they'd just run as fast as possible because the hardware only ran that fast
so if you'd run them today they'll run super-fast?
@thedaian what do you mean? what is public than?
hence the turbo button on Pentium computers -- the function of the turbo button was it defaulted to "on", you turned if off if some program was running too fast
7:04 PM
ahh, nevermind, turns out the 3DO port source was released
a standard modern game loop is a bit involved, especially if you're doing physics simulations that are sensitive to time-step.
OK, I mostly meant that
if that some game was made today would it be different than how it was made than
in terms of logic
Thanx someone actually sent me this tutorial eariler
I think it was thedaian
probably a famous tutorial
yeah, it's a pretty popular article on the pitfalls of various time-stepping strategies
7:07 PM
Wasn't the source for Doom 3 just released?
@fiftyeight there would be differences, but most games all have a input, update, render loop. even stuff that was written 20 years ago. the only real difference is going to be fairly minor, i think
Dunno if it's readable, but that's a AAA game with source, where you see what they do.
OK thanx
it's worth pointing out that Ur-Quan Masters is NOT the exact same code as the originally released source for Star Control 2
so there's probably been some updates to everything since then
Ok that's good :)
7:34 PM
Looks like there is going to be some sort of programming test wall to get tickets for next year's Google I/O :D
Interesting. :P
write "fizzbuzz"
7:54 PM
why didn't he interpolate using this algorithm?
double t = 0.0;
const double dt = 0.01;

double currentTime = hires_time_in_seconds();
double accumulator = 0.0;

State previous;
State current;

while ( !quit )
double newTime = time();
double frameTime = newTime - currentTime;
if ( frameTime > 0.25 )
frameTime = 0.25; // note: max frame time to avoid spiral of death
currentTime = newTime;

accumulator += frameTime;

while ( accumulator >= dt )
previousState = currentState;
integrate( currentState, t, dt );
t += dt;
accumulator -= dt;
//const double alpha = accumulator / dt;

//State state = currentState*alpha + previousState * ( 1.0 - alpha );
integrate (perviousState, t, accumulator);

render( state );
sorry it's split into two parts
8:24 PM
I should've totally done visual debugging a long time ago.
It showed my weird collision bug right away.
I forgot to factor in the width of tiles when I calculated their bounding box.
Which is why I had to do weird things to make it work properly.
Black is centertile, used to determine gravity.
White is the active area for effects and triggering.
Green/Red is the bounding box, green when free, red when solid.
mmm, fun
it works now, though, right?
Nah, no collision response yet. But now I'm 100% positive that I'm at least selecting the right tiles, in both positive and negative world space.
With a few helper functions, like GetTileRegion and GetTileInfo which has a few extra things to make them more useful.
well, that's good
@Gajet: because the point is to integrate only on a fixed timestep (i.e. 60 fps or something)
you took out the interpolation and added a variable-width timestep
which is what he does halfway up in the "semi-fixed timestep" example
I'm doing only using that last integrate for rendering purpose, whole phisics simulation is still running using only fixed timestep
8:39 PM
well, the problem Glenn is describing
is that if you don't use the same timesteps
seems I made a mistake in that code, last line should be render(previousState)
your simulations starts experiencing rounding errors
oh i see
I'm still using two different states as Glenn did. the only thing change is interpolation system.
well, it is pretty close then
you do a "fake" update that doesn't update the real state
but it gives data to the render()
and it handles the fractional delta-time.
it will result in more accurate renders than linear interpolating, but It may consume more processing power that Glenn's method.
mine will also consume less memory, though Glenn could fix memory problem easily.
8:43 PM
hmmm maybe part of the problem is its not always possible to write a undo-able update() function.
my updates() for example are generator functions so they are hard to unwind.
update doesn't need to be undo-able, i'm not undoing it in the next step. I just create a copy, move that copy ahead in time, render it and then destroy it in the end. for the next simulation cycle again start with the original game state.
seems to me that creating copies of the game state is... kind of a bad idea.
especially if you just end up deleting it
that's exactly what Glenn is doing, GLenn also creates a copy and then change that copy using linear interpolation. it's well documented why he had to do such a thing to synchronize multiple simulations. but also have a clean rendering system
8:59 PM
ok, i got confused by the word State.
ignore what i said
yes, we're not cloning all of Ohio.
see, that would be a bad idea
9:13 PM
this is a pretty nice article about game development and project management: lazyfoo.net/games/nerdgirlsthegame/index.php though a lot of it repeats things that have been said elsewhere.
just skimmed it
seems pretty good advice in general
especially for setting expectations
the entire summary is basically "this stuff is hard"
and "your project is about halfway there when you think it's 90% done"
9:52 PM
Why is it most AABB implementations I see use HalfWidths and a center origin point rather than normal top left origin and normal widths.
@MindWorX I'm assuming it's more useful when calculating absolute distances. You don't have to have different logic if X or Y is negative, e.g.
@mindy I guess it's basically because it's more convenient to use center of mass, for physical calculations. and using center of mass means center origin point, which result in HalfWidth collision checking
Valid points.
You both get one cookie.
To share.
10:07 PM
You don't want to fight? :(
I'm a coder, not a fighter.
Code a bot that'll fight for you! :D
Hm. This is an interesting suggestion. Reminds me of aichallenge.org
I love that AI is getting more and more focus.
2 hours later…
11:52 PM
My code smells, and I can't clean it.
But it works in negative space now.
Which is what was important.

« first day (480 days earlier)      last day (3012 days later) »