61
Clan Discussion / Re: [BLC] Blockland Classics - Block Wars back on YouTube!
« on: May 02, 2017, 08:30:52 PM »
Ayy lmao!
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
You can put tons of convex meshes in a single dts for collision.See, I tried that. I edited Tendon's script to put 60 collision meshes in each dts but the collision still didn't work :/
Thing is, bl takes like 10 minutes to download those 8MB.Yeah, gotcha.
It's unbelievably slow for files not on the CDN.
import bpy
import os
def get_override(area_type, region_type):
for area in bpy.context.screen.areas:
if area.type == area_type:
for region in area.regions:
if region.type == region_type:
override = {'area': area, 'region': region}
return override
#error message if the area or region wasn't found
raise RuntimeError("Wasn't able to find", region_type," in area ", area_type,
"\n Make sure it's open while executing script.")
#we need to override the context of our operator
override = get_override( 'VIEW_3D', 'WINDOW' )
#override is for resizing an object by the median center of it's vertices. It's not needed here, but maybe in the future.
def dodtloveports(exportpath,blpath):
#setup script files
if os.path.exists(exportpath + 'server.cs') == False:
textserver = open(exportpath + 'server.cs', "w")
textserver.write("exec(\"./data.cs\");")
textserver.close()
if os.path.exists(exportpath + 'description.txt') == False:
textdesc = open(exportpath + 'description.txt', "w")
textdesc.write("Title: MAPNAME\n")
textdesc.write("Author: NOT AVAILABLE\n")
textdesc.write("THIS FILE WAS AUTOGENERATED\n")
textdesc.close()
textdata = open(exportpath + 'data.cs', "w")
textdata.write("package LoadMapPackage\n")
textdata.write("{\n")
textdata.write("\tfunction GameConnection::startLoad(%client)\n")
textdata.write("\t{\n")
textdata.write("\t\tif(!isObject(\"MapGroup\"))\n")
textdata.write("\t\t{\n")
textdata.write("\t\t\texec(\"" + blpath + "place.cs\");\n")
textdata.write("\t\t\tMissionCleanup.add(\"MapGroup\");\n")
textdata.write("\t\t}\n")
textdata.write("\t\tParent::startLoad(%client);\n")
textdata.write("\t}\n")
textdata.write("};\n")
textdata.write("activatepackage(LoadMapPackage);\n\n")
textplace = open(exportpath + 'place.cs', "w")
textplace.write("new SimGroup(MapGroup)\n")
textplace.write("{\n")
#export detail32
if bpy.data.groups.get("detail32") is not None:
objects = bpy.data.groups['detail32'].objects
for object in objects:
bpy.ops.object.select_all(action='DESELECT')
object.select = True
bpy.ops.object.duplicate(linked=False,mode='DUMMY')
dupe = bpy.context.selected_objects[0]
dupe.name = "DETTEMPSHAPE"
bpy.context.scene.objects.active = dupe
bpy.ops.transform.translate(value=dupe.location*-1)
bpy.ops.object.transform_apply(location=True,scale=True,rotation=True)
bpy.ops.export_scene.dts(filepath=exportpath + "shapes\\" + object.name + ".dts",select_object=True)
textdata.write("datablock staticShapeData(SS" + object.name.replace(".","DOT") + "Data)\n")
textdata.write("{\n")
textdata.write("\tshapefile = \"" + blpath + "shapes/" + object.name + ".dts\";\n")
textdata.write("};\n")
textplace.write("\tnew StaticShape(\"SS" + object.name.replace(".","DOT") + "\")\n")
textplace.write("\t{\n")
textplace.write("\t\tposition = \"" + "%.6f" % object.location[0] + " " + "%.6f" % object.location[1] + " " + "%.6f" % object.location[2] + "\";\n")
textplace.write("\t\trotation = \"1 0 0 0\";\n")
textplace.write("\t\tscale = \"1 1 1\";\n")
textplace.write("\t\tdataBlock = \"SS" + object.name.replace(".","DOT") + "Data\";\n")
textplace.write("\t\tcansetIFLS = \"0\";\n")
textplace.write("\t};\n")
bpy.ops.object.delete(use_global=False)
else:
print("detail32 group not found. No visible meshes to export.")
#export collision-1
if bpy.data.groups.get("Collision-1") is not None:
#create NULL SHAPE for detail32 layer of collision objects.
bpy.ops.object.select_all(action='DESELECT')
scene = bpy.context.scene
me = bpy.data.meshes.new("NULLTEMPSHAPE")
me.vertices.add(1)
nullob = bpy.data.objects.new("NULLTEMPSHAPE", me)
nullob.location = (0,0,0)
nullob.select = True
scene.objects.link(nullob)
scene.objects.active = nullob
scene.update()
if bpy.data.groups.get("detail32") is not None:
bpy.ops.object.group_link(group='detail32')
else:
bpy.ops.object.group_add()
nullob.users_group[0].name = "detail32"
objects = bpy.data.groups['Collision-1'].objects
counter = 0;
for object in objects:
if object != nullob:
if counter == 0:
# First Time
if not 'ColGroup' in bpy.data.groups:
bpy.ops.group.create(name="ColGroup")
counter = counter + 1
#otherwise do the other stuff
bpy.ops.object.select_all(action='DESELECT')
object.select = True
bpy.ops.object.duplicate(linked=False,mode='DUMMY')
dupe = bpy.context.selected_objects[0]
dupe.name = "COLTEMPSHAPE"
bpy.context.scene.objects.active = dupe
bpy.ops.transform.translate(value=dupe.location*-1)
bpy.ops.transform.resize(value=(2,2,2))
bpy.ops.object.transform_apply(location=True,scale=True,rotation=True)
bpy.ops.object.group_link(group="ColGroup")
if counter > 60:
#export everything
bpy.ops.object.select_all(action='DESELECT')
exportObjects = bpy.data.groups['ColGroup'].objects
for exportObject in exportObjects:
exportObject.select = True
bpy.ops.export_scene.dts(filepath=exportpath + "shapes\\" + object.name + ".dts",select_object=True)
textdata.write("datablock staticShapeData(SS" + object.name.replace(".","DOT") + "Data)\n")
textdata.write("{\n")
textdata.write("\tshapefile = \"" + blpath + "shapes/" + object.name + ".dts\";\n")
textdata.write("};\n")
textplace.write("\tnew TSStatic(\"TSS" + object.name.replace(".","DOT") + "\")\n")
textplace.write("\t{\n")
textplace.write("\t\tposition = \"" + "%.6f" % object.location[0] + " " + "%.6f" % object.location[1] + " " + "%.6f" % object.location[2] + "\";\n")
textplace.write("\t\trotation = \"1 0 0 0\";\n")
textplace.write("\t\tscale = \"0.5 0.5 0.5\";\n")
textplace.write("\t\tshapename = \"" + blpath + "shapes/" + object.name + ".dts\";\n")
textplace.write("\t};\n")
counter = 0
bpy.ops.object.delete(use_global=False)
nullob.select = True
bpy.ops.object.delete(use_global=False)
else:
print("Collision-1 group not found. No collision meshes to export.")
#close script files
textdata.close()
textplace.write("};")
textplace.close()
dodtloveports('C:/Program Files (x86)/Steam/SteamApps/common/Blockland/Add-Ons/Map_TheSlopesv21/',"Add-Ons/Map_TheSlopesv21/")
Merge multiple dts files into one, each with it's own node name.For static shapes, won't this break collision?
Then use static shapes and call the node functions on it.
Well all the server to client loading is probably handled in the engine. i'm sure someone could write a DLL that could achieve what you want, but at the same time its probably going to take a while just to download multiple DTS files anywaysThats ok! The other option is to create a client that people download, which would be faster than dling ingane anyway.
I may be wrong, but I think there can only be one instance of shape, shapename or shapefile in a tsstaticYeah only one per tsstatic. I want players to be able to download the shape files without it taking all the datablocks in the server.
Seeing the reactions earlier, I have to give props to Scout, atleast someone is trying to get a proper replacement to RTB and RTB Hosting completely freely, but I feel like some of the comments bashes his head too much, yes issues happen but since we can be too harsh as a community when new contents are made some modders leaves and just gives up, I just hope it won't happen this time, anyway thanks Scout and your group for providing us Blockland Glass, I really appreciate the improvements being done recently and I can tell it can only get better with timeThis so much. What you're doing for the community is amazing. I hope you don't burn yourself out.