Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Risto Paasivirta

DoomLoader for Unity

Recommended Posts

I imagine it is supposed to be a tool that let's lets you import Doom maps into Unity for if you are making a game with retro styled maps but don't want to actually use a source port. Of course being able to make changes and export back to a normal wad or PK3 would be a great addition as well but that is for later on down the road I guess

Share this post


Link to post

Woah! I've like *just* released my Unity-based Doom engine, haha! Coincidence :)

 

I see you used the Doombuilder code for the triangulation, did you have to do much work to it to get it to work with Unity? I didn't try to just copy it over myself, and instead rewrote it myself. (To not entirely perfect success)

Share this post


Link to post
14 hours ago, dmg_64 said:

Need one for Unreal lool, looking good.

 

Heh, long time since I've touched Unreal, so can't really say how easy it would be to even do. I think my codebase can prove to be a great case-study to help one implement WAD reading into various platform. Currently the code is pretty much undocumented as I'm pushing all the features in, constantly reworking the methods.

Once it stabilizes a bit I can document it, even perhaps make some tutorials on how this sort of toolset can be achieved in other platforms.

 

3 hours ago, StormCatcher.77 said:

It looks promising! Continue to develop the project. You are trying to create Unity-based level editor for Doom?

 

Not level editor per se. Idea is that you can use Doom level editors to create content for Unity. So basically it will act like a new engine Doom runs on. You can use it to make parts of your game, or true old school 2.5D shooter. There are many people who have become expert at making Doom-like maps as well as many who would want to port their years of hard work on mods to a newer platform. My personal goal is to make Hexen run in Unity so I can get to modding that :)

 

1 hour ago, therektafire said:

I imagine it is supposed to be a tool that let's lets you import Doom maps into Unity for if you are making a game with retro styled maps but don't want to actually use a source port. Of course being able to make changes and export back to a normal wad or PK3 would be a great addition as well but that is for later on down the road I guess

 

I don't plan to do much of level editing features, but Unity allows you to export FBX and OBJ files. Thus you can use the toolset to simply create parts of the content you like, or even use it just as an importer/exporter to create custom meshes prefabs. Quake level formats is something I can confidently say I would be able to do at some point in the future (thanks to them being fully documented with various open-source projects already existing.)

 

49 minutes ago, jmickle66666666 said:

Woah! I've like *just* released my Unity-based Doom engine, haha! Coincidence :)

 

I see you used the Doombuilder code for the triangulation, did you have to do much work to it to get it to work with Unity? I didn't try to just copy it over myself, and instead rewrote it myself. (To not entirely perfect success)

Nice! I think I might have seen your video already :D

 

No it was pretty much just copy-paste, although I don't like that there is now another class for Vector2 as a duplicate to the Unity's internal one, and there are some useless package that came along with it. I will clean it up at some point. Hey but it works now, so no need to fix it.

 

 

Thanks for the feedback and kind words!

After loading a map I played around with the Unity's lighting setup. Here are some sneak peeks on what you can achieve with the toolset. Running at >90fps, although I do have a beefy machine.

 

screenshot1.jpg.ed3157e14f83a4aa8784a4c8d1159f05.jpg

screenshot2.jpg.e4dfdc8b68c25e98165a4a5a3d88a1ca.jpg

screenshot3.jpg.8de56c09bb0c8140598f2d3e2a91c8d2.jpg

screenshot4.jpg.f8423b3986af4cb67e88f7b24400207f.jpg

screenshot5.jpg.7467f118b8e1b10042c1616ec3f05c70.jpg

screenshot6.jpg.ca70b70ae77ba26db99d084e54875fe3.jpg

 

By the way, the scene I have in the zip is made ready for deferred shading (if you do forward rendering you can get away with having only two cameras in total to get the skybox effect working.)

Share this post


Link to post

Very cool! I'm happy to hear it wasn't too difficult to copy over, makes me reconsider doing the same. It'd be nice to get a solution working without struggling with my own implementation any more :P

Share this post


Link to post

Version 2 is done. E1M1 and E1M2 are now feature complete, only thing missing is enemy behaviour and item pickups. 

