|
3 registered members (AndrewAMD, Grant, Neb),
908
guests, and 6
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
2D Tile Based Engine with 3DGS
#239110
12/02/08 18:47
12/02/08 18:47
|
Joined: Apr 2008
Posts: 144 Germany | Niedersachsen (Lower...
Roxas
OP
Member
|
OP
Member
Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
|
hey people! I want to know If it is possible to create a "simple" tile based 2D Game engine with lite-c / 3dgs. I tried to convert the code of the isometric tile based tutorial from the acknex site for my purposes. But it didn't work at all. I searched on google for a solution and how to make a tile based handling. the most things i've found were dealing with something like this. private static int[,] tilemap = new int[map_hoehe, map_breite]
{
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 1 },
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1 },
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1 },
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 3, 0, 0, 0, 0, 0, 0, 1 },
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1 },
{ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1 },
{ 1, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1 },
{ 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }
}; every number stands for a certain tile that could be found on a tileset image and then shown on the screen. is it possible to realise something like this with lite-c? Roxas.
|
|
|
Re: 2D Tile Based Engine with 3DGS
[Re: Roxas]
#239113
12/02/08 18:57
12/02/08 18:57
|
Joined: Oct 2007
Posts: 5,209 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
|
possibilites of lite-c is limited by your imagination(and skills maybe, and ....)
yes, that is possible.
(and we have a ISOMETRIC porjection mode for views now :D)
3333333333
|
|
|
Re: 2D Tile Based Engine with 3DGS
[Re: Roxas]
#239117
12/02/08 19:15
12/02/08 19:15
|
Joined: Jul 2005
Posts: 1,930 Austria
Dark_samurai
Serious User
|
Serious User
Joined: Jul 2005
Posts: 1,930
Austria
|
Create panels for each number (pan_create()). If you want to move the map, you need to move all panels.
ANet - A stable and secure network plugin with multi-zone, unlimited players, voip, server-list features,... (for A7/A8)! get free version
|
|
|
Re: 2D Tile Based Engine with 3DGS
[Re: Quad]
#239118
12/02/08 19:15
12/02/08 19:15
|
Joined: Oct 2004
Posts: 4,134 Netherlands
Joozey
Expert
|
Expert
Joined: Oct 2004
Posts: 4,134
Netherlands
|
Most certainly possible. Although most not tilebased, nearly all of my games are 2D. I fully support your research in this area of 3dgs  . What I would do, but this comes on the fly from my head: - Map a tileset with each tile a number according to it's position in the bitmap - Cut each tile into a separate BMAP* using bmap_blit, and assign it's number - Create a virtual grit, and show the tiles on this grit within the screen position according to the map numbers. However, if you think this is hard to realise, try something smaller first. Get experience with panels by starting with simple, non tilebased 2d games. Use structures in combination with bitmaps, and find the right methods to handle them.
Click and join the 3dgs irc community! Room: #3dgs
|
|
|
Re: 2D Tile Based Engine with 3DGS
[Re: Joozey]
#239142
12/02/08 21:42
12/02/08 21:42
|
Joined: Oct 2007
Posts: 5,209 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,209
İstanbul, Turkey
|
yeah, using sprites is a better idea than panels, imo.
3333333333
|
|
|
Re: 2D Tile Based Engine with 3DGS
[Re: Quad]
#239156
12/02/08 22:52
12/02/08 22:52
|
Joined: Mar 2008
Posts: 2,247 Baden Württemberg, Germany
Espér
Expert
|
Expert
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
|
hmm.. i think you should take a look in the Rpg-maker XP Tilemap Scripts. RGSS isn´t far away from lite-c, and should be not as difficult to convert than rewrite an isometric mode script.
@all: Panels?? And how to do collision??
Last edited by xXReapeRXx; 12/02/08 22:53.
|
|
|
Re: 2D Tile Based Engine with 3DGS
[Re: Roxas]
#239220
12/03/08 12:08
12/03/08 12:08
|
Joined: Apr 2008
Posts: 144 Germany | Niedersachsen (Lower...
Roxas
OP
Member
|
OP
Member
Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
|
I think I start to realise that my abilites are high limited. Don't know where to start at all and how to code an engine like this in lite-c. because there's no command in lite-c which lets you create something like this 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, stuff. I started with something like this. BMAP* black = "black.png";
BMAP* tileset = "tileset.png";
var tilemap_x = 3;
var tilemap_y = 3;
var tilesize = 32;
var tile_content[9];
var tile_posx = 0;
var tile_posy = 0;
var tile_posx_src = 0;
var tile_posy_src = 0;
PANEL* background = // the bitmap where the map should be drawn on...
{
bmap = black;
layer = 0;
pos_x = 0;
pos_y = 0;
flags = VISIBLE;
}
function mapping()
{
var counter = 0;
while(tile_content[counter] < (tilemap_x * tilemap_y)
{
// One If function like this for every tile...(I'll post just one to show what i did so far, but i got 4 of them)
if(tile_content[counter] == 1) // for example 1 = a ground tile
{
// show the tile on Tile01 in the map
tile_pos_xsrc = 0;
bmap_blitpart(black, tileset,
vector(tile_posx,tile_posy,0),
vector(tilesize,tilesize,0),
vector(tile_posx_src,tile_posy_src,0),
vector(tilesize,tilesize,0));
}
counter += 1;
// a function that handle's the "tilesteps"
// (mainly its "tile_posx += tile_size")
tile_posx += tile_size; // for testing purposes only
// a function that handle's the "rowbreaks" (its supposed to be 3*3 not 9
// tiles in a row.)
// no idea.
wait(1);
}
}
function main()
{
level_load("test.WMB");
wait(2);
// test map 3*3
tile_content[0] = 1; tile_content[1] = 2; tile_content[2] = 3;
tile_content[3] = 4; tile_content[4] = 3; tile_content[5] = 2;
tile_content[6] = 1; tile_content[7] = 2; tile_content[8] = 3;
mapping();
}the tilemap is an image that looks like this: the result: I think this is far to complicated for a 2D Tile-Based System. Any Ideas or Solutions? Roxas.
|
|
|
Re: 2D Tile Based Engine with 3DGS
[Re: Roxas]
#239224
12/03/08 12:57
12/03/08 12:57
|
Joined: Oct 2004
Posts: 4,134 Netherlands
Joozey
Expert
|
Expert
Joined: Oct 2004
Posts: 4,134
Netherlands
|
because there's no command in lite-c which lets you create something like this Ah, then make one?  int** make_map(int width, int height) {
//create a multidimensional array
int** map = (int**)malloc(sizeof(int*) * width);
int i;
for(i = 0; i < width; i++) {
map[width] = (int*)malloc(sizeof(int) * height);
}
//fill the array with 0
for(i = 0; i < width; i++) {
for(i = 0; i < height; i++) {
map[width][height] = 0; //init at 0
}
return map;
}reference: http://www.coniserver.net/ubb7/ubbthreads.php?ubb=showflat&Number=200397
Click and join the 3dgs irc community! Room: #3dgs
|
|
|
|