Urban Terror Forums: BSP Editor - Urban Terror Forums

Jump to content

 Login | Register 
Advertisement
Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

BSP Editor Rate Topic: -----

#1 User is offline   n4w4k Icon

  • Account: n4w4k
  • Main tag: chic.
  • Joined: 05-August 12
  • Posts: 24

Posted 17 March 2013 - 03:01 PM

Hi guys!

I'm currently trying to develop a bsp editor. I use the bsp format specs found here. My 'bsp reader' works perfectly but my 'bsp writer' doesn't (for the moment i'm just trying to replace a texture).

Does anyone know what datas is missing in those specs? Have you got links to share with me?

Thanks in advance

#2 User is offline   rfx Icon

  • Account: rfx
  • Country:
  • Joined: 01-March 10
  • Posts: 576

Posted 17 March 2013 - 03:37 PM

The GtkRadiant and derivates editors are all open source and capable of writing BSP; maybe you can check there.

I'm not aware whether those specs are complete or not (but I've used them too in the past, for different purpose). Since you're the one who wrote the code you practically have it in your hand to deeper analyze it (e.g. what means "doesn't work"? Compare the input binary with the output binary and I'm sure you will find the problem).

#3 User is offline   n4w4k Icon

  • Account: n4w4k
  • Main tag: chic.
  • Joined: 05-August 12
  • Posts: 24

Posted 17 March 2013 - 04:03 PM

When I say "doesn't work", I mean that when I launch the map in urt, the engine stays frozen. No error, no loading.. nothing at all.

I compared an "original" bsp and an edited one by myself, I see a difference but I dunno what are those datas (string? int32? float? byte?...) and what is the correspondence.

I'm not a pro with binary files (I've just discovered them with this project), then there might be a way to do it that i dunno..

Btw I'll look for the code that radiant is using, maybe I'll find some useful informations.

#4 User is offline   ArgusMagnus Icon

  • Account: argusmagnus
  • Joined: 31-December 12
  • Posts: 59

Posted 17 March 2013 - 07:13 PM

View Postn4w4k, on 17 March 2013 - 04:03 PM, said:

I compared an "original" bsp and an edited one by myself, I see a difference but I dunno what are those datas (string? int32? float? byte?...) and what is the correspondence.


I do not understand what you mean. As described here a "texture-datablock" contains a string[64] (64 bytes long) which specifies the name of the texture or shader (e.g. "textures/common/caulk"). If the name is less than 64 bytes long, the rest is filled with nulls ('\0' or 0x00). The name is followed by two int32 (integer, 4 bytes long) which represent some flagcomibnations.
You have to make sure, that your writer writes the correct number of bytes, for instance the writer has to write 64 bytes for the name.
I have done something similar recently, perhaps my code helps...

If it still does not work, maybe I can help you if you care to share some code :)
Experimental Map Manager for Urban Terror and other Quake 3 based games: ArgUrTMapManager
Fractal Image Calculator: Fraktalysator

#5 User is offline   n4w4k Icon

  • Account: n4w4k
  • Main tag: chic.
  • Joined: 05-August 12
  • Posts: 24

Posted 18 March 2013 - 09:41 AM

I was a bit confused.. I thought the bsp format specs wasn't completed because I didn't see "I LOVE MY Q3MAP2 ..." in my file.. As rfx said, I had to compare the input binary with the output binary and I saw that I was wrong with the number of elements in lumps.

Now I get another issue :rolleyes: But this time I have a error in urt:

Quote

CM_GeneratePatchFacets: bad parameters (0, 0, 01528724)

I dunno the meaning of that.

@argusmagnus: I saw your project, it looks nice. I'm using csharp too for this project so maybe you can help me :happy:

You can find my source code here. I hope you or someone else will be able to find where is my mistake(s).

Thanks

PS: Of course my project is open source :happy:

This post has been edited by n4w4k: 18 March 2013 - 10:07 AM


