Programm hackt am Anfang

Übersicht BlitzBasic Blitz3D

Neue Antwort erstellen

Surat

Betreff: Programm hackt am Anfang

BeitragSo, März 12, 2006 12:49
Antworten mit Zitat
Benutzer-Profile anzeigen
Hi!
Irgendwas stimmt mit dem Quellcode nicht. Ich habe meine Schule
eingermaßen virtuell nachgebaut und man kann mit einer Kugel
durchfliegen. Ich habe auch schon Kollision eingebaut.
Sobald ich auf "a" oder "y" drücke (um vorwärts bzw. rückwärts zu
kommen) dann hakt das Programm erstmal 10 Sekunden und geht dann erst normal weiter.

Ich bin für jede Hilfe dankbar Wink



Hier der Code:



Graphics3D 640,480

SetBuffer BackBuffer()

AmbientLight 255,255,255
Global spieler=CreateSphere(30)
Global camera=CreateCamera(spieler)

figur=LoadMesh("figur1.3ds")
ex=LoadMesh("6SHOOTER.3ds")
stuhl=LoadMesh("CHAIR03.3ds")
Cobra=LoadAnimMesh("COBRA.3ds")

sound=LoadSound("loop3.wav")

Global wand1=CreateCube()
Global wand2=CreateCube()
Global wand3=CreateCube()
Global wand4=CreateCube()
Global wand5=CreateCube()
Global wand6=CreateCube()
Global wand7=CreateCube()
Global wand8=CreateCube()
Global wand9=CreateCube()
Global wand10=CreateCube()
Global wand11=CreateCube()
Global wand12=CreateCube()
Global wand13=CreateCube()
Global wand14=CreateCube()
Global wand15=CreateCube()
Global wand16=CreateCube()
Global wand17=CreateCube()
Global wand18=CreateCube()
Global wand19=CreateCube()
Global wand20=CreateCube()
Global wand21=CreateCube()
Global wand22=CreateCube()
Global wand23=CreateCube()
Global wand24=CreateCube()
Global wand25=CreateCube()
Global wand26=CreateCube()
Global wand27=CreateCube()
Global wand28=CreateCube()
Global wand29=CreateCube()
Global wand30=CreateCube()
Global wand31=CreateCube()
Global wand32=CreateCube()
Global wand33=CreateCube()
Global wand34=CreateCube()
Global wand35=CreateCube()
Global wand36=CreateCube()
Global wand37=CreateCube()
Global wand38=CreateCube()
Global wand39=CreateCube()
Global wand40=CreateCube()
Global wand41=CreateCube()








PositionEntity spieler, 16,8,5
PositionEntity camera,0,2,-8
PositionEntity wand1,0,4,50
PositionEntity wand2,20,4,70
PositionEntity wand3,40,4,50
PositionEntity wand4,20,49,30
PositionEntity wand5,7,4,30
PositionEntity wand6,33,4,30
PositionEntity wand7,19,85,50
PositionEntity wand8,20,0,49
PositionEntity figur,17,1,40
PositionEntity wand9,2,2,2
PositionEntity wand10,40,2,2
PositionEntity wand11,20,40,2
PositionEntity wand12,21,49,-25
PositionEntity wand13,10,4,-25
PositionEntity wand14,34,4,-25
PositionEntity wand15,40,49,-45
PositionEntity wand16,2,4,-45
PositionEntity wand17,20,49,-64
PositionEntity wand18,34,4,-64
PositionEntity wand19,10,4,-64
PositionEntity wand20,20,85,-45
PositionEntity wand21,40,4,-33
PositionEntity wand22,40,4,-57
PositionEntity wand23,70,4,-64
PositionEntity wand24,70,4,-25
PositionEntity wand25,109,49,-45
PositionEntity wand26,109,4,-32
PositionEntity wand27,109,4,-58
PositionEntity wand28,74,39,-44
PositionEntity wand29,128,24,-64
PositionEntity wand30,147,49,-45
PositionEntity wand31,147,4,-58
PositionEntity wand32,147,4,-32
PositionEntity wand33,128,49,-26
PositionEntity wand34,140,4,-26
PositionEntity wand35,115,4,-26
PositionEntity wand36,128,85,-45
PositionEntity wand37,110,19,-14
PositionEntity wand38,110,25,3
PositionEntity wand39,110,19,19
PositionEntity wand40,145,19,0
PositionEntity wand41,126,39,2
PositionEntity ex,17.5,9,16.5
PositionEntity stuhl,9,10,16.5
PositionEntity Cobra,29,82,50


