Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, Grant, Neb), 908 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
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 Offline OP
Member
Roxas  Offline 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.

Code:
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 Offline
Senior Expert
Quad  Offline
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: Quad] #239115
12/02/08 19:05
12/02/08 19:05
Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
Roxas Offline OP
Member
Roxas  Offline OP
Member

Joined: Apr 2008
Posts: 144
Germany | Niedersachsen (Lower...
well thanks for the answer
but HOW do I realise something like this?
is there any possibility to do that in lite-c in a similar way?
that stuff with the numbers and so on?

because I don't know how to do that. I started with something like

var tilesize = 32;
var map_size_x = 20;
var map_size_y = 20;

var map_content[400];


after that i tried to fill the array with the informations. but it didn't work. so how do i fill the array with the numbers that are indicating the tile which they should refer to =O?

and how is it possible to show the tile on the screen?

panels with windows?
that's way to complicated =O isn't it?

Roxas.

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 Offline
Serious User
Dark_samurai  Offline
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 Offline
Expert
Joozey  Offline
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 smile.

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 Offline
Senior Expert
Quad  Offline
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 Offline
Expert
Espér  Offline
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.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: 2D Tile Based Engine with 3DGS [Re: Espér] #239160
12/02/08 23:19
12/02/08 23:19
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
Write your own collision code?

Entities and sprites are not 2D, those trigger the 3D engine. You don't want to load any level in a 2D game, else it's not 2D. Even if it's projected as 2D, you use much more parts of the engine that you don't want.


Click and join the 3dgs irc community!
Room: #3dgs
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 Offline OP
Member
Roxas  Offline 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.

Code:
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 Offline
Expert
Joozey  Offline
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
Quote:
because there's no command in lite-c which lets you create something like this

Ah, then make one? wink

Code:
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
Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1