Comments (6)
Specific applications like that are sort of outside the scope of this project, sorry.
If you want to generate random Doom maps you may be interested in Oblige instead.
from omgifol.
@devinacker
Thanks for your advice.
Actually, I also use this project to add random walls in the given layout.
I first use doom-builder to draw a map, and then use this project to add walls inside the map.
I use
a = ZLinedef(vx_a = fp, vx_b = sp, front=4, back=4, flags=1)
a.block_all = True
a.impassable = True
a.two_sided = True
a.invisible = False
a.shown = True
a.flags = 1
to make a line. fp and sp are the id of vertex.
Then, map_editor.linedefs.extend(a)
and put the line in the map and reconstruct the map.
The problem I encounter is that the line I added is not impassable. The agent can pass through this wall in the game.
Could you help me with this? Thank you very much
from omgifol.
If you're using the named flags (such as impassable
, two_sided
, etc.) then you don't need to update flags
yourself - it'll be modified automatically. For example:
a.block_all = True
a.impassable = True
a.two_sided = True
At this point, a.flags
will have all three of those flags set. If you set it to a different value later, some properties of the line may be erased. Try adding the line without directly modifying flags
and see if that works.
from omgifol.
@devinacker
Thanks very much. But it does not work.
My code of generating map:
`
from omg import *
import random
for map in range(1,20):
wad = omg.WAD('hexen_square_7by5.wad')
map_editor = omg.MapEditor(wad.maps['MAP01'])
v=[]
l=[]
height = 7
width = 5
for i in range(0,height+1):
for j in range(0,width+1):
if i==0 and j==0:
continue
if i == 0 and j == width:
continue
if i == height and j == 0:
continue
if i==height and j == width:
continue
tmp = Vertex()
tmp.x = 64*i
tmp.y = 64*j
v.append(tmp)
map_editor.vertexes.extend(v)
sidedef = Sidedef()
sidedef.tx_mid = 'BIGBRIK1'
map_editor.sidedefs.append(sidedef)
for i in range(random.randint(10,20)):
fp = random.randint(width+3,height*width+height+1)
sps = []
ten = fp/(width+1)
one = fp%(width+1)
for j in range(-1,2):
if j == 0:
continue
if one <2:
low = (ten-1)*(width+1)+2
up = ten*(width+1)+1
if fp+j>=max(low,width+3) and fp+j<=min(height*width+height+1,up):
sps.append(fp+j)
else:
low = ten*(width+1)+2
up = ten*(width+1)+width+2
if fp+j>=max(low,width+3) and fp+j<=min(height*width+height+1,up):
sps.append(fp+j)
if map_editor.vertexes[fp].y != 0 and map_editor.vertexes[fp].y != 64*width:
for j in range(-1*(width+1),2*(width+1),(width+1)):
if j == 0:
continue
if fp + j >= width + 3 and fp + j <= height * width + height + 1:
sps.append(fp+j)
#a.vx_b = random.choice(sps)
sp = random.choice(sps)
a = ZLinedef(vx_a = fp, vx_b = sp, front=4, back=4)
a.block_all = True
a.impassable = True
a.two_sided = True
l.append(a)
map_editor.linedefs.extend(l)
outwad = WAD()
outwad.maps['MAP01']=map_editor.to_lumps()
outwad.to_file('wads_5by7_0219/map'+str(map)+'.wad')
print 'map'+str(map)+' done'`
Then, I use vizdoom to see the map and find out the wall can still be passed through. The map used in the code (hexen_square_7by5.wad) is a square map with only four boundary walls. The aim is to add random walls in this given square map.
Thank you in advance.
from omgifol.
The reason your new lines from this script aren't working is because they aren't part of the original map's BSP data, which is not modified. (If you look at the ZDoom console after loading the generated map, you can see an error related to this)
There are a few easy things you can do:
- Do something like
map_editor.nodes = []
before saving the new WAD - this will force ZDoom to rebuild a new BSP tree when the map is loaded - Use an external node builder such as ZenNode or ZDBSP to generate new BSP data
- Open the new map in an editor such as Doom Builder and save it again
In the future, I may make the MapEditor class remove old BSP data automatically so that ports such as ZDoom will regenerate it on its own.
from omgifol.
Thank you very much for your time and helpful advices.
Looking forward to your next version:)
from omgifol.
Related Issues (20)
- tall patches
- Graphic.to_Image() doesn't support transparency HOT 2
- TextureDef.to_Image()
- Replace structs with classes? HOT 4
- use standard data sizes in Graphic.to_raw
- PNAMES entries not being stripped correctly in py3
- omg.WAD should support reading from read-only WAD files. HOT 1
- Discrepancy between same map data pre-and-post to_lumps HOT 4
- mirror.py demo script has issues saving certain maps HOT 5
- ACS script is not written into the new wad file HOT 3
- UDMF support HOT 1
- pk3 file support HOT 1
- Potential PK3 Support HOT 1
- inconsistent api for creating lumps from various classes HOT 3
- complains about missing SECTORS lump, but it's there HOT 4
- How to set started location and goal? HOT 1
- omg.WAD placing lumps in wrong groups with missing end markers
- please add support for Heretic/Hexen raw screen graphics
- Textures chokes on STRIFE1.WAD
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from omgifol.