Here's a list of the major changes:

  • Removed Vector2D struct and replaced all references with Unity's Vector2
  • Added first person weapon, created transparent billboard material and shader
  • Made mouselook and WSAD movement 
  • Implemented sounds for doors, weapon, enemies and linedefs
  • You can now shoot enemies and barrels dead
  • Created GameManager class and moved stuff from WadLoader into there
  • Removed the shader vertex transformation and went with classic gameobject rotation instead
  • Enemies now have the 5way sprite system
  • Added my AxMath library into the project
  • Mesher now has grid of triangle lists for quick querying for sectors
  • Removed my own ambient light parameter, the shaders now use Unity's Sky Ambient Light
  • Shaders in general are more cleaned up and parameter names are standardized
  • Thing's facing is now a separate quaternion decoupled from the object transform rotation
  • Homogenized linedef and sector controllers so they can be more easiely shared
  • All E1M1 and E1M2 linedefs are now done
  • Added a method to swap switch textures in TextureLoader
  • Made a fix for the sector 7 bug in E1M3
  • You can now unload maps and thus move from one map to another
  • Added a ground stick method to player object for smoother elevator movement

As before. Just extract the contents to the /assets folder of an empty project.

DoomLoader_v2.zip

Share this post


Link to post

This is awesome, I always wanted to test simple doom maps (=direct wad loading) with modern lighting engines (global lighting, probes, maybe normal maps, displace, etc...).
This makes it more feasible ^_^
Are the converted maps exportable in a standard 3D format? (such as fbx or obj)
Good job !

Share this post


Link to post
On 1/20/2018 at 2:17 PM, hidfan said:

This is awesome, I always wanted to test simple doom maps (=direct wad loading) with modern lighting engines (global lighting, probes, maybe normal maps, displace, etc...).
This makes it more feasible ^_^
Are the converted maps exportable in a standard 3D format? (such as fbx or obj)
Good job !

Yea in Unity you can export generated meshes into FBX and OBJ with just tiny bit of work.

Simplest way is to just use "AssetDatabase.CreateAsset(...);" and after that "AssetDatabase.SaveAssets();"

 

My main interest of making the Doom-like games to work with Unity is the ability to make better AI for the monsters. Stuff like pathfinding, waypoint navigation and areas of interest/danger (heatmap). After I have Doom 1 and 2 and Hexen running on the engine I try to form a small team to make a new game/total conversion.

 

Sorry for the lack of recent updates, had some real life happening and the next update is a big one. I'm currently making the enemies to combat you and navigate around the map. Already have the heatmap generation working and player breath so enemies can always walk towards you around obstacles and corners. Hopefully at Sunday you can fully play maps one, two and three of the shareware Doom, no compromises given.

 

Here you can see the heatmap and breath in action. Granted the breath (white lines) won't give the most interesting of path, but it is certain. Following a white line will always lead to player. This breath is also used for sound propagation. To make a more interesting walk path the monster checks the cells around himself and randomizes among the lowest cost breath values. This would be classic seek-and-destroy behavior. For pink demons that need to charge towards player there probably need to be a preliminary check to see if a direct line between player and the demon exists, and if so, then use that as movement vector. This should make them more dangerous than the vanilla demon AI in Doom that sometimes make some really weird and random movements. I will get to play around with monster behaviors at Wednesday or Thursday I think.

 

heatmap_breath_1.png

 

heatmap_breath_2.png

 

heatmap_breath_3.png.8a23abb2f805a31a3323696fd4034644.png

 

Edited by Risto Paasivirta : uploaded some images

Share this post


Link to post

First three maps are now fully playable.

Create a new Unity project and extract the zip contents into assets, open up the /assets/DoomLoader/test_scene.unity and hit play

 

DoomLoader_v3.zip

 

  •    - Went back to rotate sprites in shaders, billboards now keep y = up. Projectiles rotate omnidirectionally
  •    - Fixed AxMath.CartesianLineF to work when direction was true compass direction
  •    - Monsters and things are now in separate layers, as well as local player
  •    - Made it so you can no longer shoot yourself, don't know if this is a good thing
  •    - Added sectors and linedefs to the fast lookup cache, similar to triangles
  •    - Created TheGrid class for the caches, breath and pathfinding
  •    - Made AI class and heatmap calculation based on the grid data
  •    - Dynamic meshes now add Rigidbody component to avoid any problems or performance loss
  •    - Items can now be picked up. There's a PlayerInfo script that holds player inventory.
  •    - Keycard doors now require the correct key
  •    - Created hud to show player items
  •    - Added pain and pickup overlay to color the edges of the screen for a short time
  •    - Player plays sounds when poking, getting hurt or picking up items
  •    - Pokeable is now boolean to make player do the sound if the poke failed
  •    - There's a boolean to allow pokeable for monsters
  •    - Changed GameManager to refer to local player and made triggers to query for PlayerThing instead of localplayer
  •    - Player is now a monster-type thing, as well as demons
  •    - Made GameManager to skip frames after loading a map to stabilize Time.deltaTime 
  •    - Things now has unified gravity handling
  •    - Sectors have a property of being dynamic
  •    - Player casts breath that is used for making noise and generic pathfinding
  •    - Made physics collision matrix to optimize collisions and to disallow medikits to activate lifts
  •    - GameManager now handles loading of wads and maps
  •    - Zombies can now use common lifts and doors... monkaS
  •    - Monsters now have assigneable behavior that controls the intelligence
  •    - Renamed fivewaysprite to monstercontroller
  •    - Monster controller now refer to a common animation frame struct that holds the sprites for different rotations
  •    - Mesher, MapLoader, WadLoader and AI are now static classes
  •    - Damageable interface now has method for impules to make stuff be pushed by physical force. Only monsters use this atm
  •    - Shotgun and explosions now apply physical force to damageable objects

