About Game Development with particular focus on C#, Lua and procedural content generation.
Thursday, July 31, 2003
Tuesday, July 29, 2003
Well scrolling is in.
I don't really have a full understanding of why it works but it does.
Hopefully it works as I planned and I should didn't foresee that it needed to be implemented in the way it became implemeneted.
I intend to do a web based tutorial anyway where I'll clear all this up.
The only problem now is the actually scrolling is notically bumpy where before I just suspected.
I don't really have a full understanding of why it works but it does.
Hopefully it works as I planned and I should didn't foresee that it needed to be implemented in the way it became implemeneted.
I intend to do a web based tutorial anyway where I'll clear all this up.
The only problem now is the actually scrolling is notically bumpy where before I just suspected.
Friday, July 25, 2003
. . . Cleaned up my code a little. Bits really need moving, but I'm okay with it. I'm ready to move on to pixel by pixel movement and then getting an arbitary globe set up.
I drawn out my current stuff in UML.
I can come back to this stage and work it again.
Also started working on a small texture editing program, but I've done very little with it so far.
I drawn out my current stuff in UML.
I can come back to this stage and work it again.
Also started working on a small texture editing program, but I've done very little with it so far.
Wednesday, July 23, 2003
Wrapping works, you can now walk right around my world.
I suspect in some directions it may not be smooth (jumps a few tiles)
I believe this is because it is true for Right-directional wrapping. I'm not sure why
I'll have to have a closer check once I get a more detailed map.
So now what, I could do a number of things from here.
I think first I'll finish off the wrapping so it can handle any number of blocks.
Before that I'm going to clean up the code again. After that thats the end of this section!
Then animating, pixelXpixel movement or time.
Time seems the most likely but I think pixel by pixel movement will be independant of time anyhoo.
Anyway I'm happy with what I've got so far.
I suspect in some directions it may not be smooth (jumps a few tiles)
I believe this is because it is true for Right-directional wrapping. I'm not sure why
I'll have to have a closer check once I get a more detailed map.
So now what, I could do a number of things from here.
I think first I'll finish off the wrapping so it can handle any number of blocks.
Before that I'm going to clean up the code again. After that thats the end of this section!
Then animating, pixelXpixel movement or time.
Time seems the most likely but I think pixel by pixel movement will be independant of time anyhoo.
Anyway I'm happy with what I've got so far.
Tuesday, July 22, 2003
Wrapping is very close to completely working. All that needs doing is changing which block is the current "active" block
But it wraps round the corners fine at the moment, but if you walk more than a block + one screen size worth in any direction it will fail.
The block needs to be swapped out.
This shouldn't be too hard. Though it requires building up another datastructure
But it wraps round the corners fine at the moment, but if you walk more than a block + one screen size worth in any direction it will fail.
The block needs to be swapped out.
This shouldn't be too hard. Though it requires building up another datastructure
Monday, July 21, 2003
Sunday, July 20, 2003
Saturday, July 19, 2003
Tracked down the problem I was having.
Having not programming in a no-pointer language for a while it took my a while to find it and make the mistake in the first place.
I had my rectangles filling themselves from the same area of the same block.
They were therefore both pointing to tiles in the source block.
Unfortunaly in the tile data structure I placed a translation matrix :(
So each time the copy rect was called they changed the translation matrix.
So they were plotted in the same place every time.
This is unlikely to happen in the game but it could if I messed enough with the setup, its lucky I caught it now.
Shouldn't be too hard to fix now I've found it!
Having not programming in a no-pointer language for a while it took my a while to find it and make the mistake in the first place.
I had my rectangles filling themselves from the same area of the same block.
They were therefore both pointing to tiles in the source block.
Unfortunaly in the tile data structure I placed a translation matrix :(
So each time the copy rect was called they changed the translation matrix.
So they were plotted in the same place every time.
This is unlikely to happen in the game but it could if I messed enough with the setup, its lucky I caught it now.
Shouldn't be too hard to fix now I've found it!
Tuesday, July 15, 2003
I cleaned up as much of the code as I could.
Some of the public stuff needs hiding away a bit better.
I added code that stops overrunning the block data structure.
It also outputs to the console the amount of overlap.
Next I'll make it wrap back on itself. Once it is over 50% in a new block that will become the active block.
I'm only using one block at the moment, though my code should be general.
I fine that I have to include global coordinates ranging over all blocks also.
This is currently all in a little rough, but working.
Some of the public stuff needs hiding away a bit better.
I added code that stops overrunning the block data structure.
It also outputs to the console the amount of overlap.
Next I'll make it wrap back on itself. Once it is over 50% in a new block that will become the active block.
I'm only using one block at the moment, though my code should be general.
I fine that I have to include global coordinates ranging over all blocks also.
This is currently all in a little rough, but working.
Monday, July 14, 2003
Movements is in.
Finishing this 'stepping-stone', this has been the largest block and I had to clean errors from early blocks too!
Currently movement has no bounds checking, and I think the code could be cleaner.
But that ones done. The next step has to be a kind of cleansing and then adding in the wrapping code and introducing a global co-ordinate system.
Then I can move to a new chapter of stepping stones, that will probably be concerned with timing.
Finishing this 'stepping-stone', this has been the largest block and I had to clean errors from early blocks too!
Currently movement has no bounds checking, and I think the code could be cleaner.
But that ones done. The next step has to be a kind of cleansing and then adding in the wrapping code and introducing a global co-ordinate system.
Then I can move to a new chapter of stepping stones, that will probably be concerned with timing.
Finshed the last bit of my console program. It worked correctly. Its not effiecent as it could be, but its reasonably clear and correct.
I've hacked it into my old code and after chasing down a bug with the screen constructor not intiliazing the transform matrixes correctly it now all seems to work :o
So i need to clean up the code one again.
Then I need to introduce movement.
I really need to look up Assert implmentation in C# too. I know they're somewhere around.
I've hacked it into my old code and after chasing down a bug with the screen constructor not intiliazing the transform matrixes correctly it now all seems to work :o
So i need to clean up the code one again.
Then I need to introduce movement.
I really need to look up Assert implmentation in C# too. I know they're somewhere around.
Saturday, July 12, 2003
Friday, July 11, 2003
I've got some basic block structures in place.
These are the local maps, loaded as needed.
The user see a portion of the block.
The possiblity may occur where the user sees 4 different blocks at once on the screen.
Therefore I may pull sub rectangles from each block to create the entire user view.
This is done now and hopefully working. It proved rather challenging.
using modulus with blocks indexing from zero, confused me for a while but its not too bad now.
The next stage is getting a bit of movement.
Currently I'm not concerning myself with pixel by pixel movement but I believe I'll do it by writing outside the rectangle and allowing it to clip it.
First block by block movement. I don't know if I'll do any more tonight.
Still on the mouse chapter of my windows book, though quite near the end. The chapters are mammoth and there are nearly 20 of them :(
These are the local maps, loaded as needed.
The user see a portion of the block.
The possiblity may occur where the user sees 4 different blocks at once on the screen.
Therefore I may pull sub rectangles from each block to create the entire user view.
This is done now and hopefully working. It proved rather challenging.
using modulus with blocks indexing from zero, confused me for a while but its not too bad now.
The next stage is getting a bit of movement.
Currently I'm not concerning myself with pixel by pixel movement but I believe I'll do it by writing outside the rectangle and allowing it to clip it.
First block by block movement. I don't know if I'll do any more tonight.
Still on the mouse chapter of my windows book, though quite near the end. The chapters are mammoth and there are nearly 20 of them :(
Thursday, July 10, 2003
I've done another two tasks. I've cleaned up my code a little. Created a rudimentary texture manager that I'll probably rewrite.
First I created a bit of a tile class and then got some setup and blit like loops up.
So I can fill the screen area perfectly with tiles.
I need to define a block (which will be larger than the screen area) and then use this to scroll through the map.
This means overwritting the keyboard codes.
I msy decide how to do all this :)
First I created a bit of a tile class and then got some setup and blit like loops up.
So I can fill the screen area perfectly with tiles.
I need to define a block (which will be larger than the screen area) and then use this to scroll through the map.
This means overwritting the keyboard codes.
I msy decide how to do all this :)
Tuesday, July 08, 2003
I done my little set of tasks.
Its all very simple.
I found jupming in and trying to build something big, was not working for me at all.
My program can load D3D into a window or into fullscreen - for some reason the sprites are not shown in full screen. I suspect I might see them if I scrolled my screen up with the controls. I'll leave this until I've done some big tiling.
First program puts a tile at the correct place in the top left hand corner of the window. Textured from a 256x256 bitmap taking out a 32x32 chunk, to coloured the tile grass.
Then the second program used the same vertex buffer but changed the texture and put that next to it.
So I now have a nice piece of grass followed by a gray tile that looks nothing like a road.
Unfortunately to do this I have to lock and unlock the vertex buffer. I hear this is expensive but unless I'm missing some command I don't know how else to do it. Unless I have different vertex buffers for models that share everything bar UV co-ords.
Its all very simple.
I found jupming in and trying to build something big, was not working for me at all.
My program can load D3D into a window or into fullscreen - for some reason the sprites are not shown in full screen. I suspect I might see them if I scrolled my screen up with the controls. I'll leave this until I've done some big tiling.
First program puts a tile at the correct place in the top left hand corner of the window. Textured from a 256x256 bitmap taking out a 32x32 chunk, to coloured the tile grass.
Then the second program used the same vertex buffer but changed the texture and put that next to it.
So I now have a nice piece of grass followed by a gray tile that looks nothing like a road.
Unfortunately to do this I have to lock and unlock the vertex buffer. I hear this is expensive but unless I'm missing some command I don't know how else to do it. Unless I have different vertex buffers for models that share everything bar UV co-ords.
Monday, July 07, 2003
I've done oh so little today.
Tommorrow I'm going to create a few small programs for DX, like I have been doing for Windows Programming and its various sprawling libraries.
For now I intend to finish the chapter on advance texturing.
Tommorrow I'm going to create a few small programs for DX, like I have been doing for Windows Programming and its various sprawling libraries.
For now I intend to finish the chapter on advance texturing.
Device->SetStreamSource(ModelBuffer);
Device->SetFVF(ModelFVF);Device->SetIndices(ModelIndices);
for(int i=0;i < NumMatrices; i++)
{
SetMatrix(ModelMatrix);
Device->DrawIndexedPrimitive(TRIANGLELIST);
}
Saturday, July 05, 2003
Yesterday learnt about scale, point sizes and transformations to the Graphics Device. You can do world transforms using matrices. So you can have a window with text on one side and the like. Also learnt about advanced texturing ... didn't finish though.
I need to get some small projects finished to make sure I can apply some of the theory I've learnt.
I need to get some small projects finished to make sure I can apply some of the theory I've learnt.
Wednesday, July 02, 2003
Yesterday learnt a little more of the GDI+, drawing lines from points and arrays of points, drawing ellipses using drawing lines and drawing ellipses which uses a rectangle. Drawing arcs and pies. That kind of things doing little programs as I went. Also went through Lights in my D3D book. Good but I need to apply it :).
Most cards support only eight lights at once! I guess if you had a level, you turn some off and on, reposition them as you go so it appears there are more lights than there are.
Most cards support only eight lights at once! I guess if you had a level, you turn some off and on, reposition them as you go so it appears there are more lights than there are.
Tuesday, July 01, 2003
Big rant.
Or I had a go at hacking together my engine without really knowing enough and I got a bit stuck
Currently at an impasse. I need to organize my thoughts and the best way to do this, I find, is to write a long
rambling text that expresses them.
The issue is that of the tile scrolling and the camera moving.
The 3D realm provides me with new options compared to the previous 2D one.
Roughly the map is made from tiles. Each tile is a textured quad.
These tiles are placed upon the screen according to some data structure portaining to be the map.
Once placed we wish to move about this map that may be bigger than we can see.
But we don't want the clunky jumping movements of an entire tiles width or height at a time.
Instead we wish the map to scroll pixel by pixel.
The Way I Was Going To Do This
------------------------------
Each tile has no idea of its position in the world. Its not ever going to move, it need not know about its realtion
to the world at large. The map data structure takes care of this it knows where all the tiles go.
The map looks at its matrix, and says tile (0,0) you shall be plotted at the top left hand corner of the screen, and
all shall be good. Tile (1,0) you shall be plotted a the top of the screen 32 pixels from the first tile along.
In this way the map would blit all tiles to the screen.
Lets say our world is big, its made up of several maps in a meta matric structure.
A matrix of maps is the world, a matrix of tiles a map.
So we're in the corner of one map, we might be able to see into three other maps!
Therefore the screen needs to be built with chunks of tiles from each of these four (altogether) maps!
Therefore we would need a function
plotMapPartial(x,y, map, tile_x, tile_y);
This way we can plot any parts of a map we might wish to any area of the screen. This is a potentionlly complicated
function.
So what are we doing here - we have a fixed camera looking at the tiles.
Every frame we use immense computer speed to rearrange these tiles.
Maybe we move them all over to the right and introduce some new ones in the left hand column.
We can do this copmuters are zippy fast.
Then when the next frame appears on the screen - blammo - it appears we moved to the left.
UpSides: Pixel by Pixel Scrolling, Several Maps on Screen at once, Potentially unlimited world area
DownSides: Functions are on the complicated side
The Second Path
---------------
DirectX3D throws you into a world that already has some sublayer.
It knows there is an origin a (0,0,0).
All models are plotted according to this origin.
A sqaure will have some (x,y,z) that is its distance from the origin.
So we have these lines spreading to a tricorner of infinifty.
The world is plotted out, you can go some where in it and say "Here I am at (9,2,1)"
The key change that could be made here is we move the camera instead of the world.
Before we have a (0,0) and as we moved across we would slowly move new tiles into old tiles positions.
If we moved far enough in one direction (0,0) would eventually be replaced.
Instead we give each tile its own sense of place in the world at large.
Tile (0,0,0) is tile (0,0,0) no amount of moving about on the map is every going to change that
As we scroll the camera across the world we might move into an area dictated by a new map
say (10, 10, 0) we can see three new maps again but they don't need to replace any old tiles
They exits in the teens (11, 10, 0) and so forth.
The wrapping around the world problem! This is indeed a problem.
The only solution I can think of is a bodge, when we get to tile were there is no tile
we just load in the first map again.
So the to do list:
Decide tile sizes 32x32
Texture size will be 256 x 256
Chars will be a little skinnier 32X64 probably.
Done that.
Now assign texture co-ords
... an hour or two later
Okay that doesn't seem to work. What are my problems?
-My main render loop ends
-When I take a single interation out it runs okay
.. I don't see it on screen (see later point)
-Seems to hang on trnasforming co-ordinates, I could be doing this incorrently
Second
The map isn't as simple as I thought with global co-ords
(0,0,0) is center of the screen. To do the upper left hand corner I need negatives
This makes generating my tile coordinates not very easy.
I don't really now how to plot out a level - i.e. I need to learn more
Or I had a go at hacking together my engine without really knowing enough and I got a bit stuck
Currently at an impasse. I need to organize my thoughts and the best way to do this, I find, is to write a long
rambling text that expresses them.
The issue is that of the tile scrolling and the camera moving.
The 3D realm provides me with new options compared to the previous 2D one.
Roughly the map is made from tiles. Each tile is a textured quad.
These tiles are placed upon the screen according to some data structure portaining to be the map.
Once placed we wish to move about this map that may be bigger than we can see.
But we don't want the clunky jumping movements of an entire tiles width or height at a time.
Instead we wish the map to scroll pixel by pixel.
The Way I Was Going To Do This
------------------------------
Each tile has no idea of its position in the world. Its not ever going to move, it need not know about its realtion
to the world at large. The map data structure takes care of this it knows where all the tiles go.
The map looks at its matrix, and says tile (0,0) you shall be plotted at the top left hand corner of the screen, and
all shall be good. Tile (1,0) you shall be plotted a the top of the screen 32 pixels from the first tile along.
In this way the map would blit all tiles to the screen.
Lets say our world is big, its made up of several maps in a meta matric structure.
A matrix of maps is the world, a matrix of tiles a map.
So we're in the corner of one map, we might be able to see into three other maps!
Therefore the screen needs to be built with chunks of tiles from each of these four (altogether) maps!
Therefore we would need a function
plotMapPartial(x,y, map, tile_x, tile_y);
This way we can plot any parts of a map we might wish to any area of the screen. This is a potentionlly complicated
function.
So what are we doing here - we have a fixed camera looking at the tiles.
Every frame we use immense computer speed to rearrange these tiles.
Maybe we move them all over to the right and introduce some new ones in the left hand column.
We can do this copmuters are zippy fast.
Then when the next frame appears on the screen - blammo - it appears we moved to the left.
UpSides: Pixel by Pixel Scrolling, Several Maps on Screen at once, Potentially unlimited world area
DownSides: Functions are on the complicated side
The Second Path
---------------
DirectX3D throws you into a world that already has some sublayer.
It knows there is an origin a (0,0,0).
All models are plotted according to this origin.
A sqaure will have some (x,y,z) that is its distance from the origin.
So we have these lines spreading to a tricorner of infinifty.
The world is plotted out, you can go some where in it and say "Here I am at (9,2,1)"
The key change that could be made here is we move the camera instead of the world.
Before we have a (0,0) and as we moved across we would slowly move new tiles into old tiles positions.
If we moved far enough in one direction (0,0) would eventually be replaced.
Instead we give each tile its own sense of place in the world at large.
Tile (0,0,0) is tile (0,0,0) no amount of moving about on the map is every going to change that
As we scroll the camera across the world we might move into an area dictated by a new map
say (10, 10, 0) we can see three new maps again but they don't need to replace any old tiles
They exits in the teens (11, 10, 0) and so forth.
The wrapping around the world problem! This is indeed a problem.
The only solution I can think of is a bodge, when we get to tile were there is no tile
we just load in the first map again.
So the to do list:
Decide tile sizes 32x32
Texture size will be 256 x 256
Chars will be a little skinnier 32X64 probably.
Done that.
Now assign texture co-ords
... an hour or two later
Okay that doesn't seem to work. What are my problems?
-My main render loop ends
-When I take a single interation out it runs okay
.. I don't see it on screen (see later point)
-Seems to hang on trnasforming co-ordinates, I could be doing this incorrently
Second
The map isn't as simple as I thought with global co-ords
(0,0,0) is center of the screen. To do the upper left hand corner I need negatives
This makes generating my tile coordinates not very easy.
I don't really now how to plot out a level - i.e. I need to learn more
Subscribe to:
Posts (Atom)