FAQFAQ    Board RulesBoard Rules    SearchSearch    LotteryLottery    RouletteRoulette    UsergroupsUsergroups
     RegisterRegister  ProfileProfile    Log in to check your private messagesLog in to check your private messages    Shop    Log inLog in 
View posts since last visit View your posts View unanswered posts

Mafia World Editor
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Post new topic   Reply to topic    Mafiascene.com Forum Index -> Mafia Mods
View previous topic :: View next topic  
Author Message
ASM.

Mafiascene Veteran Modder
Mafiascene Veteran Modder


Joined: 10 Jan 2014
Posts: 153

337 Bank Notes
Items

PostPosted: Mon Feb 19, 2018 1:43 am    Post subject: Mafia World Editor Reply with quote

Yeah, MWE doesn't handle ranges properly. MWE uses the D3D9 FFP for rendering so for dynamic lights I'm stuck with the FFP's lighting implementation which only allows to configure the cutoff range (i.e. far range) and the constants for the attenuation function
Code:

attn(d) := rcp(c_1d^2 + c_2d + c3)

The attenuation function however needs to be 1 for d in [0; range_{near}).

Out of curiosity what results do you get if you use vertex lightmaps? The lightmapper handles the ranges properly but if I remember correctly it uses a linear falloff so I suspect the results still won't match with Mafia.

By the way do you mind sharing that scene? I think it could prove handy for tweaking the lighting system/lightmapper.
Back to top
View user's profile Send private message
Duelist

Member
Member


Joined: 06 Nov 2016
Posts: 100
Location: Poland
203 Bank Notes
Items

PostPosted: Tue Feb 20, 2018 2:34 pm    Post subject: Mafia World Editor Reply with quote

I don't know about that stuff but wouldn't it be possible to calculate with math some fake far range using power/cone/ranges in advance and pass it as far range for display? Sticking out tongue

For this scene? I couldn't tell if there's a difference. Overall I didn't use them at all since I don't understand their point. BTW, is there any documentation on lightmaps structure in hex? When I thought that I have more or less solved it for lmaps created using MWE it turns out that original lightmaps are a bit different Confused

I'm also attaching one object converted from Chameleon becouse MWE displays their .tga textures without alpha and flipped upside down. In game everything is fine. It's just a minor inconvenience so not really that important but if you're interested to take a look. Link
Back to top
View user's profile Send private message
ASM.

Mafiascene Veteran Modder
Mafiascene Veteran Modder


Joined: 10 Jan 2014
Posts: 153

337 Bank Notes
Items

PostPosted: Tue Feb 20, 2018 11:16 pm    Post subject: Re: Mafia World Editor Reply with quote

Thanks for the files. Smile

Duelist wrote:
I don't know about that stuff but wouldn't it be possible to calculate with math some fake far range using power/cone/ranges in advance and pass it as far range for display? Sticking out tongue

I don't see how this would work to be honest Sad. The only two options I currently see are a) doing lighting in software (which is what I suspect Mafia/LS3D is doing) or b) switching to a programmable pipeline.

Duelist wrote:

For this scene? I couldn't tell if there's a difference.

Looks like I need to tweak the attenuation function then. Oops!

Duelist wrote:

Overall I didn't use them at all since I don't understand their point.

I guess they were more important in 2002 than they're now. They allow to compute lighting offline so the engine doesn't have to do it at runtime and you get support for shadows. Another advantage is that they typically consume less storage than bitmap lightmaps as they just store a 32-bit color value per vertex. If your mesh is tessellated enough, vertex lightmaps can probably do a fairly good job.

Duelist wrote:

BTW, is there any documentation on lightmaps structure in hex?

I'm only aware of GOLOD55's documentation. I can upload it somewhere if you're interested. It's in Russian though and, from what I remember, it's also missing a few (minor) aspects. Nonetheless it's a really good starting point. I used it as reference for mview's lightmap rendering implementation back then.

Duelist wrote:

When I thought that I have more or less solved it for lmaps created using MWE it turns out that original lightmaps are a bit different Confused

Different in what way?
Back to top
View user's profile Send private message
Jaqub

Junior Member
Junior Member


Joined: 12 Dec 2017
Posts: 44
Location: idk
29 Bank Notes
Items

PostPosted: Wed Feb 21, 2018 4:03 pm    Post subject: Mafia World Editor Reply with quote

Hi ASM, I need your help with cache.bin and scene2.bin from /freeride. I want to filter all models written from these both files. What I want to do is loading the buildings from freeride on 3ds max. I got a friend who is trying to write a 3dsMax script to load the stuff from these .bin files. I would appreciate if you could help us since you were able to make them loadable on your program. Thanks.
Contact me on discord if possible: jaqub7147#6503
_________________

Back to top
View user's profile Send private message Visit poster's website
ASM.

Mafiascene Veteran Modder
Mafiascene Veteran Modder


