Archived

This topic is now archived and is closed to further replies.

mickey

hi, hmm., in 2d square/diamond tile games.., level editor comes first.........

Recommended Posts

before the game engine so that you wouldn''t put the codes in like making codes to map all the tiles onto the screen directly into your code right? so what you would do is., make a level editor then make a file format for this, then later on, on your game engine, put in a function that loads this level of yours made by your level editor. is this right? btw, how does someone make a level editor? is this just really simple to made? is this what comes with some of the commercial games like Arcanum etc., ?

Share this post


Link to post
Share on other sites
in theory you could code either one first, but I usually start off with the level editor.

what language are you coding in, if you're using delphi I'll give you the source to one of my 2d tile-based(16x16x64x64 tile & map size) level editors

The idiot in the box

[edited by - idiotbox15 on May 3, 2002 7:51:35 AM]

Share this post


Link to post
Share on other sites
aww, am using C...,

well anyway, can you say something about how does someone makes a level editor? hmm., probably the requirements of your level editor would narrow it down? ie, how will i save the map in which my game engine would understand? is it in a struct etc.,?

thanks,

Share this post


Link to post
Share on other sites
I just use a simple array and put it inside a record, and in delphi file I/O with records is simple, I''m not sure how you would do it in c/c++ but this is how it looks in delphi code.


//Map Structure

Type
Tmap = record
Tiles = array[0..64,0..64] of integer
end;

//declare a map variable
var Map : Tmap;
// I think this would be somethin like "#Define map as Tmap" in c


//procedure to save the map to a file
procedure Tform1.savemap(Mapfile : file of Tmap; Filename : string;
begin
AssignFile(mapfile,filename);
reset(mapfile);
write(Mapfile,map);
end;
end;

I hope this helps a little bit, I''ll try to find out what this code would be in C for you.

Share this post


Link to post
Share on other sites
Goto www.planetsourcecode.com and search for Zelda in the c/c++ archives and you should find an open source game called Zelduh, it has the source to the game and Level editor in Msv c++, it might help.

Share this post


Link to post
Share on other sites
I wrote the engine first.
I tested it with a hard-coded level.
then when I got to the level builder, I built it using the game engine and got a level editor + level player
cheers


I am what I am, more or less
and my site rocks
www.geocities.com/roam_fire
I think

Share this post


Link to post
Share on other sites
That''s how I did it for prelude to darkness, the editor and game were build at the same time, the editor is just a subset of the actual game. Multiple editors were build into the game at different points, i.e. the terrain editor came first, the a mesh editor, then a building editor, then a creature editor.

luck,
-m

mat williams
Lead Programmer, Designer
Zero Sum Software
www.zero-sum.com

Share this post


Link to post
Share on other sites
hiya,

thanks for the replies guys! one last thing., not about this thread anymore i just don't want to start another one...,

is it really like this.., I should load all my game graphics unto the video memory using the API i want before my game starts? what if i run out of memory? i mean, it's very easy to consume all the memory ye know...,

so for example, I have all these things happening on the game screen at one time..., 10 enemies, with 20 frames each onto them, 4 640x480 backgrounds, 5 kinds of weapons with 5 frames for each, shall i Load this everthing onto the memory?? yikes!

thanks for sharing you side guys..,


[edited by - mickey on May 8, 2002 11:23:53 AM]

Share this post


Link to post
Share on other sites
you really think that''ll fill up the video of an almost modern-day card?
let''s have a look at the parts and sum up, ok?
i''m assuming you''re using a ~64x32 tile and 16bit resolution

1) 10*20 = 200. let''s say each enemy is even 100x200px.
that''s 200*100*200*2 bytes = 8,000,000 bytes = 7.6mb

2) 4*640*480*2 bytes = 2,457,600 bytes = 2.3mb

3) let''s say your weapons are even 40x20px.
5*5*40*20*2 bytes = 40,000 bytes = 39k.

you''re also forgetting whatever tile graphics you may have.
but without the tiles you have about 10mb here.
i''m assuming that any API worth using, has a way to attempt to create a surface in video memory, and of retruning unsuccessful.
thus you should probably be able to check if you succeeded putting something in video memory.

also, those 4 backgrounds, unless you need them constantly, keep only 1 or 2 in video memory.
like, your title screen doesn''t need to be in video if it''s hardly ever used.

speaking for directdraw, i think a primary surface''s backbuffer goes into system memory even though the primary itself is in video memory but i''m not sure..

//Demiurge
Make something idiot proof, and someone will make a better idiot..

Share this post


Link to post
Share on other sites
kewl! hmm.,

how about diablo2? did you think the guys load everything up from the start of the game? i mean, unlike diablo 1 which for every level you descend, a map loads right, but in diablo 2, there no laoding till you get to the next part... any ideas how is this thing done? multithreading?

thanks,

Share this post


Link to post
Share on other sites
You are probably right about the multithreading thing. For example, when you go to another level of a dungeon, the game probably loads only the part of the map that you can see on the screen at that time. Then some sort of thread is started, which runs next to the game thread, so you can play the game already. This newly created thread starts loading the map: it begins with the area close to you (only a few times the screen width for example), and as it continues it loads parts of the area which are further away, until the thread has finally loaded the whole map. Because this thread takes up too many cpu-cycles sometimes, there is not enough ''cpu-power'' left do run the game thread properly; that''s why the game can run ''sluggish'' when you enter a new level of a dungeon.

Share this post


Link to post
Share on other sites