New way to load map

Posted By: SkullBoy99

New way to load map - 04/02/14 19:13

Hey everybody,what do you think about a new way to load map?
I talk about a new level editor ,too.
My ideea is this:
We work on a map in level editor.When we click Save,the editor will generate a file in text format,and with a script included in your project,all objects will be placed at x,y,z position.
And I think with that ,our games will run more faster. grin
Posted By: Superku

Re: New way to load map - 04/02/14 20:03

This is already possible and common practice for user generated/ project or genre specific level editors.
You can give it a try yourself and ask questions on the forums should you get stuck at some issue.
Posted By: Aku_Aku

Re: New way to load map - 04/02/14 22:07

The idea is good. I work on that since more than three years.
Posted By: WretchedSid

Re: New way to load map - 04/03/14 04:33

Binary beats text 11 out of 10 times. What are you trying to achieve/speed up exactly?
Posted By: sivan

Re: New way to load map - 04/03/14 07:10

I use text files for creating a level by loading entity data, using an optimized way by putting them into categories thus minimizing the stored information, and for some other settings like materials, shadows etc. you can check it, it is open source, but its speed is much slower than loading a wmb level, mainly because of the speed of ent_create, and the limitation of the number of running actions/functions per frame. maybe a binary solution would be slightly faster, but I use it because of better debugging possibilities.
so I recommend to use a wmb as a basis of in-game usage, with some additional stuff for materials, and other extra entities which do not have place within the main wmb file, like some thousands of grass models...
Posted By: Aku_Aku

Re: New way to load map - 04/03/14 08:17

At this stage, does not matter the level information are stored in text or binary data files.
The prime goal is what i try to achieve, is a system built from scratch, that is able to create a level, store that and load that. When that works i will deal with this aspect of the speed or performance. In my opinion in this stage, the text or binary data storing is not so important to make it primary goal.
Posted By: SkullBoy99

Re: New way to load map - 04/03/14 11:37

Originally Posted By: Aku_Aku
The idea is good. I work on that since more than three years.

Can you show us your work?
Posted By: MasterQ32

Re: New way to load map - 04/03/14 13:36

I have a custom editor anywhere on my hard drive, pretty project specific, but if i find it, i can publish it on github (if you want). But be warned: The editor is mostly a 5k-lines file wink
Posted By: sivan

Re: New way to load map - 04/03/14 13:44

it would be great. maybe I will also put my editor onto github...
Posted By: Aku_Aku

Re: New way to load map - 04/03/14 14:03

Yes, of course.
But i have to know are there more than one inquisitive?
Because i used not English language when i made it,
so i have to translate, and it needs cca. 2-4 weeks.
I planned the translation, but not in this half year.
Posted By: MasterQ32

Re: New way to load map - 04/03/14 14:09

Found it!
[img]http://ps.masterq32.de/?154[/img]

Fun fact: To get the image tag working, i have to write http://ps.masterq32.de/?154.png instead of http://ps.masterq32.de/?154

Fun fact 2: Looks like my upload system had a bug with direct file upload and deleted the old file
Posted By: SkullBoy99

Re: New way to load map - 04/03/14 14:19

Look nice laugh.Guys ,now i try to do a script to open and read a .ipl file(in text format) ,where I put some coordinates(x,y,z) for two models.If will work,I will work more on that.
Posted By: MasterQ32

Re: New way to load map - 04/03/14 14:21

Editor will be available here in some minutes:
https://github.com/MasterQ32/SQEditor
Upload is still in progress, but check it out!
Posted By: SkullBoy99

Re: New way to load map - 04/03/14 14:43

My .ipl file will look like this:
Code:
// Model name  X Y Z
road_ls01.mdl 10 25 0


But 3DGS Manual don't help me.
Posted By: MasterQ32

Re: New way to load map - 04/03/14 14:45

Where is the problem? file_var_read and file_str_read should do their job
Posted By: SkullBoy99

Re: New way to load map - 04/03/14 14:52

I will try grin.
I really want to do this.Why?Because when you want to build your map,only click save and a file will be created,and don't need to wait!:)
Posted By: WretchedSid

Re: New way to load map - 04/03/14 15:51

Wait... Are you just trying to get around the map compiler here?

And seriously, seriously, seriously: If you go down this road to begin with, do it in binary! Text parsing IS slow and you can circumvent it easily but refuse to. Heck, even the loading and saving would be easier than the parsing.
Posted By: FBL