Joined: 10 Jan 2014
Posts: 153

337 Bank Notes
Items

PostPosted: Fri Feb 23, 2018 12:54 pm    Post subject: Re: Mafia World Editor Reply with quote

Jaqub wrote:
Hi ASM, I need your help with cache.bin and scene2.bin from /freeride. I want to filter all models written from these both files. What I want to do is loading the buildings from freeride on 3ds max. I got a friend who is trying to write a 3dsMax script to load the stuff from these .bin files. I would appreciate if you could help us since you were able to make them loadable on your program. Thanks.
Contact me on discord if possible: jaqub7147#6503

Here's a quick scene2.bin/cache.bin primer:

The scene2.bin format at its core is fairly simple. It is entirely chunk based, with each chunk containing a header and the payload. Payloads may consist of chunks as well. A cool property of such a chunk based format is that you can easily parse it without having to know every little detail of every chunk type. If you come across a chunk type you don't understand, you can easily skip it as you know its size.

The chunk header has the following format:

Code:

struct ChunkHeader
{
  uint16_t Type;
  uint32_t Size;
}


A typical scene2.bin has the following chunk structure:

Code:

MISSION (0x4c53)
  |- META (0x0001)
  |- _0xAFFF
  |- _0x3200
  |- FOV (0x3010, float)
  |- VIEW_DISTANCE (0x3011, float)
  |- CLIPPING_PLANES (0x3211, vec2)
  |- SCENE (0x4000)
  |- ACTORS (0xAE20)
  -- INIT (0xAE50)


Level objects like model instances, lights, sounds, etc. are stored in the SCENE chunk as OBJECT (0x4010) chunks. The type of chunks in OBJECT chunks depends on the object/definition type. Model instances for example have the following chunk structure:

Code:

OBJECT (0x4010)
  |- TYPE (0x4011, uint32_t) (9 for model instances)
  |- NAME (0x0010, string)
  |- POSITION (0x0020, vec3)
  |- ROTATION (0x0022, quat)
  |- POSITION_2 (0x002C, vec3) (position from final world transform?)
  |- SCALE (0x002D, vec3)
  |- PARENT (0x4020)
  |--- NAME (0x0010, string)
  -- MODEL (0x2012, string)


Note that except for the NAME chunk none of the above chunks are guaranteed to appear in an OBJECT chunk.

The PARENT chunk contains the name of the parent object the object should be attached to. This can be an object previously defined in the scene2.bin or an object/sector from scene.4ds. An important aspect here is that transforms are in the space of the parent object. Since parent objects don't necessarily have to be located in the scene2.bin, you have to construct the complete scene graph for the mission from scene.4ds, scene2.bin and model instances defined in scene2.bin in order to be able to properly resolve those parent references in all cases which in turn is necessary to compute the final world transform. This is not much of an issue for freeride/mesto missions though as most objects are attached to Primary sector there which has identity transform.



Now on to the cache.bin format. cache.bin's are used for MESTO/FREERIDE missions and store the bulk of buildings, road signs, fences/walls and vegetation. The format is again chunk based and very similar to the one of scene2.bin:

Code:

CACHE (0x01F4)
  |- Version (uint32_t) (should always be 1)
  -- CACHE_BASE_BLOCK[] (0x03E8)


After the format version there's a collection of CACHE_BASE_BLOCK chunks. The actual model instances are defined within them. The seperation into base blocks is probably done to aid the engine's culling pipeline. The format of CACHE_BASE_BLOCK payloads is as follows:

Code:

CACHE_BASE_BLOCK (0x03E8)
  |- BaseObjectNameLength (uint32_t)
  |- BaseObjectName (string) (typically a mesh object from scene.4ds)
  |- Bounds (size: 0x4C)
  -- CACHE_MODEL[] (0x07D0)


The CACHE_MODEL chunks contain the actual model instance definitions. The payload looks like this:

Code:

struct CacheModel
{
  uint32_t ModelNameLength
  char ModelName[ModelNameLength]
  vec3 Position
  quat Rotation
  vec3 Scale
  uint32_t _Unknown
  vec3 Scale2
}


There's a bit of a mystery concerning scaling of CacheModel instances. MWE uses the Scale field and it works fairly well. However there're a bunch of instances that are scaled incorrectly (like the brick walls around the docks (base250) or the buildings right next to the Central Hoboken station (base71)). Using Scale2 instead of Scale fixes the scaling for some of these instances, but breaks it for others. Duelist and I have looked into that some months ago and it looks like Scale2 replaces the scaling of all visual objects in the model instance.

I hope that helps a bit. Let me know if you need additional details. Wink
Back to top
View user's profile Send private message
ASM.

Mafiascene Veteran Modder
Mafiascene Veteran Modder


Joined: 10 Jan 2014
Posts: 153

337 Bank Notes
Items

PostPosted: Mon Mar 19, 2018 11:53 pm    Post subject: Re: Mafia World Editor Reply with quote