ScaleEntity wand1,1,80,20
ScaleEntity wand2,20,80,1
ScaleEntity wand3,1,80,20
ScaleEntity wand4,20,35,1
ScaleEntity wand5,7,10,1
ScaleEntity wand6,7,10,1
ScaleEntity wand7,20,1,20
ScaleEntity wand8,20,1,20
ScaleEntity figur,15,15,15
ScaleEntity wand9,1,40,28
ScaleEntity wand10,1,40,28
ScaleEntity wand11,20,1,28
ScaleEntity wand12,20,35,1
ScaleEntity wand13,7,10,1
ScaleEntity wand14,7,10,1
ScaleEntity wand15,1,35,20
ScaleEntity wand16,1,80,20
ScaleEntity wand17,20,35,1
ScaleEntity wand18,7,10,1
ScaleEntity wand19,7,10,1
ScaleEntity wand20,20,1,20
ScaleEntity wand21,1,10,7
ScaleEntity wand22,1,10,7
ScaleEntity wand23,40,35,1
ScaleEntity wand24,40,35,1
ScaleEntity wand24,40,35,1
ScaleEntity wand25,1,35,20
ScaleEntity wand26,1,10,7
ScaleEntity wand27,1,10,7
ScaleEntity wand28,35,1,21
ScaleEntity wand29,20,60,1
ScaleEntity wand30,1,35,20
ScaleEntity wand31,1,10,7
ScaleEntity wand32,1,10,7
ScaleEntity wand33,20,35,1
ScaleEntity wand34,7,10,1
ScaleEntity wand35,7,10,1
ScaleEntity wand36,20,1,20
ScaleEntity wand37,1,20,10
ScaleEntity wand38,1,14,7
ScaleEntity wand39,1,20,10
ScaleEntity wand40,1,20,27
ScaleEntity wand41,20,1,27
ScaleEntity ex,0.005,0.005,0.005
ScaleEntity stuhl,0.02,0.02,0.02
ScaleEntity Cobra,0.2,0.2,0.2


RotateEntity ex,0,90,0


EntityType spieler,1
EntityType wand1,2
EntityType wand2,2
EntityType wand3,2
EntityType wand4,2
EntityType wand5,2
EntityType wand6,2
EntityType wand7,2
EntityType wand8,2
EntityType wand9,2
EntityType wand10,2
EntityType wand11,2
EntityType wand12,2
EntityType wand13,2
EntityType wand14,2
EntityType wand15,2
EntityType wand16,2
EntityType wand17,2
EntityType wand18,2
EntityType wand19,2
EntityType wand20,2
EntityType wand21,2
EntityType wand22,2
EntityType wand23,2
EntityType wand24,2
EntityType wand25,2
EntityType wand26,2
EntityType wand27,2
EntityType wand28,2
EntityType wand29,2
EntityType wand30,2
EntityType wand31,2
EntityType wand32,2
EntityType wand33,2
EntityType wand34,2
EntityType wand35,2
EntityType wand36,2
EntityType wand37,2
EntityType wand38,2
EntityType wand39,2
EntityType wand40,2
EntityType wand41,2

EntityType figur,2

EntityType stuhl,2
EntityType Cobra,2

EntityRadius spieler,1



light=CreateLight()
PositionEntity light,0,0,5
textur=LoadTexture("steine003.jpg")
textur2=LoadTexture("feuer002.jpg")
textur3=LoadTexture("tex011.jpg")
textur4=LoadTexture("greygrass.bmp")
textur5=LoadTexture("wolken001.jpg")
textur6=LoadTexture("holz009.jpg")
EntityTexture spieler,textur2
EntityTexture wand1,textur3
EntityTexture wand2,textur3
EntityTexture wand3,textur3
EntityTexture wand4,textur3
EntityTexture wand5,textur3
EntityTexture wand6,textur3
EntityTexture wand7,textur4
EntityTexture wand8,textur3
EntityTexture wand9,textur3
EntityTexture wand10,textur3
EntityTexture wand11,textur4
EntityTexture wand12,textur3
EntityTexture wand13,textur3
EntityTexture wand14,textur3
EntityTexture wand15,textur3
EntityTexture wand16,textur3
EntityTexture wand17,textur3
EntityTexture wand18,textur3
EntityTexture wand19,textur3
EntityTexture wand20,textur4
EntityTexture wand21,textur3
EntityTexture wand22,textur3
EntityTexture wand23,textur3
EntityTexture wand24,textur3
EntityTexture wand25,textur3
EntityTexture wand26,textur3
EntityTexture wand27,textur3
EntityTexture wand28,textur4
EntityTexture wand29,textur3
EntityTexture wand30,textur3
EntityTexture wand31,textur3
EntityTexture wand32,textur3
EntityTexture wand33,textur3
EntityTexture wand34,textur3
EntityTexture wand35,textur3
EntityTexture wand36,textur4
EntityTexture wand37,textur3
EntityTexture wand38,textur3
EntityTexture wand39,textur3
EntityTexture wand40,textur3
EntityTexture wand41,textur4