bullet_loaderAdvertisement

#6 User is offline   ArgusMagnus Icon

  • Account: argusmagnus
  • Joined: 31-December 12
  • Posts: 59

Posted 18 March 2013 - 11:02 AM

I took a quick look at your code. I noticed that you use BinaryReader.ReadChars. That will cause problems, since chars in c# are utf-16 encoded, which means that one char is two or four bytes long and not just one byte. Thats why I used
char ch = (char)reader.ReadByte();

instead. Of course the same is true for BinaryWriter.Write(char[]).

edit: Or you could use the constructor overload and set the encoding to ASCIIEncoding. (I did not test this, but it should work).

This post has been edited by argusmagnus: 18 March 2013 - 11:17 AM

Experimental Map Manager for Urban Terror and other Quake 3 based games: ArgUrTMapManager
Fractal Image Calculator: Fraktalysator

#7 User is offline   n4w4k Icon

  • Account: n4w4k
  • Main tag: chic.
  • Joined: 05-August 12
  • Posts: 24

Posted 18 March 2013 - 12:11 PM

I think the default encoding was ASCII because it doesn't change anything. Anyways I've forgotten to define it. Thanks for tip :tongue:

I've fixed issues and now I'm able to load a bsp file and save it after (tested with ut4_abbey and my own maptest).

The code is available here.

Now I'll try replacing some textures and see what happens.
At the end, I want to be able to add new 4.2 jump entities in a friend's bsp file (map file is lost..).
I'll see what I'll can do :unsure:

Thanks a lot for your help!

#8 User is offline   ArgusMagnus Icon

  • Account: argusmagnus
  • Joined: 31-December 12
  • Posts: 59

Posted 19 March 2013 - 01:46 PM

Have you tried the -decompile switch of q3map2? I have never used it and dont know if it works (well), but if it does, it would probably be the best solution for your/your friend's problem. I mean, adding entities to a bsp is easy enough, but to know where to place them, you would have to write some kind of visualizer similar to that of GtkRadiant. And that does sound like an awful lot of work for just one person to me..
Good luck anyway! :)
Experimental Map Manager for Urban Terror and other Quake 3 based games: ArgUrTMapManager
Fractal Image Calculator: Fraktalysator

#9 User is offline   n4w4k Icon

  • Account: n4w4k
  • Main tag: chic.
  • Joined: 05-August 12
  • Posts: 24

Posted 19 March 2013 - 06:28 PM

The problem with q3map2 is that the lights are not generated (if I remember correctly).
My friend's issue is a pretext for manipulating bsp files, so it's not really a problem for me.

For adding jump_start & jump_stop entities, I have to add them in the entity lump (pretty easy as you said) but I have to add trigger_multiple brushes, and here is the difficulty. One of the easiest way I have imagine is decompiling the original map with q3map2, looking for the trigger_multiple brushes bounds in radiant, and creating a method like AddTriggerMultipleBrush(float[] position, float[] size, string target) in my program. But adding a brush looks a pain..

I still have to learn a lot about the bsp file data before finishing the project..

#10 User is offline   ArgusMagnus Icon

  • Account: argusmagnus
  • Joined: 31-December 12
  • Posts: 59

Posted 19 March 2013 - 07:46 PM

I do not know anything about bsp files beyond the point I had to know to do what I wanted, sorry, but I cannot further help you there.. And messing with the brush/etc. data sure looks like a pain, so I wish you good luck again :)
Experimental Map Manager for Urban Terror and other Quake 3 based games: ArgUrTMapManager
Fractal Image Calculator: Fraktalysator

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users

Advertisement


Copyright © 1999-2024 Frozensand Games Limited  |  All rights reserved  |  Urban Terror™ and FrozenSand™ are trademarks of Frozensand Games Limited

Frozensand Games is a Limited company registered in England and Wales. Company Reg No: 10343942