Re: New way to load map - 04/03/14 16:37

You could as well just write WMB format directly. It's documented in the manual.
Posted By: SkullBoy99

Re: New way to load map - 04/03/14 17:16

JustSid,no.I don't talk about a new level editor,just about my idea,and implement it in a existent editor.I think a new editor is not bad.

Firoball,yes i found it,but isn't what I want to do laugh.
Can someone look in these codes,in init_ipl() it's something wrong.


[code]
ex_ipl.h

typedef struct
{
STRING* name;
float x;
float y;
float z;
}ITEM;

ex_ipl.c

#include <ex_ipl.h>
ITEM* item;
float x_pos;
float y_pos;
float z_pos;
STRING* mdl_name
function init_ipl()
int entities = 2;
var fhandle = file_open_read("ls.ipl");
int i;
for(i=0;i<=entities;i++)
{
file_str_read(fhandle,mdl_name);
x_pos = file_var_read(fhandle);
y_pos = file_var_read(fhandle);
z_pos = file_var_read(fhandle);
item.name = mdl_name;
item.x = x_pos;
item.y = y_pos;
item.z = z_pos;
ent_create(item.name,vector(item.x,item.y,item.z),NULL);
}
file_close(fhandle);
}
Posted By: Ch40zzC0d3r

Re: New way to load map - 04/03/14 19:14

you guys and your pointers <_<
You dont need a pointer if you just set the data in your structs directly...

Code:
ITEM item;



BTW: Please format your code right, thats so terrible to read :S
Posted By: SkullBoy99

Re: New way to load map - 04/04/14 14:26

Ok, but that's not my problem.It can't read a string from my file.
Posted By: Aku_Aku

Re: New way to load map - 04/04/14 17:14

This community at all helpful. We will help you, if you give respect to the forum rules when ask something.
Use the code formatting option, that you can see when you write your post next above the textbox where you type in your message.
Click on the icon with # mark, after select the [code] option and insert your code between the starting-ending tag.
Moreover, that is not enough if you give a sign, you have a problem. You have to describe the issue as detailed as can, have to give the errorcode if that appeared, have to give the circumstances that where the error raised, have to give your action that triggered the error. And so on...
If you interested in this subject generally, here is a link: How to ask questions
Posted By: FBL

Re: New way to load map - 04/06/14 12:34

mdl_name is just a string pointer.
You need str_create() as file_str_read() will not create the string for you, but just copy into it. So at the moment you're reading to anywhere, but surely not to a string.

Code:
STRING* mdl_name = str_create("");
(...)
file_str_read(fhandle, mdl_name);
(...)

Posted By: Dico

Re: New way to load map - 04/07/14 20:34

you can also do this if you have in file (map.txt ) ex:

Code:
///    name  x   y  z
 model: zombi.mdl 123 15 33
 model: zombi2.mdl 55 40 33




this is the script for read this file


Code:
function read_info()
{
	var handle_map = file_open_read ("map.txt");
		
	while(file_find (handle_map,"model:"))	
	{
		STRING* name ="               ";
		file_str_read(handle_map,name);
		my = ent_create(name,vector(0,0,0),NULL);
		my.x = file_var_read(handle_map);// read first number
		my.y = file_var_read(handle_map);// read second number		
		my.z = file_var_read(handle_map);// read third number			
		wait(1);
	}
	//if you pass here that mean you read all "model:" string  in file map.txt
        file_close(handle_map); // now close handle_map
}





Posted By: Feindbild

Re: New way to load map - 04/10/14 13:43

Wtf. Why would you even want to do this?
3 pages and yet no one explained why they would want to do something like this.
What are the advantages? Why use text files??
Posted By: Dico

Re: New way to load map - 04/10/14 15:47

maybe he want to create his own world editor !!
Posted By: Feindbild

Re: New way to load map - 04/10/14 16:00

Yea... but why text files?!
Posted By: MasterQ32

Re: New way to load map - 04/10/14 16:02

Because they are easier to debug (human readable).
Imho it's good to develop a file format in text format and then just port this to binary.
Posted By: SkullBoy99

Re: New way to load map - 04/19/14 15:19

Yeah.. and when you want to build(compile) map ,you don't need to wait only few seconds
Dico thank you very much!That's that i want laugh (a .ipl is a .txt file but renamed)
Posted By: AceX

Re: New way to load map - 08/01/14 09:33

I think it's time to work on this world editor grin
Give me some ideas if you want,everything .
© 2024 lite-C Forums