EntityTexture stuhl,textur6



boden=CreatePlane()
EntityType boden,2
himmel=CreatePlane()
EntityTexture boden,textur
EntityTexture himmel,textur5

PositionEntity boden,0,0,0

PositionEntity himmel,0,120,0
RotateEntity himmel,0,0,180
PositionEntity light,0,0,5

LoopSound sound
PlaySound sound
While Not KeyHit(1)


If KeyDown(200) Then TurnEntity spieler, 1, 0, 0
If KeyDown(208) Then TurnEntity spieler, -1, 0, 0
If KeyDown(203) Then TurnEntity spieler, 0, 1, 0
If KeyDown(205) Then TurnEntity spieler, 0, -1, 0
If KeyDown(30) Then MoveEntity spieler, 0, 0, 0.3
If KeyDown(44) Then MoveEntity spieler ,0, 0, -0.3

Collisions 1,2,2,2

WireFrame(0)

UpdateWorld

RenderWorld

Flip
Wend
"DER GRÖßTE FEIND IST IN DEN EIGENEN REIHEN" (Trygonia-Xen's Quest)

AZUON-Beyond the dark life (2%)
SOULS OF DESTINY (23%)

TheProgrammer

BeitragSo, März 12, 2006 13:47
Antworten mit Zitat
Benutzer-Profile anzeigen
Shocked Benutz für deine Maps lieber einzelne Meshs, die du mit Milkshape oder CartographyShop erstellt hast. Das Problem sind nämlich diese vielen einzelnen Cubes... Wenn du für deine Map nur einen Mesh verwendest, sollte es besser laufen.
aktuelles Projekt: The last day of human being

skey-z

BeitragSo, März 12, 2006 13:48
Antworten mit Zitat
Benutzer-Profile anzeigen
sagen dir die begriffe Array(zb Dim wand(20)) und for/next schleife etwas, das würde den code um einiges brauchbarer machen

Pseudocode:
Code: [AUSKLAPPEN]

dim wand(20)

for i= 0 to 21
   wand(i) = createcube()
   positionentity wand(i), x, y, z
   rotateentity wand(i), x, y, z
   scaleentity wand(i), x, y, z
   textureentity wand(i), textur
next


somit hast du ca. 100 codezeilen gespart, für die positionen, rotation, scalierung und textur kannst du dann auf ein Datafeld zurückgreifen, was dann immer noch kürzer ist als dein code und vor allem übersichtlicher.

um das Problem mit dem hacken in den griff zu bekommen, schau dir mal in der Onlinehilfe den Befehl Addmesh an.
Awards:
Coffee's Monatswettbewerb Feb. 08: 1. Platz
BAC#57: 2. Platz
Twitter

darth

Betreff: ..

BeitragSo, März 12, 2006 14:01
Antworten mit Zitat
Benutzer-Profile anzeigen
omg :O
ich würde die mesh (schulhaus) ausserhalb bauen, und dann als ganzes laden, so wie du das machst ist das unübersichtlich.
falls du doch so arbeiten möchtest (oder musst), dann empfehle ich dir immerhin einen array für die wände zu nehmen und gewisse dinge (z.b. das ganze erstellen) in schleifen zu tun.

was deine frage angeht:
bei mir geht der code ohne probleme,
da ich allerdings die geladenen meshs (zb figur) durch kugeln ersetzt und den sound ganz weggelassen habe, könnte da noch ein problem stecken.
vielleicht hat deine figur zu viele vertices und das bewegen braucht enorme speicherkapazität? ...

EDIT:
meine fresse war ich langsam :S
Diese Signatur ist leer.

Surat

BeitragSo, März 12, 2006 17:00
Antworten mit Zitat
Benutzer-Profile anzeigen
Danke für die Antworten! Very Happy

Dann erstelle ich die Schule einfach vorher. Mit Addmesh kann ich
die Blöcke ja dann zusammenfügen.
"DER GRÖßTE FEIND IST IN DEN EIGENEN REIHEN" (Trygonia-Xen's Quest)

AZUON-Beyond the dark life (2%)
SOULS OF DESTINY (23%)

Neue Antwort erstellen


Übersicht BlitzBasic Blitz3D

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group