Share this post


Link to post

This is genius.

well done to you, this is something I will definitely use. I get the feeling this will be a big thing once more features are implemented making gzdoom obsolete in my opinion.

Share this post


Link to post

This is really cool, and I would love to use it if possible (that way I don't have to use the very unfinished Probuilder by Unity Technologies anymore), but there's only one problem... The files I copied over have errors. I simply copied over everything from the package, but even on a brand new project, it still broke. Could you help? I'm much better with coding stuff than taking the time to build everything...

Share this post


Link to post

Hey Risto I'm trying to use this to incorporate VR into the original doom games.  I've got a project going and have hand/head tracking working correctly and the gun positioned at the hand and camera facing, but I'm having issues understanding your firing mechanism.

 

public virtual bool Fire()

{

return false;

}

 

I'm honestly trying to figure out why in the world you would ever do this, I'm sure it has something to do with the internals.  I need to recode the fire mechanism to fire in the direction of the hand, then I should be able to get a proper VR build.  I was looking for an AddListener line, but didn't find anything.

 

Thanks for your help.

Share this post


Link to post

A virtual function exists to be overridden by a class that inherets from the one that defined it, so you should look for a child class of the one that function is defined in.

Share this post


Link to post

Thanks jmickle, I found the actual function in the individual weapons, but the multiple camera setup seems to be throwing off any rotation I grab from the VR objects, and it seems to have several scripts that constantly change things to a value from several locations which just keeps undoing anything I try to do.

 

I don't have time to figure out the ins and outs of this setup with my other projects unfortunately, I thought this would be fairly straight forward, but it seems they've coded everything to attempt to match doom as close as possible and avoided common unity features.

 

If anyone else feels like going at it, doomloader is very fleshed out and this should be near trivial to integrate with steamvr once you understand the system.

Edited by Carocrazy132

Share this post


Link to post
On 7/3/2018 at 11:06 AM, Carocrazy132 said:

Thanks jmickle, I found the actual function in the individual weapons, but the multiple camera setup seems to be throwing off any rotation I grab from the VR objects, and it seems to have several scripts that constantly change things to a value from several locations which just keeps undoing anything I try to do.

 

I don't have time to figure out the ins and outs of this setup with my other projects unfortunately, I thought this would be fairly straight forward, but it seems they've coded everything to attempt to match doom as close as possible and avoided common unity features.

 

If anyone else feels like going at it, doomloader is very fleshed out and this should be near trivial to integrate with steamvr once you understand the system.

 

Look into VRTK if you have not done so already. It should help with the rotation issues :)

Share this post


Link to post

Hi, sorry for not reading this topic for a while.

My job really got to me during late winter and I didn't had the energy to finish up the shareware campaign.

I also started to look into making the meshes into the ProBuilder format the Unity now ships with.

that way people can load their old doom maps and continue editing them.

 

I'm working on the project again and I hope to have full shareware Doom done this week (without options or load/save yet).

The new version might differ a bit from what I last posted, but I will take this project as a weekend hobby now and try to be more consistent.

 

Will setup a website and continue publicize there this week, I will post information here once I have the site up and running.

Share this post


Link to post
On 7/3/2018 at 8:06 PM, Carocrazy132 said:

Thanks jmickle, I found the actual function in the individual weapons, but the multiple camera setup seems to be throwing off any rotation I grab from the VR objects, and it seems to have several scripts that constantly change things to a value from several locations which just keeps undoing anything I try to do.

 