Duelist wrote:

For this scene? I couldn't tell if there's a difference.

Hm I tried it myself and this is what I got:


Now an in-game shot without lightmaps for comparison:


Thinking
Back to top
View user's profile Send private message
agens

New Member
New Member


Joined: 29 Apr 2016
Posts: 12

27 Bank Notes
Items

PostPosted: Thu Mar 22, 2018 6:01 pm    Post subject: Re: Mafia World Editor Reply with quote

ASM

Have you tried making Mafia 2 World Editor?
Back to top
View user's profile Send private message
ASM.

Mafiascene Veteran Modder
Mafiascene Veteran Modder


Joined: 10 Jan 2014
Posts: 153

337 Bank Notes
Items

PostPosted: Tue Apr 24, 2018 10:23 pm    Post subject: Re: Mafia World Editor Reply with quote

agens wrote:
ASM

Have you tried making Mafia 2 World Editor?

Actually yes, though it never got past being a very basic map/model viewer. Guilty
Back to top
View user's profile Send private message
brokenneedlecaa76

Member
Member


Joined: 25 Jan 2016
Posts: 125

261 Bank Notes
Items

PostPosted: Wed Apr 25, 2018 3:01 am    Post subject: Mafia World Editor Reply with quote

How far away is it before Mafia2 is completely modd-able do you think? I know there are many mods but I don't think even close to the number of available mods for mafia.opinions?
Back to top
View user's profile Send private message
Jaqub

Junior Member
Junior Member


Joined: 12 Dec 2017
Posts: 44
Location: idk
29 Bank Notes
Items

PostPosted: Wed Apr 25, 2018 11:55 am    Post subject: Re: Mafia World Editor Reply with quote

brokenneedlecaa76 wrote:
How far away is it before Mafia2 is completely modd-able do you think? ...


Ever saw this from the last month?



ASM, You should look into the Zmodeler 3 .mafia formats (.sds) import function how it was done. You also can contact Oleg, he could help you.
_________________

Back to top
View user's profile Send private message Visit poster's website
agens

New Member
New Member


Joined: 29 Apr 2016
Posts: 12

27 Bank Notes
Items

PostPosted: Wed Apr 25, 2018 6:06 pm    Post subject: Mafia World Editor Reply with quote

I asked Oleg to make an export for maps, if everything works out, then soon there will be mods for maps in Mafia 2. If you are interested in this topic to contact Oleg.
Back to top
View user's profile Send private message
agens

New Member
New Member


Joined: 29 Apr 2016
Posts: 12

27 Bank Notes
Items

PostPosted: Wed Apr 25, 2018 6:13 pm    Post subject: Re: Mafia World Editor Reply with quote

"Jaqub" Prompt, you found a way how to import map the mafia 1 in 3ds max with all objects?
Back to top
View user's profile Send private message
Jaqub

Junior Member
Junior Member


Joined: 12 Dec 2017
Posts: 44
Location: idk
29 Bank Notes
Items

PostPosted: Wed Apr 25, 2018 6:52 pm    Post subject: Re: Mafia World Editor Reply with quote

agens wrote:
"Jaqub" Prompt, you found a way how to import map the mafia 1 in 3ds max with all objects?


Still at researching, asm instructed me to do a MaxScript already but i didn't had much knowledge to it.
_________________

Back to top
View user's profile Send private message Visit poster's website
agens

New Member
New Member


Joined: 29 Apr 2016
Posts: 12

27 Bank Notes
Items

PostPosted: Wed Apr 25, 2018 7:15 pm    Post subject: Re: Mafia World Editor Reply with quote

Jaqub wrote:
agens wrote:
"Jaqub" Prompt, you found a way how to import map the mafia 1 in 3ds max with all objects?


Still at researching, asm instructed me to do a MaxScript already but i didn't had much knowledge to it.


A where can I see the MaxScript? I understand it will need to add to the script to import 4ds?
Back to top
View user's profile Send private message
Jaqub

Junior Member
Junior Member


Joined: 12 Dec 2017
Posts: 44
Location: idk
29 Bank Notes
Items

PostPosted: Wed Apr 25, 2018 7:24 pm    Post subject: Re: Mafia World Editor Reply with quote

agens wrote:
Jaqub wrote:
agens wrote:
"Jaqub" Prompt, you found a way how to import map the mafia 1 in 3ds max with all objects?


Still at researching, asm instructed me to do a MaxScript already but i didn't had much knowledge to it.


A where can I see the MaxScript? I understand it will need to add to the script to import 4ds?


No, the script for importing 4ds files is here: http://forum.xentax.com/viewtopic.php?f=16&t=4691
My problem are the objects like buildings and props which are in cache.bin and scene2.bin
_________________

Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Mafiascene.com Forum Index -> Mafia Mods All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
Page 6 of 7

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

Generation Time: 0.097 | Queries: 19