Multiple cameras are mostly to get the skybox working with how Doom would, it can be crunched down to a single camera, but certain areas (the outside area for E1M1 for example) will not look correct.

 

The weapon sprite placement was a huge trial and error to get it not clip into walls, get light correctly from player position, while being easily movable per-frame.

 

I can look into making a simpler setup where the weapon can be positioned more intuitively.

If you are still interested we can be in contact and iron out the issues together.

Share this post


Link to post
On 7/23/2018 at 1:20 PM, Risto Paasivirta said:

The weapon sprite placement was a huge trial and error to get it not clip into walls, get light correctly from player position, while being easily movable per-frame.

Hi! As far i know it's most people usess second camera with custom depth buffer. I can help with any work.

Share this post


Link to post

That's a nice idea. Knew about this method, but didn't want to go there. Gonna try it out, would love not having to work with so many decimal places to position the weapon sprites.

 

Soon....

 

All maps are done and working correctly. I will clean up the codebase, document and comment as much as possible.

Share this post


Link to post

Here you go: DoomLoader_v4.zip

The increased filesize is mostly due to music

  •    You can now fully play shareware Doom1 inside Unity!  
  •    Added rest of the map linedefs from Doom shareware campaign
  •    Optimized linedef and sector controllers to use common formats and reduced ticking
  •    Fixed a lot of the linedef behavior in fringe/niche cases, looking at you E1M7 pillar of doom
  •    There is now PlayerDamageReceive variable in GameManager to make the game easier (doesn't affect nukage)
  •    Presynthesized music
  •    Added Baron of Hell
  •    Made a bytereader class to reduce repetition of code when reading raw wad data
  •    Flipped the V coordinate of floors and ceilings, they should be correct now (E1M8 teleporter)
  •    There is a modified OBJ exporter script that takes material names from textures used correctly
  •    Fixed oneshot door keycards being in wrong order
  •    There are couple hardcoded parts to fix bugs in maps or to enable old hardcoded behavior (eg. sector tag 666)
  •    Commented a lot of the code

   Missing Features:
   Menus
   Save/Load
   Minimap
   Powerups
   Monster infighting (monsters can damage each other, but they don't aggro)
   Gibbing

 

   Known bugs:
   Teleporters can place player too close to walls/ledges

   Corpses on dynamic sectors might stay hanging in the air
   Walking between things might push you on top of them
   AI sometimes walks off the ledges unintentionally
   Monsters are unable to walk through certain areas, such as a keycard door that is open. This is very noticeable with the pink demons, but applies to all. The reason for this is that heatmap doesn't get updated, or the original calculations were not good enough.

Share this post


Link to post

@Risto Paasivirta this is an amazing piece of work, really really impressive.

 

This work deserves a much wider audience.

 

Can you put it on GitHub?

 

That’d make it easier to get the word out in the Unity community too. I think if the source were in a public place you’d find others want to contribute to it.

Share this post


Link to post

Would it not make more sense to have weapons as GUI objects since they are just 2d sprites? That way you wouldn't need to worry about wall clipping. Or would there be issues with weapon bobbing if you did it that way?

Share this post


Link to post

I'd also love seeing in on github. I've just made it able to load original skies from WAD file, but without it being on repo, there is no good place to fork it and maybe submit pull request :3

image.png.57241c60d23ffdb1931d89f3484bd465.png

 

 

Share this post


Link to post

I signed up on the forums today as I really wanted to dive back into this old post to say a massive thank you for building this project out with all the components that you did. I am a Unity developer and Doom fan and wanted to make a small Doom-related project using technology I am familiar with and this gave me such a strong base to build on. After a couple of months of work in my spare time I was able to make a game called Doom Drone that looks at what might happen after the action of Doom ends and how the cleanup might occur. Here is a link to the itch page if you are interested :)

Download: https://verbvirus.itch.io/doom-drone
 

ItchScreenShot1.png

ItchScreenShot2.png

ItchScreenShot3.png

Share this post


Link to post

Interesting concept, to the point that I think someone could actually make it work in the Doom engine itself (or at least, something like GZDoom).

 

Few things I noticed:

  1. Typo in one of the descriptions ("form" when it should be "from")
  2. Was only able to find 97% of stuff to clean. Scoured the whole level for that last thing and never found it (and yes, I did get up into the secret lift for the armor bonus).
  3. For some reason couldn't clean the puddles of blood, ever.

Mouse aiming and strafing would definitely make it not take 15 minutes to play, either. :P

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×