CharacterCreator Thread

Blitz3D Forums/Blitz3D Programming/CharacterCreator Thread

Guy Fawkes(Posted 2009) [#1]
Hi all. As Warner suggested,

I have created an official

CharacterCreator thread.

So I'm having a bit of a problem,

with a pause menu function that

I created.

the prob is its not flipping into view,

the sprite i created for the ui.

here's the function:


Global Panel

While Not KeyHit(1)
Pause()
UpdateWorld
RenderWorld
Flip
Wend

Function Pause()
If KeyHit(28)
Panel = Load_Sprite("Paneladv.png",7,Camera)
Flip
SetSprite(Panel)
Flip
Repeat
final=FadeScreen(min_alp#, max_alp#, min_lig#, max_lig#, fademode, land, test, test2, multiple)
If max_alp# = 0
Delay .01
EndIf
If KeyHit(28)
FreeEntity Panel
Exit
EndIf
Flip
Forever
EndIf
End Function

Function FadeScreen(alpha01#, alpha02#, light01#, light02#, fademode, landfade, objfade, objfade2, multiple)

obj = objfade

obj2 = objfade2

If multiple = 1

For objtest = 1 To 12

For a.hostile = Each hostile

objtest = A\model

obj3 = objtest

Next

Next

EndIf

Local final = 1

fade_001 = fademode

Select fade_001

Case 1


alpha# = alpha# - .002
alpha2# = alpha2# - .2

light# = light# - 1.0

Case 2

alpha# = alpha# + .002
alpha2# = alpha2# + .2

light# = light# + 1.0

Case 001

alpha# = alpha# - .002
alpha2# = alpha2# - .2

light# = light# - 1.0

Case 002

alpha# = alpha# + .002
alpha2# = alpha2# + .2

light# = light# + 1.0

End Select

AmbientLight light#, light#, light#

EntityAlpha obj, alpha#

EntityAlpha obj2, alpha#

If multiple = 1 And obj3 <> 0
EntityAlpha obj3, alpha#

EndIf

If alpha# < alpha01# Then alpha# = alpha01#

If alpha# > alpha02# Then alpha# = alpha02#

If light# < light01# Then light# = light01#

If light# > light02# Then light# = light02#

;If cleared = 1
; ClearWorld()

;EndIf

End Function

Function Load_Sprite(f$,texflag=0,parent)
s = LoadSprite(f$,texflag,parent)
Return s
End Function

Function SetSprite(sprite)
ScaleSprite sprite,spritewidth,spriteheight
PositionEntity sprite,0,0,spritewidth
EntityAlpha sprite,.5
EntityOrder sprite,-1
End Function


~DS~


Guy Fawkes(Posted 2009) [#2]
lol. this thread should technically be

"CharacterCreator/RPG thread",

but w/e..

lol

~DS~


Kryzon(Posted 2009) [#3]
Why did you wrap the LoadSprite function into another equal function?


Guy Fawkes(Posted 2009) [#4]
idk.. its just how i roll.

lol. just imagine i didnt

even do it that way.

ok?

~DS~


Kryzon(Posted 2009) [#5]
Well, you are 'rolling' away from efficiency and optimization.


Guy Fawkes(Posted 2009) [#6]
ugh. fine. ill change it.

lol

NEW CODE:

Global Panel

While Not KeyHit(1)
Pause()
UpdateWorld
RenderWorld
Flip
Wend

Function Pause()
If KeyHit(28)
Panel = LoadSprite("paneladv.png",7,Camera)
ScaleSprite sprite,spritewidth,spriteheight
PositionEntity sprite,0,0,spritewidth
EntityAlpha sprite,.5
EntityOrder sprite,-1
Flip
Repeat
final=FadeScreen(min_alp#, max_alp#, min_lig#, max_lig#, fademode, land, test, test2, multiple)
If max_alp# = 0
Delay .01
EndIf
If KeyHit(28)
FreeEntity Panel
Exit
EndIf
Flip
Forever
EndIf
End Function

Function FadeScreen(alpha01#, alpha02#, light01#, light02#, fademode, landfade, objfade, objfade2, multiple)

obj = objfade

obj2 = objfade2

If multiple = 1

For objtest = 1 To 12

For a.hostile = Each hostile

objtest = A\model

obj3 = objtest

Next

Next

EndIf

Local final = 1

fade_001 = fademode

Select fade_001

Case 1


alpha# = alpha# - .002
alpha2# = alpha2# - .2

light# = light# - 1.0

Case 2

alpha# = alpha# + .002
alpha2# = alpha2# + .2

light# = light# + 1.0

Case 001

alpha# = alpha# - .002
alpha2# = alpha2# - .2

light# = light# - 1.0

Case 002

alpha# = alpha# + .002
alpha2# = alpha2# + .2

light# = light# + 1.0

End Select

AmbientLight light#, light#, light#

EntityAlpha obj, alpha#

EntityAlpha obj2, alpha#

If multiple = 1 And obj3 <> 0
EntityAlpha obj3, alpha#

EndIf

If alpha# < alpha01# Then alpha# = alpha01#

If alpha# > alpha02# Then alpha# = alpha02#

If light# < light01# Then light# = light01#

If light# > light02# Then light# = light02#

;If cleared = 1
; ClearWorld()

;EndIf

End Function



fixed

~DS~


Warner(Posted 2009) [#7]
What is this code supposed to do?


Guy Fawkes(Posted 2009) [#8]
its supposed to pause my game

when i hit enter.

HOWEVER.

WHEN it pauses, its supposed to

fade everything out as if it were invisible.

THEN freeze the frames til u press enter

the 2nd time which exits the repeat :)

~DS~


Warner(Posted 2009) [#9]
So, take it one step at the time. First, pause the game.
How do you pause the game?
If KeyHit(28) Then what?


Guy Fawkes(Posted 2009) [#10]
if keyhit(28)
delay .01
Panel = LoadSprite("paneladv.png",7,Camera)
ScaleSprite sprite,spritewidth,spriteheight
PositionEntity sprite,0,0,spritewidth
EntityAlpha sprite,.5
EntityOrder sprite,-1
endif

load the sprite.
scale the sprite.
place the sprite.
end it


Warner(Posted 2009) [#11]
Atm, I'm working on a different computer, and I can't use b3d, so the bits of code here are not tested. Hopefully it will help.
If you want to pause the game, do it like this:
if keyhit(28) then
    flushkeys()
    repeat
    until keyhit(28)
end if
If enter is clicked, flush the keyboard buffer, then wait until a key is clicked.

Next step: you want to draw the 3d scene:
During this loop, you can still draw the game, using RenderWorld and Flip.
if keyhit(28) then
    flushkeys()
    repeat
      renderworld
      flip
    until keyhit(28)
end if
So now, when enter is clicked, it ends up in the same loop again, with this difference that it renders the 3d world.
Now you want this sprite to fade in. Most likely that will also ensure that the game scene itself fades away. Again, first step: Indeed, load,scale,place sprite:
if keyhit(28)
 
  Panel = LoadSprite("paneladv.png",7,Camera)
  ScaleSprite sprite,spritewidth,spriteheight
  PositionEntity sprite,0,0,spritewidth
  EntityAlpha sprite,.5
  EntityOrder sprite,-1

  FlushKeys()
  Repeat
    RenderWorld
    Flip
  Until Keyhit(28)

  FreeEntity Panel
endif
After the pause loop, clean up the sprite. Or make it global and load it only once, at the start of the program.
Now it should place the sprite in front of the camera, and render it until you click enter.

Finally, gradually fade in the sprite.
EntityAlpha Panel, <..something...>
That something is a number that goes from 0.0 to 1.0.
Let's name that variable fade#
if keyhit(28)
 
  Panel = LoadSprite("paneladv.png",7,Camera)
  ScaleSprite sprite,spritewidth,spriteheight
  PositionEntity sprite,0,0,spritewidth
  EntityOrder sprite,-1

  FlushKeys()
  fade# = 0
  Repeat

    EntityAlpha sprite,fade
    fade = fade + 0.01

    RenderWorld
    Flip
  Until Keyhit(28)

  FreeEntity Panel
endif
It should now start with alpha = 0.0, and then go up with steps of 0.01
I can't try it. If it is too slow, increase "0.01"
When "fade >= 1" it shouldn't go up anymore. Or, the other way around, as long as fade < 1, it should go up:
If fade < 1 Then fade = fade + 0.01
Well, hopefully it all works. As said, can't test it.


Guy Fawkes(Posted 2009) [#12]
it works, but w/ 2 minor faults.

the 1st is when fade reachs 1.0

for some reason, the screen glitches,

like the sprite is repeating itself

over and over and over

the 2nd thing is

i need when i hit enter,

for the 2nd time,

i need the sprite to fade out

and i need it to be frozen (delay)

til fade = 0

code:

If KeyHit(28)
 
  Panel = LoadSprite("paneladv.png",7,Camera)
  ScaleSprite Panel,spritewidth,spriteheight
  PositionEntity Panel,0,0,spritewidth
  EntityOrder Panel,-1

  FlushKeys()
  fade# = 0
  Repeat

    EntityAlpha Panel,fade
    fade = fade + 0.01

If fade < .5 Then fade = fade + 0.01
If fade > .5 Then fade = fade - 0.01

If KeyHit(28) Then fade = fade - 0.01

Text GraphicsWidth()/2,GraphicsHeight()/2,fade

	UpdateWorld
    RenderWorld

    Flip
  Until fade = 0

  FreeEntity Panel
EndIf


~DS~


Flemmonk(Posted 2009) [#13]
I doubt anyone will have enough memory to play your RPG when its finished, or even if they do, it will eventually slow down to a hault.


Warner(Posted 2009) [#14]
You should reconsider this:
   fade = fade + 0.01  ;fade plus one --> +1

If fade < .5 Then fade = fade + 0.01  ;fade plus one --> +1 +1 = 2
If fade > .5 Then fade = fade - 0.01  ;fade minus one --> +1 -1 = 0


edit:
Ow, and this:
Text GraphicsWidth()/2,GraphicsHeight()/2,fade

	UpdateWorld
    RenderWorld

Allways place and 2D drawing commands (such as Text) after RenderWorld. RenderWorld will clear the screen. Otherwise you can't see the text.


Guy Fawkes(Posted 2009) [#15]
Ok Flemmonk. You tell me where I can find a code to measure EXACT FPS, and we'll test that theory of yours.

Because I think it will run just fine after an hour


Guy Fawkes(Posted 2009) [#16]
ok. heres a small fix.

the problem is, it goes up to .5,

but it doesnt come back down to 0,

after hitting enter for the 2nd time.

Function Pause()
If KeyHit(28)
 
  Panel = LoadSprite("paneladv.png",7,Camera)
  ScaleSprite Panel,spritewidth,spriteheight
  PositionEntity Panel,0,0,spritewidth
  EntityOrder Panel,-1

  FlushKeys()
  fade# = 0
  Repeat

    fade = fade + 0.01
    EntityAlpha Panel,fade

If fade < .5 Then fade = fade + 0.01
If fade > .5 Then fade = fade - 0.01

FlushKeys

	UpdateWorld
    RenderWorld

If KeyHit(28) Then fade = fade - 0.01

Text GraphicsWidth()/2,GraphicsHeight()/2,fade

    Flip
  Until fade = 0

  FreeEntity Panel
EndIf
End Function


~DS~


_PJ_(Posted 2009) [#17]
Despite it being rather unconstructive and potentially unnecessary, I think Flemmonk was referring to your poor resource managing draining the RAM and cpu cycles.

Pretty accurate, relative FPS can, however be obtained by the following:

; Top Of Program
Global FPS
Global Frames#
Global CountFrameTime=Millisecs()


;With your Flip statement
Flip
Frametime()
Frames#=Frames#+1.0


; At the end of your program
Function Frametime()
Mil=Millisecs()
Delta=(Mil-CountFrametime)
If (Delta>1000)
CountFrameTime=Mil
PartFrames#=Frames / (Delta-1000)
Delta=Mil
FPS#=(Frames#)
Frames#=PartFrames#
End If
End Function



To return the current FPS, just pass ythe value of " FPS# "


Guy Fawkes(Posted 2009) [#18]
i use an fps code from marks

castle demo that keeps FPS at 60

REGARDLESS of cpu usage.

~DS~


Guy Fawkes(Posted 2009) [#19]
Funny, flemmonk.

according to malice' fps data,

both my characreator AND rpg

are running at 60 - 67 fps

~DS~


Warner(Posted 2009) [#20]
Right, let's look at it again:
   fade = fade + 0.01   <---fade gets bigger 

If fade < .5 Then fade = fade + 0.01  <---fade gets bigger if it is under .5
If fade > .5 Then fade = fade - 0.01  <---fade gets smaller if it is above .5

FlushKeys <---- this should not be here

	UpdateWorld
    RenderWorld

If KeyHit(28) Then fade = fade - 0.01 <------keyhit only responds once

Okay, so there are 4 errors:
1. fade is allways increasing
2. beside that, is is extra increasing when it is below .5
but when it is above .5, the increasing is stopped.
if you first add 0.01 and then substract is again, the result is zero
3. flushkeys .. why is that there? it should only be used once to reset the keyboard buffer if you want to read the same key twice after each other. So it should not be placed in the loop
4. if enter is hit, fade decreases once, so by rapidly clicking enter really fast, you might be able to decrease 'fade' with it. That is, if FlushKeys wouldn't be there.

Instead, think about what you want to achieve, and rebuild it one step at the time:

step 1: --- fade is automatically increasing
fade = fade + 0.01

step 2: --- fade increases only when it is below one
replace the previous line with:
if fade < 1 then fade = fade + 0.01

That is what went wrong, instead of replacing the line, you simply added it. That is not right.

Take a few steps back:
  Repeat

    If fade < 1 Then fade = fade + 0.01
    EntityAlpha Panel,fade

    UpdateWorld
    RenderWorld

    Text GraphicsWidth()/2,GraphicsHeight()/2,fade

    Flip
  Until fade = 0


Then think about why the following doesn't work:
    If fade < 1 Then fade = fade + 0.01
    If fade > 0 Then fade = fade - 0.01


edit:
So instead, use flags. Use this flag to control what fade does.
If flag = 1 then increase fade
If flag = 2 then decrease fade
Before the loop starts, set flag to one.
If "fade" becomes one, or if it is greater than one, set flag to two.
If "fade" becomes zero, or if it is smaller than zero, Exit the loop.


Guy Fawkes(Posted 2009) [#21]
ok. so i went to the maximum level,

and purposely overloaded my character creator with 16 characters.

why? so i could test lag.

there seems to be a hidden problem.

i only get around 10 - 16 fps.

this is in a function incase u guys might not have known.


Dim playertype$(3)
playertype$(0) = "Ninja"
playertype$(1) = "Markio"
playertype$(2) = "Cube"
playertype$(3) = "Sphere"

Dim enemymesh(2)

enemymesh(0) = LoadAnimMesh("media\ninja.b3d")
enemymesh(1) = LoadAnimMesh("markio\mariorun.x")
enemymesh(2) = CreateCube()

For x = 0 To 2
HideEntity enemymesh(x)
Next

If maxblocks <= 0 Then Exit

period=1000/FPS
time=MilliSecs()-period

	Repeat
		elapsed=MilliSecs()-time
	Until elapsed

	;how many 'frames' have elapsed	
	ticks=elapsed/period
	
	;fractional remainder
	tween#=Float(elapsed Mod period)/Float(period)
	
	For k=1 To ticks
		time=time+period
		If k=ticks Then CaptureWorld

If sky1=1 Then PositionEntity sky1,EntityX(player1),EntityY(player1),EntityZ(player1)
If defaultsky=1 Then PositionEntity defaultsky, EntityX(player1),EntityY(player1),EntityZ(player1)

mx = MouseX()
my = MouseY()

old_mouse_x = cur_mouse_x ;this is the line where i define the old variable for mousex()
cur_mouse_x = MouseX() Shr 1 ;this is the new mousex()
mouse_x_delta = cur_mouse_x-old_mouse_x ;this is the current mousex() ;this is what im going to use in the y value of "turnentity player1"
characreate = newchar ;this is the old characreate
newchar = 0 ;this is the new characreate
newfinal = newchar ;this is the value i will use to change characreate to 0 only if you are not mousing over a block.
oldselect = newselect
newselect = 0
newsfinal = newselect

mh = MouseHit(1)
omousedown = newmouse_down
newmouse_down = MouseDown(1)
fmousedown = newmouse_down

If player1 <> 0
	If fmousedown And mayturn = 0
		If mx > ImageWidth(background)
     TurnEntity player1, 0, mouse_x_delta, 0
Else If mx < ImageWidth(background) Or mx > GraphicsWidth()-1
     RotateEntity player1, 0, -180, 0
    	EndIf
	EndIf
EndIf

which=y*2+x

If which < maxblocks

If Not mayturn Then fmousedown = 0
If (which <> 0) And mayturn = 1 Then mayturn = 0

	If mx < 0 Then mx = 0
	If my < 0 Then my = 0
	If mx > GraphicsWidth() Then mx = GraphicsWidth()
	If my > GraphicsHeight() Then my = GraphicsHeight()

EndIf

Next

UpdateWorld
RenderWorld tween#

DrawImage background, origx#+pos_x#, origy#+pos_y#

If mh
	For x = 0 To 1
		For y = 0 To maxblocks
			imx = (0.2 * width) + (0.57 * width * x) + (origx#) + (pos_x#)
			imy = (0.2 * height) + (0.1 * height * y) + (origy#) + (pos_x#)
			If ImageRectOverlap(im, imx,imy,mx,my,1,1)
				which = y * 2 + x
			 If which < maxblocks
				selected = which
				If which <> oldwhich Then
				HideEntity player1
				ShowEntity playermesh(which)
				player1 = playermesh(which)
				   If which = 0 PositionEntity player1,1,0,8
				   If which = 1 PositionEntity player1,1,0,8
				   If which = 2 PositionEntity player1,1,1,8
				   If which = 3 PositionEntity player1,1,1,8
				   If which = 0 Animate player1,1
				   If which = 1 Animate player1,1
					If which = 0 Then ScaleEntity player1, .5,.5,.5 : RotateEntity player1, 0, -180, 0
					If which = 1 Then ScaleEntity player1, .2,.2,.2 : RotateEntity player1, 0, -180, 0
					If which = 2 Then ScaleEntity player1, 1,1,1 : RotateEntity player1, 0, -180, 0
					If which = 3 Then ScaleEntity player1, 1,1,1 : RotateEntity player1, 0, -180, 0
					oldwhich = which
				Else If which = oldwhich
					showbox = 1
				EndIf
			EndIf
		 EndIf
		Next
	Next
EndIf

For x = 0 To 1
    For y = 0 To maxblocks
 which=y*2+x
 If which < maxblocks
     imx = (0.2 * width) + (0.57 * width * x) + (origx#) + (pos_x#)
     imy = (0.2 * height) + (0.1 * height * y) + (origy#) + (pos_y#)
		DrawImage imbg, imx-ImageWidth(imbg) Shr 1, imy-ImageHeight(imbg) Shr 1
        DrawImage im, imx, imy, which
 EndIf
    Next
Next

For x = 0 To 1
For y = 0 To maxblocks
imx = (0.2 * width) + (0.57 * width * x) + (origx#) + (pos_x#)
imy = (0.2 * height) + (0.1 * height * y) + (origy#) + (pos_y#)
which=y*2+x
If which < maxblocks
If (which = selected) Or ImageRectOverlap(im, imx,imy, mx,my,1,1)
characreate = 1
Color 150,150,150
Rect imx-ImageWidth(im) Shr 1, imy-ImageHeight(im) Shr 1, ImageWidth(im), ImageHeight(im), 0
Rect imx-ImageWidth(im) Shr 1+1, imy-ImageHeight(im) Shr 1+1, ImageWidth(im), ImageHeight(im), 0

If which = 0
Color 0,0,0
Text imx-StringWidth(playertype$(0)) Shr 1-1, imy-StringHeight(playertype$(0)) Shr 2-1, playertype$(0)
Color 102,102,255
Text imx-StringWidth(playertype$(0)) Shr 1, imy-StringHeight(playertype$(0)) Shr 2, playertype$(0)
Else If which = 1
Color 0,0,0
Text imx-StringWidth(playertype$(1)) Shr 1-1, imy-StringHeight(playertype$(1)) Shr 2-1, playertype$(1)
Color 68,207,255
Text imx-StringWidth(playertype$(1)) Shr 1, imy-StringHeight(playertype$(1)) Shr 2, playertype$(1)
Else If which = 2
Color 0,0,0
Text imx-StringWidth(playertype$(2)) Shr 1-1, imy-StringHeight(playertype$(2)) Shr 2-1, playertype$(2)
Color 68,207,255
Text imx-StringWidth(playertype$(2)) Shr 1, imy-StringHeight(playertype$(2)) Shr 2, playertype$(2)
Else If which = 3
Color 0,0,0
Text imx-StringWidth(playertype$(3)) Shr 1-1, imy-StringHeight(playertype$(3)) Shr 2-1, playertype$(3)
Color 68,207,255
Text imx-StringWidth(playertype$(3)) Shr 1, imy-StringHeight(playertype$(3)) Shr 2, playertype$(3)
EndIf
EndIf
EndIf
Next
Next

Color 255,255,255
Text GraphicsWidth()/2,GraphicsHeight()/2, "FPS:"+RealFPS#

DrawImage mouseicon, mx, my

Color 0,0,0

		Music_Handler()
		SFX_Handler()
		
Flip

Frametime()
RealFrames#=RealFrames#+1.0

Wend

pmodel = player1

If pmodel = player1

guimode = 0

EndIf

If which = 0 Then ScaleEntity pmodel,.5,.5,.5
If which = 1 Then ScaleEntity pmodel,.2,.2,.2
If which = 2 Then ScaleEntity pmodel,1,1,1
If which = 3 Then ScaleEntity pmodel,1,1,1

FreeEntity temp
FreeEntity sky1
FreeEntity defaultsky
FreeEntity sky1
FreeEntity cam
FreeImage background
FreeImage mouseicon
FreeImage im
FreeImage imbg

ShowPointer

FlushKeys()

Return pmodel


im looking at these 5 lines

    selected = which
    If which <> oldwhich Then
    HideEntity player1 ;ESPECIALLY THIS 1
    ShowEntity playermesh(which)
    player1 = playermesh(which)


how would i load the ORIGINAL model 1st, and THEN free the player1 entity IF AND ONLY IF the user has chosen a different player, and how would i keep "which" as its id?

~DS~


Guy Fawkes(Posted 2009) [#22]
if u cant understand, ill rewrite the question

as usual


Guy Fawkes(Posted 2009) [#23]
right. also, warner,

here's what i have so far for pause:

Function Pause()
If KeyHit(28)
 
  Panel = LoadSprite("paneladv.png",7,Camera)
  ScaleSprite Panel,spritewidth,spriteheight
  PositionEntity Panel,0,0,spritewidth
  EntityOrder Panel,-1

  FlushKeys()
  fade# = 0
  fadeflag = 1

  Repeat

    If fadeflag = 1 Then fade = fade + 0.01
    If fadeflag = 2 Then fade = fade - 0.01

  If fade > 1 Then fade = 1
  If fade < 0 Then fade = 0

  If fade >= 1 Then fadeflag = 1
  If fade <= 0 Then fadeflag = 2

    EntityAlpha Panel,fade

	UpdateWorld
    RenderWorld

Text GraphicsWidth()/2,GraphicsHeight()/2,fade
For p.player=Each player
Text GraphicsWidth()/2,GraphicsHeight()/2+20,p\hp+"/"+p\maxhp
Next

    Flip
  Until fade = 0 Or KeyHit(28) Or KeyHit(1)

  FlushKeys()

  FreeEntity Panel
EndIf
End Function


and DONT tell me it already does,

because it doesnt..

also, how would i stop EVERYTHING from animating, moving, or doing anything else?

repeat seems to not freeze animations..


Guy Fawkes(Posted 2009) [#24]
if i didnt explain good enough,

i can rewrite the question


Guy Fawkes(Posted 2009) [#25]
*bump* o.o


Guy Fawkes(Posted 2009) [#26]
here's a sorta fixed version of the pause function i created.

can someone help me fix the rect so no matter WHAT size the width & height of the screen are, it stays in the same place in the bottom right hand corner of the screen?

Function Pause()
If KeyHit(28)
 
  Panel = LoadSprite("paneladv.png",7,Camera)
  ScaleSprite Panel,spritewidth,spriteheight
  PositionEntity Panel,0,0,spritewidth
  EntityOrder Panel,-1

  FlushKeys()
  fade# = 0
  fadeflag = 1

  Repeat

    If fadeflag = 1 Then fade = fade + 0.01
    If fadeflag = 2 Then fade = fade - 0.01

  If fade > 1 Then fade = 1
  If fade < 0 Then fade = 0

  If fade >= 1 Then fadeflag = 1
  If fade <= 0 Then fadeflag = 2

    EntityAlpha Panel,fade

	UpdateWorld
    RenderWorld

sp_x# = 200
sp_y# = 200

Rect (sp_x#/12)+(0.57)+(GraphicsWidth()-spritewidth-sp_x#/4), (sp_y#/12)+(0.57)+(GraphicsHeight()-spriteheight-sp_y#/4),sp_x#,sp_y#,0

Text GraphicsWidth()/2,GraphicsHeight()/2,fade
For p.player=Each player
Text GraphicsWidth()/2,GraphicsHeight()/2+20,p\hp+"/"+p\maxhp
Next

    Flip
  Until fade = 0 Or KeyHit(28) Or KeyHit(1)

  FlushKeys()

  FreeEntity Panel
EndIf
End Function


no matter what i try, i cant seem to figure out whats making it lag..

~DS~


Warner(Posted 2009) [#27]
Well, close, looks nice.
Have a look at the following:
    If fadeflag = 1 Then fade = fade + 0.01
    If fadeflag = 2 Then fade = fade - 0.01

  If fade > 1 Then fade = 1
  If fade < 0 Then fade = 0

  If fade >= 1 Then fadeflag = 1 ;<---- so when fade reaches one, fadeflag is set to one?
  If fade <= 0 Then fadeflag = 2

Fadeflag one increases 'fade', and fadeflag two decreases it.


Guy Fawkes(Posted 2009) [#28]
ok. i fixed it.

only problem is it goes from 0 to 1 back to 0

WITHOUT the 2nd enter.

i need the 2nd enter, THEN i need it to fade you see?

    If fadeflag = 1 Then fade = fade + 0.01
    If fadeflag = 2 Then fade = fade - 0.01

  If fade > 1 Then fade = 1
  If fade < 0 Then fade = 0

  If fade >= 1 Then fadeflag = 2 ;FIXED
  If fade <= 0 Then fadeflag = 1


~DS~


Guy Fawkes(Posted 2009) [#29]
here's a fix for it.

it ALMOST works.

except if u press enter b4 fade = 1 the stupid thing makes it look like it automatically goes back down to 0.

its supposed to happen ONLY when u press enter 2nd time.

and only after fade = 1

Function Pause()
If KeyHit(28)
FlushKeys()
 
  Panel = LoadSprite("paneladv.png",7,Camera)
  ScaleSprite Panel,spritewidth,spriteheight
  PositionEntity Panel,0,0,spritewidth
  EntityOrder Panel,-1

  fade# = 0
  fadeflag = 1
 pause=1

  Repeat

    If fadeflag = 1 Then fade = fade + .1
    If fadeflag = 2 Then fade = fade - .1

If KeyHit(28) And fadeflag = 1
pause = 0
EndIf

  If fade > 1 Then fade = 1
  If fade < 0 Then fade = 0

  If fade >= 1 And pause = 0 Then fadeflag = 2
  If fade <= 0 Then fadeflag = 1

    EntityAlpha Panel,fade

	UpdateWorld
    RenderWorld

sp_x# = 200
sp_y# = 200

Rect (sp_x#/12)+(0.57)+(GraphicsWidth()-spritewidth-sp_x#/4), (sp_y#/12)+(0.57)+(GraphicsHeight()-spriteheight-sp_y#/4),sp_x#,sp_y#,0

text1=CreateSprite()
Text GraphicsWidth()/2-StringWidth("Paused")/4,10,"Paused"
Text GraphicsWidth()/2,GraphicsHeight()/2,fade
For p.player=Each player
Text GraphicsWidth()/2,GraphicsHeight()/2+20,p\hp+"/"+p\maxhp
Next
ScaleSprite text1,GraphicsWidth()/2-StringWidth("Paused")/4,10
PositionEntity text1,0,0,GraphicsWidth()/2-StringWidth("Paused")/4
EntityOrder text1,-2

    Flip
  Until fade = 0

  FlushKeys()

  FreeEntity Panel
EndIf
End Function


~DS~


Warner(Posted 2009) [#30]
except if u press enter b4 fade = 1 the stupid thing makes it look like it automatically goes back down to 0.
:) Yea, programming is superfun, isnt it? Don't worry, it indeed almost works.
Instead of going from phase 1 to phase 2, do it like this:
phase 1 = increase 'fade', when done phase = 2
phase 2 = wait for enter, when enter is clicked, phase = 3
phase 3 = decrease 'fade', when done, exit loop


Guy Fawkes(Posted 2009) [#31]
yea. royal pain in the butt..

lol


Guy Fawkes(Posted 2009) [#32]
what do u mean by when done, phase = 2..

:S


Warner(Posted 2009) [#33]
Ow, I ment 'fadeflag', not 'phase'


Guy Fawkes(Posted 2009) [#34]
ahhhh ok.

so:

repeat
If fadeflag = 1
fade=fade+0.01
EndIf

If fadeflag = 2
fade = fade-0.01
EndIf

If KeyHit(28)
fadeflag = 2
EndIf
until fade = 0

?

~DS~


Warner(Posted 2009) [#35]
If you do it like that, you can still click key(28), even when fade is not yet one. The idea is to make it so that you can only klik (28) when fade = 1.


Guy Fawkes(Posted 2009) [#36]
warner, i give up. :(

i cant figure it out.

here's my last try:

If fadeflag = 1
fade=fade+0.01
EndIf

If fadeflag = 2
fade = fade-0.01
EndIf

If  fade=1
If KeyHit(28)
fadeflag = 2
EndIf
EndIf



Guy Fawkes(Posted 2009) [#37]
ok.

just forget about the pause thing.

ill ask my friend about it.

thanks anyway..

ok. now the thing my friend WONT be able to help me with i asked once, and i'll ask again as i didnt get a response for it yet..

this 1 i REALLY need to fix. its affecting the entire idea of the character creator..

so.


ok. so i went to the maximum level,

and purposely overloaded my character creator with 16 characters.

why? so i could test lag.

there seems to be a hidden problem.

i only get around 10 - 16 fps.

this is in a function incase u guys might not have known.


Dim playertype$(3)
playertype$(0) = "Ninja"
playertype$(1) = "Markio"
playertype$(2) = "Cube"
playertype$(3) = "Sphere"

Dim enemymesh(2)

enemymesh(0) = LoadAnimMesh("media\ninja.b3d")
enemymesh(1) = LoadAnimMesh("markio\mariorun.x")
enemymesh(2) = CreateCube()

For x = 0 To 2
HideEntity enemymesh(x)
Next

If maxblocks <= 0 Then Exit

period=1000/FPS
time=MilliSecs()-period

	Repeat
		elapsed=MilliSecs()-time
	Until elapsed

	;how many 'frames' have elapsed	
	ticks=elapsed/period
	
	;fractional remainder
	tween#=Float(elapsed Mod period)/Float(period)
	
	For k=1 To ticks
		time=time+period
		If k=ticks Then CaptureWorld

If sky1=1 Then PositionEntity sky1,EntityX(player1),EntityY(player1),EntityZ(player1)
If defaultsky=1 Then PositionEntity defaultsky, EntityX(player1),EntityY(player1),EntityZ(player1)

mx = MouseX()
my = MouseY()

old_mouse_x = cur_mouse_x ;this is the line where i define the old variable for mousex()
cur_mouse_x = MouseX() Shr 1 ;this is the new mousex()
mouse_x_delta = cur_mouse_x-old_mouse_x ;this is the current mousex() ;this is what im going to use in the y value of "turnentity player1"
characreate = newchar ;this is the old characreate
newchar = 0 ;this is the new characreate
newfinal = newchar ;this is the value i will use to change characreate to 0 only if you are not mousing over a block.
oldselect = newselect
newselect = 0
newsfinal = newselect

mh = MouseHit(1)
omousedown = newmouse_down
newmouse_down = MouseDown(1)
fmousedown = newmouse_down

If player1 <> 0
	If fmousedown And mayturn = 0
		If mx > ImageWidth(background)
     TurnEntity player1, 0, mouse_x_delta, 0
Else If mx < ImageWidth(background) Or mx > GraphicsWidth()-1
     RotateEntity player1, 0, -180, 0
    	EndIf
	EndIf
EndIf

which=y*2+x

If which < maxblocks

If Not mayturn Then fmousedown = 0
If (which <> 0) And mayturn = 1 Then mayturn = 0

	If mx < 0 Then mx = 0
	If my < 0 Then my = 0
	If mx > GraphicsWidth() Then mx = GraphicsWidth()
	If my > GraphicsHeight() Then my = GraphicsHeight()

EndIf

Next

UpdateWorld
RenderWorld tween#

DrawImage background, origx#+pos_x#, origy#+pos_y#

If mh
	For x = 0 To 1
		For y = 0 To maxblocks
			imx = (0.2 * width) + (0.57 * width * x) + (origx#) + (pos_x#)
			imy = (0.2 * height) + (0.1 * height * y) + (origy#) + (pos_x#)
			If ImageRectOverlap(im, imx,imy,mx,my,1,1)
				which = y * 2 + x
			 If which < maxblocks
				selected = which
				If which <> oldwhich Then
				HideEntity player1
				ShowEntity playermesh(which)
				player1 = playermesh(which)
				   If which = 0 PositionEntity player1,1,0,8
				   If which = 1 PositionEntity player1,1,0,8
				   If which = 2 PositionEntity player1,1,1,8
				   If which = 3 PositionEntity player1,1,1,8
				   If which = 0 Animate player1,1
				   If which = 1 Animate player1,1
					If which = 0 Then ScaleEntity player1, .5,.5,.5 : RotateEntity player1, 0, -180, 0
					If which = 1 Then ScaleEntity player1, .2,.2,.2 : RotateEntity player1, 0, -180, 0
					If which = 2 Then ScaleEntity player1, 1,1,1 : RotateEntity player1, 0, -180, 0
					If which = 3 Then ScaleEntity player1, 1,1,1 : RotateEntity player1, 0, -180, 0
					oldwhich = which
				Else If which = oldwhich
					showbox = 1
				EndIf
			EndIf
		 EndIf
		Next
	Next
EndIf

For x = 0 To 1
    For y = 0 To maxblocks
 which=y*2+x
 If which < maxblocks
     imx = (0.2 * width) + (0.57 * width * x) + (origx#) + (pos_x#)
     imy = (0.2 * height) + (0.1 * height * y) + (origy#) + (pos_y#)
		DrawImage imbg, imx-ImageWidth(imbg) Shr 1, imy-ImageHeight(imbg) Shr 1
        DrawImage im, imx, imy, which
 EndIf
    Next
Next

For x = 0 To 1
For y = 0 To maxblocks
imx = (0.2 * width) + (0.57 * width * x) + (origx#) + (pos_x#)
imy = (0.2 * height) + (0.1 * height * y) + (origy#) + (pos_y#)
which=y*2+x
If which < maxblocks
If (which = selected) Or ImageRectOverlap(im, imx,imy, mx,my,1,1)
characreate = 1
Color 150,150,150
Rect imx-ImageWidth(im) Shr 1, imy-ImageHeight(im) Shr 1, ImageWidth(im), ImageHeight(im), 0
Rect imx-ImageWidth(im) Shr 1+1, imy-ImageHeight(im) Shr 1+1, ImageWidth(im), ImageHeight(im), 0

If which = 0
Color 0,0,0
Text imx-StringWidth(playertype$(0)) Shr 1-1, imy-StringHeight(playertype$(0)) Shr 2-1, playertype$(0)
Color 102,102,255
Text imx-StringWidth(playertype$(0)) Shr 1, imy-StringHeight(playertype$(0)) Shr 2, playertype$(0)
Else If which = 1
Color 0,0,0
Text imx-StringWidth(playertype$(1)) Shr 1-1, imy-StringHeight(playertype$(1)) Shr 2-1, playertype$(1)
Color 68,207,255
Text imx-StringWidth(playertype$(1)) Shr 1, imy-StringHeight(playertype$(1)) Shr 2, playertype$(1)
Else If which = 2
Color 0,0,0
Text imx-StringWidth(playertype$(2)) Shr 1-1, imy-StringHeight(playertype$(2)) Shr 2-1, playertype$(2)
Color 68,207,255
Text imx-StringWidth(playertype$(2)) Shr 1, imy-StringHeight(playertype$(2)) Shr 2, playertype$(2)
Else If which = 3
Color 0,0,0
Text imx-StringWidth(playertype$(3)) Shr 1-1, imy-StringHeight(playertype$(3)) Shr 2-1, playertype$(3)
Color 68,207,255
Text imx-StringWidth(playertype$(3)) Shr 1, imy-StringHeight(playertype$(3)) Shr 2, playertype$(3)
EndIf
EndIf
EndIf
Next
Next

Color 255,255,255
Text GraphicsWidth()/2,GraphicsHeight()/2, "FPS:"+RealFPS#

DrawImage mouseicon, mx, my

Color 0,0,0

		Music_Handler()
		SFX_Handler()
		
Flip

Frametime()
RealFrames#=RealFrames#+1.0

Wend

pmodel = player1

If pmodel = player1

guimode = 0

EndIf

If which = 0 Then ScaleEntity pmodel,.5,.5,.5
If which = 1 Then ScaleEntity pmodel,.2,.2,.2
If which = 2 Then ScaleEntity pmodel,1,1,1
If which = 3 Then ScaleEntity pmodel,1,1,1

FreeEntity temp
FreeEntity sky1
FreeEntity defaultsky
FreeEntity sky1
FreeEntity cam
FreeImage background
FreeImage mouseicon
FreeImage im
FreeImage imbg

ShowPointer

FlushKeys()

Return pmodel


im looking at these 5 lines

    selected = which
    If which <> oldwhich Then
    HideEntity player1 ;ESPECIALLY THIS 1
    ShowEntity playermesh(which)
    player1 = playermesh(which)


how would i load the ORIGINAL model 1st, and THEN free the player1 entity IF AND ONLY IF the user has chosen a different player, and how would i keep "which" as its id?

~DS~


no matter what i try, i cant seem to figure out whats making the character creator lag.


Warner(Posted 2009) [#38]
Pff, it was your idea to do this. :P But that's basically it. Two more things
1. Is "fade" a float? The first time it appears in the program, place a # after it's name, Ie:
fade# = 0
2. When using floats, it will never become exactly one. It will be something like:
1.00999939
That's cause by something in the CPU. So instead checking if fade=1, check if fade>=1, so also larger values are accepted.

Than it should work. If you want to improve it, ensure that fade cannot become greater than one.


Guy Fawkes(Posted 2009) [#39]
i know :P and thank you for all the help you gave to me on the pause subject. i really do appreciate it :)

i need all the help on this problem that i can get

its basically destroying my idea.

*sigh*

now the problem i need help on is above the post u just made :)

thanks!

~DS~


Warner(Posted 2009) [#40]
I can't really go into that. Hopefully someone else can help, I now need to go to sleep. The pause project is nearly done. Basically, you only need to add either one or characters (> and maybe #) to get it to work.


Guy Fawkes(Posted 2009) [#41]
can we work on the big problem tomorrow?

its the ONLY remaining big huge glitch left in the character creator.

and i know u can.

u just dont want to because of what ross said to u.

and ross, idc if ur reading this.

i was learning JUST fine until ross came along..

yes, i am trying to do things for myself.

no i dont want them done for me.

but i dont also want every answer in riddles.

im not able to learn that way.

i learn by example and by doing.

not by riddles.

~DS~


LineOf7s(Posted 2009) [#42]
Seriously, dude, delete that post before you make (more of) a fool of yourself.


Flemmonk(Posted 2009) [#43]
I was giving hint as to this part of your code when I originally posted, that your resource management as Malice said is very poor.



Ross C(Posted 2009) [#44]
Hey, wait a minute. I said I wasn't going to post in your topics anymore, mainly because I have nothing to contribute to your threads. I personally have said best of luck to you on many occasions, and stated my dislike for the way you learn. You are the only person who's stopping YOU from learning. Do i come round to your house and unplug your computer when your on it? No.

As for Warner. The guy seems to know a hell of alot more than me, about programming, and he's been exceptionally helpful to you. I'm sure his decision is his own, and your insulting him by saying otherwise.

Me personally. I remember writing an entire textbox routine for you, wordwrap, text colour changing via control codes in the text, positioning, changable borders. (even remember converting it to single-surface 3d stuff?). You have a bloody cheek, so you do.

Plus, don't think i haven't noticed the way you always bump your thread to the top of the forums. But that's another issue. I'm not going to say good luck to you this time.[EDITED]


_PJ_(Posted 2009) [#45]
To be honest, DSW, you make a large number of posts here asking for help in many areas of coding that your knowledge and technique really isn't up to standard.

I think your ideas are a little too ambitious for your level of programming skill, and while there's nothing wrong with that intrinsically, and challenging oneself is a means to learn, in this case, you simply aren't learning, just being 'bailed-iout' with code beyond your means, often because you've simply slotted in many code archive or similar snippets without much consideration to how they should work together congruently.

The help from this community in solving code problems usually involves three things:

A practical knowledge of B3D code.
The ability to think outsife-the-box in approaching a problem
Having clear and structured code examples to the nature of the problem.

So many of the other people here are excellent with 1 and 2. However, in cases like this, the third part, clear and structured code, is sorely lacking. It's like trying to read pages of a four year old's writing if they're writing about nuclear physics.

I seriously suggest that for the time being at least, you start small. get used to programming things that you can do, and work on your code structure and management of resources.

This is not an offence post, I'm really trying to help you. With clearer code that is not too ambitious will be so much more easier for you to work with as well as those you ask for help.

Noone minds helping out, but it's a bit of give-and-take, you need to give a little more by presenting your code in a format that is easily followed by someone who is seeing it for the first time, this will benefit you a lot more too when you encounter difficulties, as it will be so much easier to see where the problem comes in.


Guy Fawkes(Posted 2009) [#46]
ok malice.

for YOU. ill edit it.


Guy Fawkes(Posted 2009) [#47]
and dont think i didnt notice YOUR *useless bump* either, ross. -.-


Guy Fawkes(Posted 2009) [#48]
ok.

here's the code.

i tabbed it as best as i can.


ok. so i went to the maximum level,

and purposely overloaded my character creator with 16 characters.

why? so i could test lag.

there seems to be a hidden problem.

i only get around 10 - 16 fps.

this is in a function incase u guys might not have known.


Dim playertype$(3)
 playertype$(0) = "Ninja"
  playertype$(1) = "Markio"
   playertype$(2) = "Cube"
    playertype$(3) = "Sphere"

Dim enemymesh(2)
 enemymesh(0) = LoadAnimMesh("media\ninja.b3d")
  enemymesh(1) = LoadAnimMesh("markio\mariorun.x")
   enemymesh(2) = CreateCube()

For x = 0 To 2
 HideEntity enemymesh(x)
Next

If maxblocks <= 0 Then Exit

period=1000/FPS
 time=MilliSecs()-period

	Repeat
		elapsed=MilliSecs()-time
	Until elapsed

	;how many 'frames' have elapsed	
	ticks=elapsed/period
	
	;fractional remainder
	tween#=Float(elapsed Mod period)/Float(period)
	
	For k=1 To ticks
		time=time+period
		If k=ticks Then CaptureWorld

          If sky1=1 Then PositionEntity sky1,EntityX(player1),EntityY(player1),EntityZ(player1)
           If defaultsky=1 Then PositionEntity defaultsky, EntityX(player1),EntityY(player1),EntityZ(player1)

mx = MouseX()
my = MouseY()

old_mouse_x = cur_mouse_x ;this is the line where i define the old variable for mousex()
 cur_mouse_x = MouseX() Shr 1 ;this is the new mousex()
  mouse_x_delta = cur_mouse_x-old_mouse_x ;this is the current mousex() ;this is what im going to use in the y value of "turnentity player1"
   characreate = newchar ;this is the old characreate
    newchar = 0 ;this is the new characreate
     newfinal = newchar ;this is the value i will use to change characreate to 0 only if you are not mousing over a block.
      oldselect = newselect
       newselect = 0
        newsfinal = newselect

mh = MouseHit(1)
 omousedown = newmouse_down
  newmouse_down = MouseDown(1)
   fmousedown = newmouse_down

If player1 <> 0
	If fmousedown And mayturn = 0
		If mx > ImageWidth(background)
     TurnEntity player1, 0, mouse_x_delta, 0
Else If mx < ImageWidth(background) Or mx > GraphicsWidth()-1
     RotateEntity player1, 0, -180, 0
    	EndIf
     EndIf
EndIf

which=y*2+x

If which < maxblocks
 If Not mayturn Then fmousedown = 0
  If (which <> 0) And mayturn = 1 Then mayturn = 0

	If mx < 0 Then mx = 0
	 If my < 0 Then my = 0
	  If mx > GraphicsWidth() Then mx = GraphicsWidth()
	   If my > GraphicsHeight() Then my = GraphicsHeight()

  EndIf

Next

UpdateWorld
 RenderWorld tween#

  DrawImage background, origx#+pos_x#, origy#+pos_y#

If mh
	For x = 0 To 1
		For y = 0 To maxblocks
			imx = (0.2 * width) + (0.57 * width * x) + (origx#) + (pos_x#)
			 imy = (0.2 * height) + (0.1 * height * y) + (origy#) + (pos_x#)
			If ImageRectOverlap(im, imx,imy,mx,my,1,1)
				which = y * 2 + x
			 If which < maxblocks
				selected = which
				 If which <> oldwhich Then
				  HideEntity player1
				  ShowEntity playermesh(which)
				  player1 = playermesh(which)
				 If which = 0 PositionEntity player1,1,0,8
				  If which = 1 PositionEntity player1,1,0,8
				  If which = 2 PositionEntity player1,1,1,8
				  If which = 3 PositionEntity player1,1,1,8
				   If which = 0 Animate player1,1
				   If which = 1 Animate player1,1
					If which = 0 Then ScaleEntity player1, .5,.5,.5 : RotateEntity player1, 0, -180, 0
					If which = 1 Then ScaleEntity player1, .2,.2,.2 : RotateEntity player1, 0, -180, 0
					If which = 2 Then ScaleEntity player1, 1,1,1 : RotateEntity player1, 0, -180, 0
					If which = 3 Then ScaleEntity player1, 1,1,1 : RotateEntity player1, 0, -180, 0
					 oldwhich = which
				Else If which = oldwhich
					showbox = 1
			EndIf
	           EndIf
	      EndIf
	  Next
      Next
EndIf

For x = 0 To 1
    For y = 0 To maxblocks
     which=y*2+x
 If which < maxblocks
     imx = (0.2 * width) + (0.57 * width * x) + (origx#) + (pos_x#)
      imy = (0.2 * height) + (0.1 * height * y) + (origy#) + (pos_y#)
	DrawImage imbg, imx-ImageWidth(imbg) Shr 1, imy-ImageHeight(imbg) Shr 1
         DrawImage im, imx, imy, which
 EndIf
    Next
Next

For x = 0 To 1
 For y = 0 To maxblocks
  imx = (0.2 * width) + (0.57 * width * x) + (origx#) + (pos_x#)
  imy = (0.2 * height) + (0.1 * height * y) + (origy#) + (pos_y#)
   which=y*2+x
    If which < maxblocks
    If (which = selected) Or ImageRectOverlap(im, imx,imy, mx,my,1,1)
     characreate = 1
      Color 150,150,150
      Rect imx-ImageWidth(im) Shr 1, imy-ImageHeight(im) Shr 1, ImageWidth(im), ImageHeight(im), 0
      Rect imx-ImageWidth(im) Shr 1+1, imy-ImageHeight(im) Shr 1+1, ImageWidth(im), ImageHeight(im), 0

If which = 0
 Color 0,0,0
 Text imx-StringWidth(playertype$(0)) Shr 1-1, imy-StringHeight(playertype$(0)) Shr 2-1, playertype$(0)
  Color 102,102,255
  Text imx-StringWidth(playertype$(0)) Shr 1, imy-StringHeight(playertype$(0)) Shr 2, playertype$(0)
Else If which = 1
  Color 0,0,0
  Text imx-StringWidth(playertype$(1)) Shr 1-1, imy-StringHeight(playertype$(1)) Shr 2-1, playertype$(1)
   Color 68,207,255
   Text imx-StringWidth(playertype$(1)) Shr 1, imy-StringHeight(playertype$(1)) Shr 2, playertype$(1)
Else If which = 2
  Color 0,0,0
  Text imx-StringWidth(playertype$(2)) Shr 1-1, imy-StringHeight(playertype$(2)) Shr 2-1, playertype$(2)
   Color 68,207,255
   Text imx-StringWidth(playertype$(2)) Shr 1, imy-StringHeight(playertype$(2)) Shr 2, playertype$(2)
Else If which = 3
  Color 0,0,0
  Text imx-StringWidth(playertype$(3)) Shr 1-1, imy-StringHeight(playertype$(3)) Shr 2-1, playertype$(3)
   Color 68,207,255
   Text imx-StringWidth(playertype$(3)) Shr 1, imy-StringHeight(playertype$(3)) Shr 2, playertype$(3)
   EndIf
  EndIf
 EndIf
Next
Next

Color 255,255,255
 Text GraphicsWidth()/2,GraphicsHeight()/2, "FPS:"+RealFPS#

  DrawImage mouseicon, mx, my

  Color 0,0,0

		Music_Handler()
		SFX_Handler()
		
Flip

Frametime()
 RealFrames#=RealFrames#+1.0

Wend

pmodel = player1

If pmodel = player1

  guimode = 0

EndIf

If which = 0 Then ScaleEntity pmodel,.5,.5,.5
 If which = 1 Then ScaleEntity pmodel,.2,.2,.2
  If which = 2 Then ScaleEntity pmodel,1,1,1
   If which = 3 Then ScaleEntity pmodel,1,1,1

FreeEntity temp
 FreeEntity sky1
  FreeEntity defaultsky
   FreeEntity sky1
    FreeEntity cam
     FreeImage background
    FreeImage mouseicon
   FreeImage im
  FreeImage imbg

ShowPointer

 FlushKeys()

Return pmodel


im looking at these 5 lines

    selected = which
    If which <> oldwhich Then
     HideEntity player1 ;ESPECIALLY THIS 1
     ShowEntity playermesh(which)
      player1 = playermesh(which)


how would i load the ORIGINAL model 1st, and THEN free the player1 entity IF AND ONLY IF the user has chosen a different player, and how would i keep "which" as its id?

~DS~


no matter what i try, i cant seem to figure out whats making the character creator lag.


Warner(Posted 2009) [#49]
How can that code end with "return pmesh?" Is this the content of a function?


Guy Fawkes(Posted 2009) [#50]
yes


Warner(Posted 2009) [#51]
At the start of the function, three models are loaded. They are however, never freed.
Dim enemymesh(2)
 enemymesh(0) = LoadAnimMesh("media\ninja.b3d")
  enemymesh(1) = LoadAnimMesh("markio\mariorun.x")
   enemymesh(2) = CreateCube()

I mean, every time you neter this function, three models are added to the memory.


Guy Fawkes(Posted 2009) [#52]
fixed.

While Not KeyHit(1)

Pause()

	itemx# = itemx# + 1 * .01
	If itemx# < -360.0 Then itemx# = 0
	If itemx# > 360.0 Then itemx# = 0

mx = MouseX()
my = MouseY()

PositionEntity sky,EntityX(camera),EntityY(camera),EntityZ(camera)

	Repeat
		elapsed=MilliSecs()-time
	Until elapsed

	;how many 'frames' have elapsed	
	ticks=elapsed/period
	
	;fractional remainder
	tween#=Float(elapsed Mod period)/Float(period)
	
	For k=1 To ticks
		time=time+period
		If k=ticks Then CaptureWorld
	
	Cls
	If RESETR = True
		RESETR = False
		Goto reset
	EndIf
	UpdateCamera(Camera,player\model)
	UpdateHostile()
	UpdateItem()
	UpdatePlayer()

Set_Keys()
	
final=FadeScreen(min_alp#, max_alp#, min_lig#, max_lig#, fademode, land, test, test2, multiple)

Next	

	UpdateWorld
	RenderWorld tween
		
	UpdateText(1)
	
;	Text 25, 10, "Health"
;	Text 25, 35, "Magic"
	
;	Color 0,0,0
;	Rect 495,32,150,15
;	Color 100,100,100
;	Rect 500,35,150,13
	
;	Color 0,0,0
;	Rect 24,24,102,7
;	Color 255,0,0
;	Rect 25,25,player\hp*(100.0/player\maxhp),5
	
	
;	Color 0,0,0
;	Rect 495,22,150,15
;	Color 100,100,100
;	Rect 500,35,150,13
	
;	Color 0,0,0
;	Rect 24,84,102,7
;	Color 0,255,0
;	Rect 25,45,player\mp*(100.0/player\maxmp),5

;    mage=Createbar(10, 40, "Magic", 0, 255, 0, 127, 127, 127, 0, 0, 0, 0, 255, 0, 10, 55, player\mp*(100.0/player\maxmp), 2, 10, 50, player\mp*(100.0/player\maxmp), 2, 10, 52, player\mp*(100.0/player\maxmp), 2)

;	Populate_Bar("HP")
;    Populate_Bar("MP")
	UpdateInventory()
;	Color 0,0,0
;	Rect 0,100,150,500
;	Color 255,0,0
;	Text 5,100,"        Level " + player\lvl
;	Text 5,120,"HP: " + player\hp + "/" + player\maxhp
;	Text 5,140,"MP: " + player\mp + "/" + player\maxmp
;	Text 5,160,"Dmg: " + player\attack + " - " + player\maxattack
;	Text 5,180,"Exp: " + player\experience + "/" + player\nextlvl
;	Text 5,200,"alpha="+alpha#	
;	Text 5,220,"fademode="+fademode
;	Text 5,240,"multiple="+multiple
;	Color 0,0,0
;	Text 5+StringWidth("Gold:"+"x"+GOLD)-1,260+StringHeight("Gold:"+"x"+Gold)-1,"Gold:"+"x"+GOLD
;	Color 255,0,0
;	Text 5+StringWidth("Gold:"+"x"+GOLD),260+StringHeight("Gold:"+"x"+Gold),"Gold:"+"x"+GOLD
;	Text 5,290, "FPS:"+FPS
;	Text 5,310,

;If which = 0 Then LabelEntitys(Camera, "<"+playertype$(0)+">", pmodel)
;If which = 1 Then LabelEntitys(Camera, "<"+playertype$(1)+">", pmodel)
;If which = 2 Then LabelEntitys(Camera, "<"+playertype$(2)+">", pmodel)	

;	If which = 0 Then LabelEntitys(Camera, "<"+playertype$(which)+">"+Chr$(13)+"HP:"+ENEMYHP+"/"+ENEMYMAXHP, enemymesh(which))
;	If which = 1 Then LabelEntitys(Camera, "<"+"Hi, I'm retardio!>"+Chr$(13)+"HP:"+ENEMYHP+"/"+ENEMYMAXHP, enemymesh(which))
;	If which = 2 Then LabelEntitys(Camera, "<"+playertype$(which)+">"+Chr$(13)+"HP:"+ENEMYHP+"/"+ENEMYMAXHP, enemymesh(which))
;	If which = 3 Then LabelEntitys(Camera, "<"+playertype$(which)+">"+Chr$(13)+"HP:"+ENEMYHP+"/"+ENEMYMAXHP, enemymesh(which))

Text GraphicsWidth()/2, GraphicsHeight()/2, "Real FPS:"+RealFPS#
	
	Flip
Frametime()
RealFrames#=RealFrames#+1.0
Wend

For x = 0 To 2
 FreeEntity enemymesh(x)
Next

End


	For x = 0 To 2
	  FreeEntity enemymesh(x)
	Next



_PJ_(Posted 2009) [#53]
It's not just a matter of putting in tabs, although at the least, you could align your For/Next and If / End Ifs woth theor resective pairs, that would really help immensely.

You need to consider where you dfeclare your variables and how you name them etc. as well as think about effciency, why use two variables when one will do or repeat similar code when a single function can do it for you etc.
Try a google search for "Programming Standards Best Practice".

Anyway, at least, you've made some effort and it is a little better, so I'll reciprocate.

_________________________________________


NEVER use the same variable for different things, it's only going to confuse the issue.

Flemmonk highlighted the reason for your slow fps, as he said, he would grind to a halt eeventually. Did you remove the constant memory saping/leaking where you are reloading the Panel sprite EVERY frame?

I suspect you're not intending to use Bitwise operands, but you are. Learn the difference and syntax with using And / Or /Not, as Warner highlighted:
If (which) And mayturn = 1 Then mayturn = 0 : fmousedown = 0
What should this do? Basically, it is the same as this:
If (which <> 0) And mayturn = 1 Then mayturn = 0: fmousedown = 0




There's little point asking for help when the suggested changes aren't implemented, or you're not clear about what you're intending.

If which = 0 Then ScaleEntity pmodel,.5,.5,.5
If which = 1 Then ScaleEntity pmodel,.2,.2,.2
If which = 2 Then ScaleEntity pmodel,1,1,1
If which = 3 Then ScaleEntity pmodel,1,1,1


---->
Select Which
Case 1: ScaleEntity pModel,0.2,0.2,0.2
Case 2: ScaleEntity pModel,1.0,1.0,1.0
Case 3: ScaleEntity pModel,1.0,1.0,1.0
Default: ScaleEntity pModel,0.5,0.5,0.5
End Select





Function CreateHostile.hostile(spec,x,z)
		A.hostile = New hostile
		
		Select spec
			Case 1
				A\model = CopyEntity(enemymesh(Rnd(0,2)))
				A\maxhp = 200
				A\hp = Rnd(A\maxhp)/20
				A\attack = 2
				A\attackrange = 20
				A\state = IDLE
				A\maxtime# = 5.0
				A\cooled = True
				A\current# = 0.0
	 ENEMYHP = A\hp
	 ENEMYMAXHP = A\maxhp
		End Select
		
	For x = 0 To 2
	 If a\hp = 0
	  FreeEntity enemymesh(x)
	 EndIf
	Next

				
		A\ox = x
		A\oz = z
		A\fleepivot = CreatePivot()
        PositionEntity A\fleepivot,x,EntityY(t),z
;		PositionEntity A\fleepivot,x,TerrainY(t,x,0,z),z
		PositionEntity A\model,x,0,z
		Return A
				
End Function

This is likely to cause problems. I would place
	 ENEMYHP = A\hp
	 ENEMYMAXHP = A\maxhp


AFTER the Select/Case.

It would make much mroe sense to Load the meshes just once, outside of the functions, rather than keep loading and freeing them. That's only ever going to be slow and potentially leak some memory soemwhere too.
You are freeing the 'Master' Mesh entity, I hope that's intended, because if you ever run the function again and that same value comes up for Rnd, your program will crash, there's no entity to copy anymore.
Also, if 'spec' isn't 1, then you're freeing all 3 meshes regardless, which will also free any copies you have existing.
	A\ox = x
		A\oz = z
		A\fleepivot = CreatePivot()
        PositionEntity A\fleepivot,x,EntityY(t),z
;		PositionEntity A\fleepivot,x,TerrainY(t,x,0,z),z
		PositionEntity A\model,x,0,z
		Return A


Unless your Select/Case will cater to ALL eventualities (Maybe you want to add a 'Default' in there), you are populating Type fields for instances that wont have meshes or most of the other data. This is likely to waste resources too.

Come on, think about what you are trying to do with each function/part of the program and get them fully working before moving on to the next, draw out a flow-chart first and go through it step by step. one small bug in one place can make a mountain of trouble elsewhere.


Guy Fawkes(Posted 2009) [#54]
ok. fixed all of the above part.

now. how do i fix the lag in the character creator?

the code is above.

.


Flemmonk(Posted 2009) [#55]
I dont even need to understand the code to suspect your problem probably lies here:
	RenderWorld tween


And that for loop above it, is shocking. This is not what we mean by tabbing your code (spacing each line is incorrect, it is all throughout your code):
FreeEntity temp
 FreeEntity sky1
  FreeEntity defaultsky
   FreeEntity sky1
    FreeEntity cam
     FreeImage background
    FreeImage mouseicon
   FreeImage im
  FreeImage imbg


This is clean code:


Edit: Even the above has problems as there are no comments.


Guy Fawkes(Posted 2009) [#56]
um. incorrect flemmonk..

its because its trying to hide 16 different entities at once. what i need to know is how to RELOAD them. not HIDE them..

the problem is everytime i RELOAD them, after a while, it thinks the entity doesnt exist period.

~DS~~


Flemmonk(Posted 2009) [#57]
Can you describe the lag you're experiencing as you have not yet done that.


Guy Fawkes(Posted 2009) [#58]
yes. i can even show u a video.

gimme a few mins to make 1.


_PJ_(Posted 2009) [#59]
The program will only "think the entity doesnt exist" if the entity doesn't exist.

However, if you have reason to believe an entity should exist, it's likely due to:

The incorrect entity handle is passed
The entity has been freed
The handle's value as been changed

As for the lag, I can see you still have:
Repeat
	elapsed=MilliSecs()-time
	Until elapsed

If anything is going to slow the code down, it will be this.

And,
While Not KeyHit(1)

Pause()


Have you fixed the Pause() function from constantly re-loading the panel sprite yet?

	For k=1 To ticks
		time=time+period
		If k=ticks Then CaptureWorld
	
	Cls
	If RESETR = True
		RESETR = False
		Goto reset
	EndIf
	UpdateCamera(Camera,player\model)
	UpdateHostile()
	UpdateItem()
	UpdatePlayer()

Set_Keys()
	
final=FadeScreen(min_alp#, max_alp#, min_lig#, max_lig#, fademode, land, test, test2, multiple)

Next	

Why so many updates to the camera etc. when none of it's going to be seen?

Either put the update/key calls OUTSIDE the For/Next, or include the RenderWorld and Flip within the For/Next.

Seriusly, as I said before, try doing something smple that you know you CAN do, leave too ambitious stuff until you're more capable, it really seems as though you've not grasped enough of the basics.








Lastly,




Wend

For x = 0 To 2
 FreeEntity enemymesh(x)
Next

You know this isn't going to happen until after you press escape right?


Guy Fawkes(Posted 2009) [#60]
edit: i changed updatecamera from function

and put it into the loop..

i also decided to get rid of the fps

repeat
until

code..


Guy Fawkes(Posted 2009) [#61]
PS.

Somehow, the lag glitch fixed itself.

I think :3

its not lagging anymore.

im gonna try to overload it.


_PJ_(Posted 2009) [#62]


edit: i changed updatecamera from function

and put it into the loop..


What does this mean?


Guy Fawkes(Posted 2009) [#63]
at 1st i didnt realize what u meant when u said this: "Why so many updates to the camera etc. when none of it's going to be seen?"

then i realized u meant the function.

ive been up since 6.

go figure.

lol

~DS~


Guy Fawkes(Posted 2009) [#64]
ok. i finally have figured out why the character creator is lagging all of the time.

its because its hiding player1. its not deleting and changing it to the model of choice.

the only problem is, it says entity does not exist.

code:

Global maxblocks = 16

Dim playermesh(maxblocks)

playermesh(0) = LoadAnimMesh("media/ninja.b3d")
playermesh(1) = LoadAnimMesh("markio/mariorun.x")
playermesh(2) = CreateCube()
playermesh(3) = CreateSphere(100.5)

For x = 4 To 16
playermesh(x) = CreateSphere(100.5)
HideEntity playermesh(x)
Next

While Not KeyHit(1)

mx = MouseX()
my = MouseY()

old_mouse_x = cur_mouse_x
cur_mouse_x = MouseX() Shr 1
mouse_x_delta = cur_mouse_x-old_mouse_x
characreate = newchar
newchar = 0
newfinal = newchar
oldselect = newselect
newselect = 0
newsfinal = newselect

mh = MouseHit(1)
omousedown = newmouse_down
newmouse_down = MouseDown(1)
fmousedown = newmouse_down

If player1 <> 0
	If fmousedown And mayturn = 0
		If mx > ImageWidth(background)
     TurnEntity player1, 0, mouse_x_delta, 0
Else If mx < ImageWidth(background) Or mx > GraphicsWidth()-1
     RotateEntity player1, 0, -180, 0
    	EndIf
	EndIf
EndIf

which=y*2+x

If which < maxblocks

If Not mayturn Then fmousedown = 0
If (which <> 0) And mayturn = 1 Then mayturn = 0

	If mx < 0 Then mx = 0
	If my < 0 Then my = 0
	If mx > GraphicsWidth() Then mx = GraphicsWidth()
	If my > GraphicsHeight() Then my = GraphicsHeight()
	
EndIf

UpdateWorld
RenderWorld

DrawImage background, origx#+pos_x#, origy#+pos_y#

If mh
	For x = 0 To 1
		For y = 0 To maxblocks
			imx = (0.2 * width) + (0.57 * width * x) + (origx#) + (pos_x#)
			imy = (0.07 * height) + (0.1 * height * y) + (origy#) + (pos_x#)
			If ImageRectOverlap(im, imx,imy,mx,my,1,1)
				which = y * 2 + x
			 If which < maxblocks
				selected = which
				oldplayer1 = player1
				If which <> oldwhich Then
				If player1 <> oldplayer1 Then
				FreeEntity player1
				player1 = playermesh(which)
				EndIf
			
If player1 <> oldplayer1
Select which
 Case 0: Animate player1,1 : ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 1: Animate player1,1 : ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 2: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 3: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Default: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
End Select
EndIf
					oldwhich = which
				Else If which = oldwhich
					showbox = 1
				EndIf
			EndIf
		 EndIf
		Next
	Next
EndIf

For x = 0 To 1
    For y = 0 To maxblocks
 which=y*2+x
 If which < maxblocks
     imx = (0.2 * width) + (0.57 * width * x) + (origx#) + (pos_x#)
     imy = (0.07 * height) + (0.1 * height * y) + (origy#) + (pos_y#)
		DrawImage imbg, imx-ImageWidth(imbg) Shr 1, imy-ImageHeight(imbg) Shr 1
        DrawImage im, imx, imy, which
 EndIf
    Next
Next

 For x = 0 To 1
  For y = 0 To maxblocks
   imx = (0.2 * width) + (0.57 * width * x) + (origx#) + (pos_x#)
   imy = (0.07 * height) + (0.1 * height * y) + (origy#) + (pos_y#)
   which=y*2+x
  If which < maxblocks
   If (which = selected) Or ImageRectOverlap(im, imx,imy, mx,my,1,1)
    characreate = 1
    Color 150,150,150
    Rect imx-ImageWidth(im) Shr 1, imy-ImageHeight(im) Shr 1, ImageWidth(im), ImageHeight(im), 0
    Rect imx-ImageWidth(im) Shr 1+1, imy-ImageHeight(im) Shr 1+1, ImageWidth(im), ImageHeight(im), 0
     Select which
      Case 0:
       r = 102 : g = 102 : b = 255
      Case 1: 
       r = 68 : g = 207 : b = 255
      Case 2: 
       r = 255 : g = 0 : b = 0
      Case 3: 
       r = 0 : g = 255 : b = 0
      Case 4: 
       r = 0 : g = 255 : b = 255
      Case 5: 
       r = 255 : g = 0 : b = 255
      Case 6: 
       r = 255 : g = 255 : b = 0
      Case 7: 
       r = 127 : g = 255 : b = 0
      Case 8: 
       r = 255 : g = 127 : b = 0
      Case 9: 
       r = 0 : g = 255 : b = 127
      Case 10: 
       r = 127 : g = 255 : b = 255
      Case 11: 
       r = 255 : g = 127 : b = 255
      Case 12: 
       r = 255 : g = 255 : b = 127
      Case 13: 
       r = 127 : g = 127 : b = 255
      Case 14: 
       r = 255 : g = 127 : b = 127
      Case 15: 
       r = 127 : g = 127 : b = 127
      Case 16: 
       r = 255 : g = 255 : b = 255
     End Select
     Color 0,0,0
     Text imx-StringWidth(playertype$(which)) Shr 1-1, imy-StringHeight(playertype$(which)) Shr 2-1, playertype$(which)
     Color r,g,b
     Text imx-StringWidth(playertype$(which)) Shr 1, imy-StringHeight(playertype$(which)) Shr 2, playertype$(which)
    EndIf
  EndIf
 Next
Next

 Color 0,0,0
 Text GraphicsWidth()/2,GraphicsHeight()/2, "FPS:"+RealFPS#



the part i need help on is this:

			 If which < maxblocks
				selected = which
				oldplayer1 = player1
				If which <> oldwhich Then
				If player1 <> oldplayer1 Then
				FreeEntity player1
				player1 = playermesh(which)
				EndIf
			
If player1 <> oldplayer1
Select which
 Case 0: Animate player1,1 : ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 1: Animate player1,1 : ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 2: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 3: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Default: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
End Select
EndIf
Wend



Warner(Posted 2009) [#65]
You shouldn't free the player. It is the same as this:
cube = CreateCube()
other = cube

FreeEntity other ;<----Also deletes cube, 'other' and 'cube' are the same
MoveEntity cube, 0, 0, 1 ;<----Error, since cube is deleted


I still don't understand how I should look at this code:
playermesh(0) = LoadAnimMesh("media/ninja.b3d")
playermesh(1) = LoadAnimMesh("markio/mariorun.x")
playermesh(2) = CreateCube()
playermesh(3) = CreateSphere(100.5)

For x = 4 To 16
playermesh(x) = CreateSphere(100.5)
HideEntity playermesh(x)
Next

How often are these lines executed? You said the code above is part of a function. When is this function called? Once, at the start of the program, or more than once, when the user changes the character?

Please describe the lagging problem. No video is needed :) just, a plain description of how/when it occurs and what you need to do to get the lag at runtime.


Guy Fawkes(Posted 2009) [#66]
ok. basically what i need to lag it, is

not freeing player1, because player1 is loaded before load_gui() is even called.

now. the problem with this is i cant WHEN SWITCHING characters delete the current character, and reload it as the new character.

and hiding the entities obviously make it lag too.

which is why i thought to use "freeentity".

so here's HOW the function is called:

Global enemiesleft

Global espeed#

Global pspeed# = 2

Global maxblocks = 16

Global itemx#

Global guimode

Global spriteheight#=GraphicsHeight() Shr 1.0
Global spritewidth#=GraphicsWidth() Shr 1.0

Global RealFPS#
Global RealFrames#
Global RealCountFrameTime=MilliSecs()

Global pmodel

Global gfxw=800
Global gfxh = 600
Global gfxd = 0
Global gfxmode = 2

setgfx3d(gfxw,gfxh,gfxd,gfxmode)

Dim playertype$(maxblocks)
playertype$(0) = "Ninja"
playertype$(1) = "Markio"
playertype$(2) = "Cube"
playertype$(3) = "Sphere"

Dim enemymesh(2)

enemymesh(0) = LoadAnimMesh("media\ninja.b3d")
enemymesh(1) = LoadAnimMesh("markio\mariorun.x")
enemymesh(2) = CreateCube()

For x = 0 To 2
HideEntity enemymesh(x)
Next

Include "includes/Imphenzia_Audio.bb"

Global sky1

Global showbox

Global mh

Global mayturn

Global playerchosen

Global characreate

Global newid

Global welcome

If maxblocks > 0
welcome = SFX_Load("media\welcome.wav", "group1", False)
SFX_Play(welcome,0.5,False)
EndIf

Global origx# = 0
Global origy# = 0
Global pos_x# = 5
Global pos_y# = 10

Global HWND=SystemProperty("ApphWnd")
Global HWND_TOP = 3

Dim playermesh(maxblocks)

load_gui()

AmbientLight 255,255,255

Sky = CreateSphere(100)
ScaleEntity Sky,100000, 100000, 100000
;EntityOrder sky, 9
FlipMesh Sky
EntityColor Sky,68,207,252


the function is: load_gui()

~DS~


Warner(Posted 2009) [#67]
But now these lines:
Global maxblocks = 16

Dim playermesh(maxblocks)

playermesh(0) = LoadAnimMesh("media/ninja.b3d")
playermesh(1) = LoadAnimMesh("markio/mariorun.x")
playermesh(2) = CreateCube()
playermesh(3) = CreateSphere(100.5)

For x = 4 To 16
playermesh(x) = CreateSphere(100.5)
HideEntity playermesh(x)
Next

are in the main code again? Do they appear twice in the program? Once in the main program and once in the function?


Guy Fawkes(Posted 2009) [#68]
yes. apparently they were.

i fixed it though now.

so here's the code so far:

AppTitle "Beta RPG"

SeedRnd MilliSecs()

Global maxenemies = 2

Global enemiesleft

Global espeed#

Global pspeed# = 2

Global itemx#

Global guimode

Global spriteheight#=GraphicsHeight() Shr 1.0
Global spritewidth#=GraphicsWidth() Shr 1.0

Global RealFPS#
Global RealFrames#
Global RealCountFrameTime=MilliSecs()

Global pmodel

Global gfxw=800
Global gfxh = 600
Global gfxd = 0
Global gfxmode = 2

setgfx3d(gfxw,gfxh,gfxd,gfxmode)

Global maxblocks = 16

Dim playermesh(maxblocks)

playermesh(0) = LoadAnimMesh("media/ninja.b3d")
playermesh(1) = LoadAnimMesh("markio/mariorun.x")
playermesh(2) = CreateCube()
playermesh(3) = CreateSphere(100.5)

Dim playertype$(maxblocks)
playertype$(0) = "Ninja"
playertype$(1) = "Markio"
playertype$(2) = "Cube"
playertype$(3) = "Sphere"

For x = 4 To maxblocks
playertype$(x) = "Sphere"
playermesh(x) = CreateSphere(100.5)
HideEntity playermesh(x)
Next

Dim enemymesh(2)

enemymesh(0) = LoadAnimMesh("media\ninja.b3d")
enemymesh(1) = LoadAnimMesh("markio\mariorun.x")
enemymesh(2) = CreateCube()

For x = 0 To 2
HideEntity enemymesh(x)
Next

Include "includes/Imphenzia_Audio.bb"

Global sky1

Global showbox

Global mh

Global mayturn

Global playerchosen

Global characreate

Global newid

Global welcome

If maxblocks > 0
welcome = SFX_Load("media\welcome.wav", "group1", False)
SFX_Play(welcome,0.5,False)
EndIf

Global origx# = 0
Global origy# = 0
Global pos_x# = 5
Global pos_y# = 10

Global HWND=SystemProperty("ApphWnd")
Global HWND_TOP = 3

load_gui()

AmbientLight 255,255,255

Sky = CreateSphere(100)
ScaleEntity Sky,100000, 100000, 100000
;EntityOrder sky, 9
FlipMesh Sky
EntityColor Sky,68,207,252

While Not KeyHit(1)
mx = MouseX()
my = MouseY()

old_mouse_x = cur_mouse_x
cur_mouse_x = MouseX() Shr 1
mouse_x_delta = cur_mouse_x-old_mouse_x
characreate = newchar
newchar = 0
newfinal = newchar
oldselect = newselect
newselect = 0
newsfinal = newselect

mh = MouseHit(1)
omousedown = newmouse_down
newmouse_down = MouseDown(1)
fmousedown = newmouse_down

If player1 <> 0
	If fmousedown And mayturn = 0
		If mx > ImageWidth(background)
     TurnEntity player1, 0, mouse_x_delta, 0
Else If mx < ImageWidth(background) Or mx > GraphicsWidth()-1
     RotateEntity player1, 0, -180, 0
    	EndIf
	EndIf
EndIf

which=y*2+x

If which < maxblocks

If Not mayturn Then fmousedown = 0
If (which <> 0) And mayturn = 1 Then mayturn = 0

	If mx < 0 Then mx = 0
	If my < 0 Then my = 0
	If mx > GraphicsWidth() Then mx = GraphicsWidth()
	If my > GraphicsHeight() Then my = GraphicsHeight()
	
EndIf

UpdateWorld
RenderWorld

DrawImage background, origx#+pos_x#, origy#+pos_y#

If mh
	For x = 0 To 1
		For y = 0 To maxblocks
			imx = (0.2 * width) + (0.57 * width * x) + (origx#) + (pos_x#)
			imy = (0.07 * height) + (0.1 * height * y) + (origy#) + (pos_x#)
			If ImageRectOverlap(im, imx,imy,mx,my,1,1)
				which = y * 2 + x
			 If which < maxblocks
				selected = which
				oldplayer1 = player1
				If which <> oldwhich Then
				If player1 <> oldplayer1 Then
				FreeEntity player1
				player1 = playermesh(which)
				EndIf
			
If player1 <> oldplayer1
Select which
 Case 0: Animate player1,1 : ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 1: Animate player1,1 : ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 2: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 3: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Default: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
End Select
EndIf
					oldwhich = which
				Else If which = oldwhich
					showbox = 1
				EndIf
			EndIf
		 EndIf
		Next
	Next
EndIf

For x = 0 To 1
    For y = 0 To maxblocks
 which=y*2+x
 If which < maxblocks
     imx = (0.2 * width) + (0.57 * width * x) + (origx#) + (pos_x#)
     imy = (0.07 * height) + (0.1 * height * y) + (origy#) + (pos_y#)
		DrawImage imbg, imx-ImageWidth(imbg) Shr 1, imy-ImageHeight(imbg) Shr 1
        DrawImage im, imx, imy, which
 EndIf
    Next
Next

 For x = 0 To 1
  For y = 0 To maxblocks
   imx = (0.2 * width) + (0.57 * width * x) + (origx#) + (pos_x#)
   imy = (0.07 * height) + (0.1 * height * y) + (origy#) + (pos_y#)
   which=y*2+x
  If which < maxblocks
   If (which = selected) Or ImageRectOverlap(im, imx,imy, mx,my,1,1)
    characreate = 1
    Color 150,150,150
    Rect imx-ImageWidth(im) Shr 1, imy-ImageHeight(im) Shr 1, ImageWidth(im), ImageHeight(im), 0
    Rect imx-ImageWidth(im) Shr 1+1, imy-ImageHeight(im) Shr 1+1, ImageWidth(im), ImageHeight(im), 0
     Select which
      Case 0:
       r = 102 : g = 102 : b = 255
      Case 1: 
       r = 68 : g = 207 : b = 255
      Case 2: 
       r = 255 : g = 0 : b = 0
      Case 3: 
       r = 0 : g = 255 : b = 0
      Case 4: 
       r = 0 : g = 255 : b = 255
      Case 5: 
       r = 255 : g = 0 : b = 255
      Case 6: 
       r = 255 : g = 255 : b = 0
      Case 7: 
       r = 127 : g = 255 : b = 0
      Case 8: 
       r = 255 : g = 127 : b = 0
      Case 9: 
       r = 0 : g = 255 : b = 127
      Case 10: 
       r = 127 : g = 255 : b = 255
      Case 11: 
       r = 255 : g = 127 : b = 255
      Case 12: 
       r = 255 : g = 255 : b = 127
      Case 13: 
       r = 127 : g = 127 : b = 255
      Case 14: 
       r = 255 : g = 127 : b = 127
      Case 15: 
       r = 127 : g = 127 : b = 127
      Case 16: 
       r = 255 : g = 255 : b = 255
     End Select
     Color 0,0,0
     Text imx-StringWidth(playertype$(which)) Shr 1-1, imy-StringHeight(playertype$(which)) Shr 2-1, playertype$(which)
     Color r,g,b
     Text imx-StringWidth(playertype$(which)) Shr 1, imy-StringHeight(playertype$(which)) Shr 2, playertype$(which)
    EndIf
  EndIf
 Next
Next
Flip
Wend



Warner(Posted 2009) [#69]
So, it works now, no lag? Else, is this the entire code? Because there is no Function load_gui?


Guy Fawkes(Posted 2009) [#70]
i didnt give u the whole function because if i did that, people could steal it. so i gave u the important parts.

and no. it doesnt work..

it still lags.

how about if i show u the program, and u can find out whats going on, because obviously, i cant..


Guy Fawkes(Posted 2009) [#71]
ill email it to u on the email from ur profile :)


Guy Fawkes(Posted 2009) [#72]
Warner, check ur email :)

I sent it to u. :)

Its not a big file

so yea :)

Thanks!


Guy Fawkes(Posted 2009) [#73]
ps. i didnt add the code for a reason.

if u want the code, let me know,

and ill email it to u.

Thanks! ^^


_PJ_(Posted 2009) [#74]
I still don't understand why you need maxblocks = 16 when only two of the playermesh() entities are valid for
 Case 0: Animate player1,1 : ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 1: Animate player1,1 : ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0


Also, in my experience, LoadAnimMesh() likes full paths rather than local ones.

I really fdon't see the need for the If check here:
If maxblocks > 0
welcome = SFX_Load("media\welcome.wav", "group1", False)
SFX_Play(welcome,0.5,False)
EndIf

You only assigned maxblocks to be 16 a few lines further back.

Where does 'mayturn' ever get given a value other than zero?
From what I can see, it doesn't, so all the code like:
If (which <> 0) And mayturn = 1 Then mayturn = 0

	If mx < 0 Then mx = 0
	If my < 0 Then my = 0
	If mx > GraphicsWidth() Then mx = GraphicsWidth()
	If my > GraphicsHeight() Then my = GraphicsHeight()
	
EndIf




Your code has so many variables for who-knows-what, it's no wonder io's so confusing. Put in some safety checks, use features like DebugLog or RuntimeError so you can keep track of your excessive variables/handles.

PLEASE, please... format your code so it's readable!!!

You have multiple nested Ifs with references to Which=OldWhich ... or ... Which <> OldWhich
that are very hard to understand without some nicely indented code.


Guy Fawkes(Posted 2009) [#75]
the need for

 If maxblocks > 0
welcome = SFX_Load("media\welcome.wav", "group1", False)
SFX_Play(welcome,0.5,False)
EndIf


is simple. i need it to play the welcome sound ONLY when maxblocks > 0, because if maxblocks = 0, then i tell it to use the default loaded model, instead of using the character creator and exit the character creator.

yes i will try to indent it.

no i may or may not use mayturn.

i think that glitch was fixed.

i just forgot to take it out.


_PJ_(Posted 2009) [#76]
I don't mean your reasoning for wanting to play the sound when maxblocks > 0, only that unless Imphenzia itself messes with a global called 'maxblocks', there's nothing changing maxblocks from where you defined it as 16.

You have all these occurrences of things happening which clutter the code. Things like:
For x = 0 To 1
    For y = 0 To maxblocks
 which=y*2+x
 If which < maxblocks
     imx = (0.2 * width) + (0.57 * width * x) + (origx#) + (pos_x#)
     imy = (0.07 * height) + (0.1 * height * y) + (origy#) + (pos_y#)
		DrawImage imbg, imx-ImageWidth(imbg) Shr 1, imy-ImageHeight(imbg) Shr 1
        DrawImage im, imx, imy, which
 EndIf
    Next
Next


Could be split into functions, something like:

Function BlockDrawing()
For x = 0 To 1
    For y = 0 To maxblocks
 which=y*2+x
 If which < maxblocks
     DrawBlocks(x,y,which)
 EndIf
    Next
Next
End Function

Function DrawBlocks(x,y,ref)
imx = (0.2 * width) + (0.57 * width * x) + (origx#) + (pos_x#)
     imy = (0.07 * height) + (0.1 * height * y) + (origy#) + (pos_y#)
		DrawImage imbg, imx-ImageWidth(imbg) Shr 1, imy-ImageHeight(imbg) Shr 1
        DrawImage im, imx, imy,ref
End Function



Guy Fawkes(Posted 2009) [#77]
now its saying im, and imbg dont exist.


Guy Fawkes(Posted 2009) [#78]
and

DebugLog "im:"+im+";"+"background:"+background+";"+"imbg:"+imbg+";"+"mouseicon:"+mouseicon

is returning the SAME id for the different images like so:

im:12345678 ; background: 9101112 ; imbg: 13141516 ; mouseicon: 17181920

and it STILL doesnt exist.

and i made it global and put it at the top of the program.


Guy Fawkes(Posted 2009) [#79]
warner. check ur email once more :)


Guy Fawkes(Posted 2009) [#80]
also.

warner.

try pressing z ONCE in-game.

then pressing x ONCE in-game.

then move around and look at the fps.

the lag problem is due to the player somehow being all 16 characters at once instead of 1 character..

then press z again. it will go from 30 to 60+ fps, to 30 and lower like that.


Warner(Posted 2009) [#81]
Ah, just replied the email. I see .. will do that tomorrow, okay?


_PJ_(Posted 2009) [#82]
Those function examples were just examples, you would likely need to pass in im / imbg and maybe even width, origx# and pos_x# too, anything non-global really ought to be passed in as a Parameter. Without the LoadUI function there's no declaration for these, so it's impossible for me to know what they are/should be or whether they are global etc.


Guy Fawkes(Posted 2009) [#83]
i fixed it :)

np malice :)


_PJ_(Posted 2009) [#84]
You're getting there, then!

it may seem like a complete mystery what's going on with code sometimes, and it can get so frustrating when you're sure it SHOULD work, but it just doesn't.
More often than not (and this goes for EVERYONE), the biggest errors are simple "stupid mistakes", a little typo here or using the wtong handle etc there, we're our own worst enemies because human beings just aren't as 'clinically logical' and precise as the computers we use.

Any human could tell you what's wrong with the following:

"Name: John Smith"
"Address: 1, High Street"

"Name: Sharon Loose"
"Address: 16, Allways Avenue"

"Name: 42, Station Road"
"Address: Richard Head"

but a computer would see nothing wrong.

The more you look at your code, try to read through it as a computer would, make notes if you need to to keep track of what your variables are as you go through. NEVER assume that a function or whatever works just because it has worked once or twice. All sorts of things can break a function.


Guy Fawkes(Posted 2009) [#85]
yup.

now the only problem is.

its HIDING the player entity.

not DELETING it when changing.

so technically..

theres 15 inviso players.

and 1 real player.

so yea.


Warner(Posted 2009) [#86]
In load_gui, you reload the player:
Instead, assign the previous loaded player to it.
Function load_gui()

player1 = playermesh(0) <---here

After using load_gui, free the entities, except the one that was chosen:
load_gui()

For x = 0 To maxblocks  <-----here
	If playermesh(x) <> player1 Then FreeEntity playermesh(x)
Next

AmbientLight 255,255,255



Guy Fawkes(Posted 2009) [#87]
load_gui()

For x = 0 To maxblocks
If playermesh(x) <> player1 Then FreeEntity playermesh(x)
Next


after selected,

it says

'entity doesnt exist'

..

as for the

problem, the code

is this:

If mh
	width =400
	height = 600
	For x = 0 To 1
		For y = 0 To maxblocks
			imx = (0.2 * width) + (0.57 * width * x) + (origx#) + (pos_x#)
			imy = (0.07 * height) + (0.1 * height * y) + (origy#) + (pos_x#)
			If ImageRectOverlap(im, imx,imy,mx,my,1,1)
				which = y * 2 + x
			 If which < maxblocks
				selected = which
				oldplayer1 = player1
				If which <> oldwhich Then
				If AnimLength(player1) > 0 Then Animate player1, 0
				FreeEntity player1
				player1 = playermesh(which)

			
Select which
 Case 0: Animate player1,1 : ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 1: Animate player1,1 : ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 2: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 3: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Default: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
End Select
					oldwhich = which
				Else If which = oldwhich
					showbox = 1
				EndIf
			EndIf
		 EndIf
		Next
	Next
EndIf


im looking straight

at:

If AnimLength(player1) > 0 Then Animate player1, 0
HideEntity player1
ShowEntity playermesh(which)
player1 = playermesh(which)



Warner(Posted 2009) [#88]
That code is not the problem. Most likely I have a different version than the one you are using. When I applied those two things, it worked. I could tell by disabling using HideEntity on the original meshes. When the game started, the other 'originals' were gone.
You're not freeing any of the other meshes in load_gui, right. Use CTRL+F and check every instance of FreeEntity. The original meshes, and any references to them should only be freed right after load_gui.
With reference, I mean this:

player(0) = loadanimplayer("test.b3d") <----- original
player1 = player(0) <------------------------ reference

That is also why the code above will work. 'player1' is only a reference to one of the original meshes. You shouldn't free any of them during load_gui.


Guy Fawkes(Posted 2009) [#89]
um. send me

the old version

plz & thx.

it may have

been edited

last night :)


Guy Fawkes(Posted 2009) [#90]
ok. its doing

the same thing

..

load_gui()

For x = 0 To maxblocks
If playermesh(x) <> player1 Then FreeEntity playermesh(x)
Next


heres the whole

loop inside

load_gui():

While Not KeyHit(1)

MoveEntity cam,0,0,(KeyDown(200)-KeyDown(208))*1
TurnEntity cam,0,(KeyDown(203)-KeyDown(205))*1,0

If maxblocks <= 0 Then Exit

	
If sky1=1 Then PositionEntity sky1,EntityX(player1),EntityY(player1),EntityZ(player1)
If defaultsky=1 Then PositionEntity defaultsky, EntityX(player1),EntityY(player1),EntityZ(player1)

mx = MouseX()
my = MouseY()

old_mouse_x = cur_mouse_x
cur_mouse_x = MouseX() Shr 1
mouse_x_delta = cur_mouse_x-old_mouse_x
characreate = newchar
newchar = 0
newfinal = newchar
oldselect = newselect
newselect = 0
newsfinal = newselect

mh = MouseHit(1)
omousedown = newmouse_down
newmouse_down = MouseDown(1)
fmousedown = newmouse_down

If player1 <> 0
	If fmousedown
		If mx > ImageWidth(background)
     TurnEntity player1, 0, mouse_x_delta, 0
Else If mx < ImageWidth(background) Or mx > GraphicsWidth()-1
     RotateEntity player1, 0, -180, 0
    	EndIf
	EndIf
EndIf

which=y*2+x

If which < maxblocks

	If mx < 0 Then mx = 0
	If my < 0 Then my = 0
	If mx > GraphicsWidth() Then mx = GraphicsWidth()
	If my > GraphicsHeight() Then my = GraphicsHeight()
	
EndIf

UpdateWorld
RenderWorld

If background <> 0
DrawImage background, origx#+pos_x#, origy#+pos_y#
EndIf

If mh
	width =400
	height = 600
	For x = 0 To 1
		For y = 0 To maxblocks
			imx = (0.2 * width) + (0.57 * width * x) + (origx#) + (pos_x#)
			imy = (0.07 * height) + (0.1 * height * y) + (origy#) + (pos_x#)
			If ImageRectOverlap(im, imx,imy,mx,my,1,1)
				which = y * 2 + x
			 If which < maxblocks
				selected = which
				oldplayer1 = player1
				If which <> oldwhich Then
				If AnimLength(player1) > 0 Then Animate player1, 0
				HideEntity player1
				ShowEntity playermesh(which)
				player1 = playermesh(which)
			
Select which
 Case 0: Animate player1,1 : ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 1: Animate player1,1 : ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 2: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 3: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Default: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
End Select
					oldwhich = which
				Else If which = oldwhich
					showbox = 1
				EndIf
			EndIf
		 EndIf
		Next
	Next
EndIf

BlockDrawing(0,0,0,0)

	width = 400
	height = 600

 For x = 0 To 1
  For y = 0 To maxblocks
   imx = (0.2 * width) + (0.57 * width * x) + (origx#) + (pos_x#)
   imy = (0.07 * height) + (0.1 * height * y) + (origy#) + (pos_y#)
   which=y*2+x
  If which < maxblocks
   If (which = selected) Or ImageRectOverlap(im, imx,imy, mx,my,1,1)
    characreate = 1
    Color 150,150,150
    Rect imx-ImageWidth(im) Shr 1, imy-ImageHeight(im) Shr 1, ImageWidth(im), ImageHeight(im), 0
    Rect imx-ImageWidth(im) Shr 1+1, imy-ImageHeight(im) Shr 1+1, ImageWidth(im), ImageHeight(im), 0
     Select which
      Case 0:
       r = 102 : g = 102 : b = 255
      Case 1: 
       r = 68 : g = 207 : b = 255
      Case 2: 
       r = 255 : g = 0 : b = 0
      Case 3: 
       r = 0 : g = 255 : b = 0
      Case 4: 
       r = 0 : g = 255 : b = 255
      Case 5: 
       r = 255 : g = 0 : b = 255
      Case 6: 
       r = 255 : g = 255 : b = 0
      Case 7: 
       r = 127 : g = 255 : b = 0
      Case 8: 
       r = 255 : g = 127 : b = 0
      Case 9: 
       r = 0 : g = 255 : b = 127
      Case 10: 
       r = 127 : g = 255 : b = 255
      Case 11: 
       r = 255 : g = 127 : b = 255
      Case 12: 
       r = 255 : g = 255 : b = 127
      Case 13: 
       r = 127 : g = 127 : b = 255
      Case 14: 
       r = 255 : g = 127 : b = 127
      Case 15: 
       r = 127 : g = 127 : b = 127
      Case 16: 
       r = 255 : g = 255 : b = 255
     End Select
     Color 0,0,0
     Text imx-StringWidth(playertype$(which)) Shr 1-1, imy-StringHeight(playertype$(which)) Shr 2-1, playertype$(which)
     Color r,g,b
     Text imx-StringWidth(playertype$(which)) Shr 1, imy-StringHeight(playertype$(which)) Shr 2, playertype$(which)
    EndIf
  EndIf
 Next
Next

 Color 0,0,0
 Text GraphicsWidth()/2,GraphicsHeight()/2, "FPS:"+RealFPS#

 DrawImage mouseicon, mx, my

 Color 0,0,0
		
Flip

Frametime()
 RealFrames#=RealFrames#+1.0

Wend



Warner(Posted 2009) [#91]
I mailed back.


Guy Fawkes(Posted 2009) [#92]
thanks :)

i got it

ok. now why

is it lagging?

o.o


Warner(Posted 2009) [#93]
It isn't lagging here. Maybe your PC is overheating? No just kidding, I have no idea. The main game doesn't lag at all. The editor is quite slow though.


Guy Fawkes(Posted 2009) [#94]
yea..

why?

also, the game

is only 30

fps..

do me a

favor. press z

in game.

THEN tell me

its not lagging.

lol


Warner(Posted 2009) [#95]
I did, offcourse, press A and Z. Looks allright. No lag still.


GIB3D(Posted 2009) [#96]
I


don't


understand


why you


keep typing


like


this when


you can just use one





line.


Guy Fawkes(Posted 2009) [#97]
well.

im only getting 30 fps.

is there anyway

u could neutralize

that?

and i type

like this because

i like short

sentences.

lol


Ross C(Posted 2009) [#98]
Well it's mighty irritating when your trying to follow a thread. Your doing yourself a dis-service with it actually. The more scrollong folks have to do, the harder it is to follow.


Guy Fawkes(Posted 2009) [#99]
fine.. *sigh*


GIB3D(Posted 2009) [#100]
Next thing you know, you're gonna be typing like this...

I li
ke che
ese
on m
y
sandw
hi
ch
.

Only kidding btw.


Guy Fawkes(Posted 2009) [#101]
o ha ha. -.-

so anyway, can i get somebody to help test this?


_PJ_(Posted 2009) [#102]
It's pretty useless trying to test something that's incomplete. If there was a ersion complete with all functions and without a need for all the extras like imphenzia and media, then I'd give it a go.


Guy Fawkes(Posted 2009) [#103]
there is.

i can rid imphenzia.

imphenzia was just there b/c i needed it to test if imphenzia is better than blitz.


Guy Fawkes(Posted 2009) [#104]
ok. compiled. here:

http://www.mediafire.com/download.php?2u3tijizmie


_PJ_(Posted 2009) [#105]
I downloaded it, ran it, no lag. Changed the "characterrs" a few times, pressed Z, pressed A - no lag at all here. constant 60 fps

Maybe it's your computer specs?


Guy Fawkes(Posted 2009) [#106]
nice!

everybody but i seems to be getting fps 60+!

i think ur right.

specs:

GFX card: Mobile Intel(R) 4 Series Express Chipset Family

Chip type: same as above

Approx Total Memory: 1293 MB

Current Display Mode: 1024x768 (32 bit)
(60 Hz)
Moniter Generic PnP Moniter

DirectX: X10


Guy Fawkes(Posted 2009) [#107]
What does everybody get on their end?


Ginger Tea(Posted 2009) [#108]
ive been avoiding posting what gia said about those disjointed lines
ive now started to read your posts with a really naff william shatner/kirk voice (the robot chicken keanu reeves saussage one)


Guy Fawkes(Posted 2009) [#109]
u know what?

if alls ur going to do is INSULT me, then just leave.


Ginger Tea(Posted 2009) [#110]
ive had the grammar nazi's on my case a few times over lack of punctuation or the odd typeo/ smelling mistake (i left that one in) but
why


well.

im only getting 30 fps.

is there anyway

u could neutralize

that?

and i type

like this because

i like short

sentences.

lol

and not
well. im only getting 30 fps. is there anyway u could neutralize that? and i type like this because i like short sentences. lol

is all we are asking?

the only thing i could think of for the tiny line width would be if you were reading this via a mobile phone and had s**ty word wrap


Guy Fawkes(Posted 2009) [#111]
i will. but i ask that u not insult me. i find that offensive.


Ginger Tea(Posted 2009) [#112]
it might read as insulting to you, but to us to read that in our minds voice is like someone pausing each line break and that starts to get really annoying.

a sentance is supposted to flow, some of my typing glitches stem from my speach patterns, my beats get typed as i would say them, pauses skipped, forgetting to breathe in.
that is where your (not mine) friends punctuation come in
. finishes the sentance at hand
, is an intake of breath

some lines looked like they ended when "read aloud" then continue abrubly two lines later.

seriously no offence intended here, but if you spoke some of those lines out with varying degrees of pauses either outloud or in your head, you would see what we mean.

mind you cudos if you were actually managing to arange your posts via haiku 5, 7, 5 sylable blocks


Guy Fawkes(Posted 2009) [#113]
ok. we'll drop the subject now, and just say it was haiku ok. i DO happen to be a poem writer on my freetime.

so makes sense :P

so if u dont mind, try the download i posted above and report the fps ur getting both in game and in characreator if u wanna help me :)


_PJ_(Posted 2009) [#114]

GFX card: Mobile Intel(R) 4 Series Express Chipset Family

Chip type: same as above

Approx Total Memory: 1293 MB

Current Display Mode: 1024x768 (32 bit)
(60 Hz)
Moniter Generic PnP Moniter

DirectX: X10



I'm guessing then, that your machine is a laptop.
Laptop gpu chips are often inferior to their alledgedly equivalent PCI cousins.
Furthermore, as you have DX10, then I'm assuming you're running Vista. Vista guzzles RAM like a ... hungry-RAM-Guzzling-Thing, and pretty much uses a gigabyte's worth just to keep the cogs turning so to speak.

I'd put money on the low framerate to be down to insufficient memory and a struggling CPU. Even more reason to optimise your code and resource management.

Throw in a couple of Delay 10 commands and see if that hels any, giving the CPU a chance to deal with the windows processes.


Guy Fawkes(Posted 2009) [#115]
nice! will do! thx malice!


Guy Fawkes(Posted 2009) [#116]
didnt work :(


Ginger Tea(Posted 2009) [#117]
ok there are some keys im meant to press, but the controlls are lost in the multi line sentance posts so can i have a re cap?**

im getting 50-60 odd with the ninja hyped up on caffine showing off his animation superduperfast, reminicent of transformers the movie's blur
ifiwavemyswordaroundrealquicklikethisyoumightbeafraidbutifijumprealhighyouwillbeimpressed* mega spazzy animation then he falls down exhausted and im not surprised

i had to delete every space due to force of habit there but here it is in english
if i wave my sword around real quick like this you might be afraid but if i jump real high you will be impressed

**i spent a day reading lol cats and when at the bar i almost said "i can has a cheese burger?" and i was tempted to re edit that line in lol catese


Guy Fawkes(Posted 2009) [#118]
o haha and i know about the animation. ill fix it when i KNOW this thing is stable


Ginger Tea(Posted 2009) [#119]
keys though?
i hit a few and nowt happened (that i could see)


Guy Fawkes(Posted 2009) [#120]
um. keys: wasd/arrowkeys - move. space-attack.


Ginger Tea(Posted 2009) [#121]
wsad didnt do anything, but i did find the cursors doing the camera movement when i first tried it
also just found out that holding the mouse on the ninja and moving it left/right rotates it. mind you, you could have said that already, but with some of the posts being as they are its easy to skip past it


Ross C(Posted 2009) [#122]
Your CPU speed is probably killing you too. There's not much you can do. Try reducing textures sizes. What size are your textures currently?


Guy Fawkes(Posted 2009) [#123]
um. not sure.

lemme check


Ross C(Posted 2009) [#124]
Goto START button >>> RUN >>> type:

dxdiag.exe

That will give you the CPU speed. amoungst other things.


Ross C(Posted 2009) [#125]
Tbh, i don't really see what there is to do.

Firstly though, the camera moves way to quick. You should make the camera rotate around the entity. That would make it easier for you to view the charater.

The images your using are party masked. I think your probably better choosing a different mask colour, as it looks a little cruddy. Also, i seem to have a toolbar with the ninja and markio and some spheres, then the exact same toolbar near the centre of the screen.

Can you actually edit the character yet?


Guy Fawkes(Posted 2009) [#126]
not yet. btw. the other toolbar is just the 2nd side of characters.

when its done, hopefully it will be able to use up to 99999999 characters.


Guy Fawkes(Posted 2009) [#127]
well what i need is a camera like from legend of zelda: twilight princess :)


Ginger Tea(Posted 2009) [#128]
not that ive used many in game character creators, but what you need, or more specifically, the player needs is:

>the cursor keys to rotate the player around 1
>the animation to be set in an idle loop 2
>continuity in animations

not too sure which camera mode that game uses, but you can set all types of cameras (even the anika rice)

having 999999999999999999999999999999999999999999999999 characters is all well and good if you have the media for them. the sims uses a generic skeleton for both male and female characters, similar animation for non specific tasks, eg 3 modes of dancing, they all eat the same as there is no reason for a variation there.

so if you are using media from multiple artists you will loose all continuity in characters, if the goal is to allow us the users to make ours via supplied media, then you need a generic skeleton asap, one that can do all types of animation, even if it isnt used by the class you roll your character in: eg a barbarian could do a powerball spell move if he wanted to, but not being magically adept all hell do is just the motions

edit
1 left and right obviously spinning, up and down might be zoom in/out or tilt, up to you really.

2 perhaps the odd axe swipe here and there once the player type has been addressed, showing the full range is not necessary


Guy Fawkes(Posted 2009) [#129]
ok, what's wrong w/ this?

Global okicon = LoadImage("ok.png")
MidHandle okicon

While Not KeyHit(1)
mx = MouseX()
my = MouseY()
UpdateWorld()
RenderWorld()
;Highlight w/ rect the ok icon which is: 32x32
 For x = 0 To 1
  For y = 0 To maxblocks
	 imx1 = GraphicsWidth() Shr 1-ImageWidth(okicon) Shr 1+20 ;(0.2 * width1) + (0.57 * width1 * x) + (origx#) + (pos_x#)
	 imy1 = GraphicsHeight()-ImageHeight(okicon) Shr 1 ;(0.07 * height1) + (0.1 * height1 * y) + (origy#) + (pos_x#)
     imx2 = imx1-ImageWidth(okicon) ;Shr 1
     imy2 = imy1-ImageHeight(okicon) ;Shr 1
   which=y*2+x
   If ImageRectOverlap(okicon, imx2,imy2,mx,my,1,1)
    Color 150,150,150
    Rect imx2, imy2, ImageWidth(okicon), ImageHeight(okicon), 0
    Rect imx2+1, imy2+1, ImageWidth(okicon), ImageHeight(okicon), 0
  EndIf
 Next
Next
Flip
Wend


the lines im looking at:

	 imx1 = GraphicsWidth() Shr 1-ImageWidth(okicon) Shr 1+20 ;(0.2 * width1) + (0.57 * width1 * x) + (origx#) + (pos_x#)
	 imy1 = GraphicsHeight()-ImageHeight(okicon) Shr 1 ;(0.07 * height1) + (0.1 * height1 * y) + (origy#) + (pos_x#)
     imx2 = imx1-ImageWidth(okicon) ;Shr 1
     imy2 = imy1-ImageHeight(okicon) ;Shr 1
   which=y*2+x
   If ImageRectOverlap(okicon, imx2,imy2,mx,my,1,1)
    Color 150,150,150
    Rect imx2, imy2, ImageWidth(okicon), ImageHeight(okicon), 0
    Rect imx2+1, imy2+1, ImageWidth(okicon), ImageHeight(okicon), 0
  EndIf



Warner(Posted 2009) [#130]
Why would there be anything wrong with it? Doesn't it run?


Guy Fawkes(Posted 2009) [#131]
it runs.

its just when i try to mouse over it, its got the wrong coordinates for imx1 and imy1, for imagerectoverlap().

	 imx1 = GraphicsWidth() Shr 1-ImageWidth(okicon) Shr 1+20 ;(0.2 * width1) + (0.57 * width1 * x) + (origx#) + (pos_x#)
	 imy1 = GraphicsHeight()-ImageHeight(okicon) Shr 1 ;(0.07 * height1) + (0.1 * height1 * y) + (origy#) + (pos_x#)
     imx2 = imx1-ImageWidth(okicon) ;Shr 1
     imy2 = imy1-ImageHeight(okicon) ;Shr 1



Warner(Posted 2009) [#132]
Well, to adjust these coordinates, comment these two lines out:
If ImageRectOverlap(okicon, imx2,imy2,mx,my,1,1)

EndIf

That way you can see all the rectangles. It gives a clearer view what is wrong with it.


Guy Fawkes(Posted 2009) [#133]
um. the problem is not with the rect coords. its with the mouse over coords.


Warner(Posted 2009) [#134]
Ah, they should be the same coords as used by DrawImage.


Guy Fawkes(Posted 2009) [#135]
fixed. i need someone to test this project


Guy Fawkes(Posted 2009) [#136]
Warner, check ur mail :)


LogBomb(Posted 2009) [#137]
I would like to help test too shadow if you can email me the latest version :)

Logbomb


Guy Fawkes(Posted 2009) [#138]
@logbomb,

check ur mail :)


Guy Fawkes(Posted 2009) [#139]
also,

report fps for characreator AND game


LogBomb(Posted 2009) [#140]
I am getting heaps of frames per second,

FPS for character creator: 300-600

FPS for game: 200 - 500

It peeks out even higher than that at times at about 800-900 fps in both.

Thats on a 128 meg ATI Radeon 9600XT video card.


Guy Fawkes(Posted 2009) [#141]
OMFG! R U SERIOUS?!

XD


Ross C(Posted 2009) [#142]
For only showing only one character, I wouldn't get too carried away :) You should pretty much always have a high frame rate for a character creator, so keep it that way! :)


Guy Fawkes(Posted 2009) [#143]
well. the thing is. i have around 16 players.

the PROB is. its messed up so it wont work like it used to work when selecting characters.


Ross C(Posted 2009) [#144]
Well, good luck getting that sorted.


Guy Fawkes(Posted 2009) [#145]
thanks! :)


Guy Fawkes(Posted 2009) [#146]
ok. whats wrong w/ this stupid code? meh..


Dim playermesh(maxblocks)

;playermesh(0) = LoadAnimMesh("media/ninja.b3d")
;playermesh(1) = LoadAnimMesh("markio/mariorun.x")
;playermesh(2) = CreateCube()
;playermesh(3) = CreateSphere(100.5)

;For i = 0 To 3
;	HideEntity playermesh(i)
;Next

Global player1

Dim playertype$(maxblocks)
playertype$(0) = "Ninja"
playertype$(1) = "Markio"
playertype$(2) = "Cube"
playertype$(3) = "Sphere"

For x = 4 To maxblocks
playertype$(x) = "Sphere"
playermesh(x) = CreateSphere(100.5)
HideEntity playermesh(x)
Next

Dim enemymesh(maxblocks)

Dim enemytype$(maxblocks)

For a = 0 To 3
enemytype$(0) = "Ninja"
enemytype$(1) = "Markio"
enemytype$(2) = "Cube"
enemytype$(3) = "Sphere"
Next

;enemymesh(0) = LoadAnimMesh("media\ninja.b3d")
;enemymesh(1) = LoadAnimMesh("markio\mariorun.x")
;enemymesh(2) = CreateCube()

;For x = 0 To 2
;HideEntity enemymesh(x)
;Next

Function CreateHostile.hostile(spec,x,z)
		A.hostile = New hostile
		
		Select spec
			Case 1
			For x = 0 To 1
			 For y = 0 To maxblocks
			  enemywhich=y*2+x
			  If enemywhich = 0 Then A\model = LoadAnimMesh(enemymesh(0))
			  If enemywhich = 1 Then A\model = LoadAnimMesh(enemymesh(1))
			  If enemywhich = 2 Then A\model = CreateCube()
			  If enemywhich = 3 Then A\model = CreateSphere()
			 Next
			Next
				A\model = CopyEntity(enemymesh(Rnd(0,3)))
		EntityType A\model,1
		EntityRadius A\model,1
				A\maxhp = 200
				A\hp = Rnd(A\maxhp)/20
				If A\hp <= 0 Then A\hp = 1
				A\attack = 2
				A\attackrange = 20
				A\state = IDLE
				A\maxtime# = 5.0
				A\cooled = True
				A\current# = 0.0
		End Select
		
	 ENEMYHP = A\hp
	 ENEMYMAXHP = A\maxhp
								
		A\ox = x
		A\oz = z
		A\fleepivot = CreatePivot()
        PositionEntity A\fleepivot,x,EntityY(t),z
;		PositionEntity A\fleepivot,x,TerrainY(t,x,0,z),z
		PositionEntity A\model,x,0,z
		Return A
				
End Function


what im trying to do, is instead of loading all models at once, i want to display a default model, then delete that model, and switch to the newly selected model. then if i change the player again and stuff, it will again delete the 1st model, and load the 2nd 1.

ANY help is GREATLY appreciated! :)

~DS


Mahan(Posted 2009) [#147]
Change your code to use Type:s for the character data. (instead of global variables for each player)

Type:s (in Blitz+ and Blitz3D) automatically have a quite neat list mechanism under the hood.

Look in the documentation about the keywords Each, New and Delete to get more information and usage examples.

So basically you could make something like this (general example: you'll have to adjust this for your own needs):

Type TChar
	Field model% ; the model entity
	Field someSetting1% 
	Field someSetting2% 
 	Field someSetting3$ 
End Type

Function LoadChar.TChar(modelName$, settingsFile$)
	;note: This line below removes all chars when you load a new one:
	Delete Each TChar

	Local newChar.TChar = New TChar
	newChar\model = LoadMesh(modelName$)
	Local inFile%=ReadFile(settingsFile)
	If Not inFile RuntimeError("Unable to load char settings")
	newChar\someSetting1 = Int(ReadLine(inFile))
	newChar\someSetting2 = Int(ReadLine(inFile))
	newChar\someSetting3 = ReadLine(inFile)
	CloseFile(inFile)
End Function

;After you load a char with this function you can always access the loaded char like this:
local currentChar.TChar = last TChar

; (and use the reference to that char in usual Blitz3D way:
PositionEntity(currentChar\model, 10, 10, 10)



This way of handling the chars makes it very simple to adjust the code to for example have 2 or 5 or whatever chars loaded (whatever your future preference will be)

You can then keep a counter of chars, that you increment with each char loaded, and when the limit is reached, you simply delete the first, upon each LoadChar after that:

Type TChar
	Field model% ; the model entity
	Field someSetting1% 
	Field someSetting2% 
 	Field someSetting3$ 
End Type

Const MAX_CHARS=10
Global CharCount%=0

Function LoadChar.TChar(modelName$, settingsFile$)
	CharCount = CharCount+1
	If CharCount>=MAXCHARS
		Delete First TChar
		CharCount=MAXCHARS
	EndIf
	
	Local newChar.TChar = New TChar
	newChar\model = LoadMesh(modelName$)
	Local inFile%=ReadFile(settingsFile)
	If Not inFile RuntimeError("Unable to load char settings")
	newChar\someSetting1 = Int(ReadLine(inFile))
	newChar\someSetting2 = Int(ReadLine(inFile))
	newChar\someSetting3 = ReadLine(inFile)
	CloseFile(inFile)
End Function



In reality you will want to write a "function DeleteChar(char.TChar)" that frees the resources of the char of course. (Like loaded meshes etc.). This code was kept clean from this just to show you how good the Type system (and it's underlying lists) help you manage sets of identical structured information.

EDIT: Oh and I for got to mention - fields in Type:s can reference other Type instances. I.e. you can have you type that is the TChar as in the example above, but you could replace the model field to be a reference to another new type TModel (that holds the reference to the actual model mesh). This way you can have several chars reference the same model entity, with the possibility to have model-specific data on kept in the TModel fields.

EDIT2: Changed a bug in example 2 =)


Guy Fawkes(Posted 2009) [#148]
so whats wrong with this?


AppTitle "Beta RPG"

SeedRnd MilliSecs()

Global which

Global enemywhich

Global nme

Global maxblocks = 16


Global gfxw=800
Global gfxh = 600
Global gfxd = 0
Global gfxmode = 2
setgfx3d(gfxw,gfxh,gfxd,gfxmode)

Global origx# = 0
Global origy# = 0
Global pos_x# = 5
Global pos_y# = 10

Global HWND=SystemProperty("ApphWnd")
Global HWND_TOP = 3

Global maxenemies = 2

Global enemiesleft

Global espeed#

Global pspeed# = 2

Global itemx#

Global guimode

Global spriteheight#=GraphicsHeight() Shr 1.0
Global spritewidth#=GraphicsWidth() Shr 1.0

Global RealFPS#
Global RealFrames#
Global RealCountFrameTime=MilliSecs()

Global pmodel


Global im = LoadAnimImage("filmstripi3.png", 32, 32, 0, maxblocks)
MidHandle im

Global background = LoadImage("bricktex.jpg")

Global imbg = LoadImage("filmbg.png")

Global mouseicon = LoadImage("sword.png")

Global okicon = LoadImage("ok.png")

ResizeImage mouseicon, 64, 64
HandleImage mouseicon, 0, 64

If gfxw = 1600
width = GraphicsWidth() Shr 2-ImageWidth(background)/8
height = GraphicsHeight()/1.5
imwidth = 44
imheight = 44
ResizeImage background, width, height
If gfxmode = 2 Then api_MoveWindow(HWND, 0, 0, GraphicsWidth(), GraphicsHeight(), $000A)
Else If gfxw = 1280 And gfxh = 960
imwidth = 64
imheight = 64
ResizeImage im, imwidth, imheight
Else If gfxw = 1152
imwidth = 44
imheight = 44
ResizeImage im, imwidth, imheight
Else If gfxw = 1024
width = GraphicsWidth()/4-ImageWidth(background)/8
height = GraphicsHeight()
imwidth = 44
imheight = 44
ResizeImage background, width, height
ResizeImage im, imwidth, imheight
Else If gfxw = 720
width = GraphicsWidth()/4-ImageWidth(background)/8
height = GraphicsHeight()
imwidth = 44
imheight = 44
ResizeImage background, width, height
ResizeImage im, imwidth, imheight
Else If gfxw = 400
width = GraphicsWidth() Shr 1-ImageWidth(background)/8
height = GraphicsHeight()
imwidth = 32
imheight = 32
ResizeImage background, width, height
ResizeImage im, imwidth, imheight
Else If gfxw = 800
width = GraphicsWidth()/4-ImageWidth(background)/8
height = GraphicsHeight()
imwidth = 44
imheight = 44
ResizeImage background, width, height
ResizeImage im, imwidth, imheight
Else
imwidth = 32
imheight = 32
ResizeImage im, imwidth, imheight
EndIf


width = 400
height = 600

Dim playermesh(maxblocks)

;playermesh(0) = LoadAnimMesh("media/ninja.b3d")
;playermesh(1) = LoadAnimMesh("markio/mariorun.x")
;playermesh(2) = CreateCube()
;playermesh(3) = CreateSphere(100.5)

;For i = 0 To 3
;	HideEntity playermesh(i)
;Next

Global player1

Dim playertype$(maxblocks)
playertype$(0) = "Ninja"
playertype$(1) = "Markio"
playertype$(2) = "Cube"
playertype$(3) = "Sphere"

For x = 4 To maxblocks
playertype$(x) = "Sphere"
playermesh(x) = CreateSphere(100.5)
HideEntity playermesh(x)
Next

Dim enemymesh(maxblocks)

Dim enemytype$(maxblocks)

For a = 0 To 3
enemytype$(0) = "Ninja"
enemytype$(1) = "Markio"
enemytype$(2) = "Cube"
enemytype$(3) = "Sphere"
Next

;enemymesh(0) = LoadAnimMesh("media\ninja.b3d")
;enemymesh(1) = LoadAnimMesh("markio\mariorun.x")
;enemymesh(2) = CreateCube()

;For x = 0 To 2
;HideEntity enemymesh(x)
;Next

Type TChar
	Field model% ; the model entity
	Field x#
	Field y# 
 	Field z#
End Type

Global anim1

Const MAX_CHARS=10
Global CharCount%=0

While Not KeyHit(1)
mh=mousehit(1)
If mh
	width1 = GraphicsWidth()
	height1 = GraphicsHeight()
	For x = 0 To 1
		For y = 0 To maxblocks
			imx = (0.2 * width1) + (0.57 * width1 * x) + (origx#) + (pos_x#)
			imy = (0.07 * height1) + (0.1 * height1 * y) + (origy#) + (pos_x#)
			If ImageRectOverlap(im, imx,imy,mx,my,1,1)
				which = y * 2 + x
			 If which < maxblocks
				selected = which
				oldplayer1 = player1
				If which <> oldwhich Then
				If AnimLength(player1) > 0 Then Animate player1, 3,1,idleanim,1
				For x = 0 To 1
				LoadChar.TChar(playertype$(x),1,"char.ini")
				If playertype$(x)=1
				For myChar.TChar = Each TChar
				positionplayer(myChar\model,myChar\x#,myChar\y#,myChar\z#)
				Next
				EndIf
				Next
;				If which = 0 Then playermesh(0) = LoadAnimMesh("media\ninja.b3d")
;				If which = 1 Then playermesh(1) = LoadAnimMesh("markio\mariorun.x")
;				If which = 2 Then playermesh(2) = CreateCube()
;				If which = 3 Then playermesh(3) = CreateSphere(100.5)
;				HideEntity player1
;				ShowEntity playermesh(which)
;				player1 = playermesh(which)
			
Select which
 Case 0:  Animate player1, 3,1,idleanim,1 : ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 1:  Animate player1, 3,1,idleanim,1 : ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 2: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 3: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Default: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
End Select
					oldwhich = which
				Else If which = oldwhich
					showbox = 1
				EndIf
			EndIf
		 EndIf
		Next
	Next
EndIf
UpdateWorld()
RenderWorld()
Flip
Wend

Function LoadChar.TChar(modelName$,anim1,settingsFile$)
	CharCount = CharCount+1
	If CharCount>=MAXCHARS
		Delete First TChar
		CharCount=MAXCHARS
	EndIf
	Local newChar.TChar = New TChar
	If anim1 = 1
	newChar\model = LoadAnimMesh(modelName$)
	Else
	newChar\model = LoadMesh(modelName$)
	EndIf
	Local inFile%=ReadFile(settingsFile)
	If Not inFile RuntimeError("Unable to load char settings")
	newChar\x# = Float(ReadLine(inFile))
	newChar\y# = Float(ReadLine(inFile))
	newChar\z# = Float(ReadLine(inFile))
	CloseFile(inFile)
End Function

Function positionplayer(player,x#,y#,z#)
PositionEntity player,x#,y#,z#
End Function



im looking at here:

				For x = 0 To 1
				LoadChar.TChar(playertype$(x),1,"char.ini")
				If playertype$(x)=1
				For myChar.TChar = Each TChar
				positionplayer(myChar\model,myChar\x#,myChar\y#,myChar\z#)
				Next
				EndIf
				Next



Bobysait(Posted 2009) [#149]
Have you never heard about indentation ? :)
What ever, you 'd better open notepad, write the specs for your project, and the main diagram for the engine.

When you'll have this, I think you'll point on many things that will highlight you on subjects like "database", templates etc...

Then, if you want to replace the model for an entity, you 'd better use a pivot for the entity and attach a model to it.
Then if you Free the model, you won't lose the handle of the entity ( else you'll have to modify the pointer to this entity every where... I think it is even not possible, for a rpg, many entities are registered in few list. And updating each list at each time you modify a model, you 'll have many headaches ^^ )

If you just act on pivots, the model is just an entity where we don't really have to take care of its handle.

I advise you :
+> Use an array or a list for models
Each model in the list have a single identifier ( like "guid" )

in rpg, many skins are shared (to prevent memory and fps)
+> Use CopyEntity instead of LoadMesh/LoadAnimMesh for each models.

Use type everywhere it is possible !!!
whenever it is possible, try to cde without needs of "Global".

A project like this one have to use modules, and standalone functions to work with. So , try to code librarys when it is needed, like you'd do with C/Cpp ... +> private types, with private functions
from outside the library, you only keep access to Getter/Setter function.
It is easier to debug a big project when there is no global value that are changed every where in the program, or too many functions that modify shared datas. So using libraries prevent this.

And according to the size of your "world", try to check wich variables are needed or not
eg:
type TChar
Field x#,y#,z#
end type
If you have 10 000 characters ( npc or/and players ) it will be 10 000*3*4 bytes ( floats are stored with 4 bytes ) in memory for variables that can be get using EntityX/Y/Z ... so watch if you really need to store those variables.

Then the main part of your code will be clean, and easier to work with.


So maybe you could start with a basic demo involving just a player, the camera, and items to pick up. Then you put this player in Type, and use a list for models.

Once you have this working well, add other entities.


Guy Fawkes(Posted 2009) [#150]
i GET why i should use types... -.-

for the love of God, can somebody please just help me make it so this thing works?

Type TChar
	Field model%,x#,y#,z# ; the model entity
End Type

Global anim1

Const MAX_CHARS=10
Global CharCount%=0

AppTitle "Beta RPG"

SeedRnd MilliSecs()

Global which

Global enemywhich

Global nme

Global maxblocks = 16


Global gfxw=800
Global gfxh = 600
Global gfxd = 0
Global gfxmode = 2
setgfx3d(gfxw,gfxh,gfxd,gfxmode)

Global origx# = 0
Global origy# = 0
Global pos_x# = 5
Global pos_y# = 10

Global HWND=SystemProperty("ApphWnd")
Global HWND_TOP = 3

Global maxenemies = 2

Global enemiesleft

Global espeed#

Global pspeed# = 2

Global itemx#

Global guimode

Global spriteheight#=GraphicsHeight() Shr 1.0
Global spritewidth#=GraphicsWidth() Shr 1.0

Global RealFPS#
Global RealFrames#
Global RealCountFrameTime=MilliSecs()

Global pmodel


Global im = LoadAnimImage("filmstripi3.png", 32, 32, 0, maxblocks)
MidHandle im

Global background = LoadImage("bricktex.jpg")

Global imbg = LoadImage("filmbg.png")

Global mouseicon = LoadImage("sword.png")

Global okicon = LoadImage("ok.png")

ResizeImage mouseicon, 64, 64
HandleImage mouseicon, 0, 64

If gfxw = 1600
width = GraphicsWidth() Shr 2-ImageWidth(background)/8
height = GraphicsHeight()/1.5
imwidth = 44
imheight = 44
ResizeImage background, width, height
If gfxmode = 2 Then api_MoveWindow(HWND, 0, 0, GraphicsWidth(), GraphicsHeight(), $000A)
Else If gfxw = 1280 And gfxh = 960
imwidth = 64
imheight = 64
ResizeImage im, imwidth, imheight
Else If gfxw = 1152
imwidth = 44
imheight = 44
ResizeImage im, imwidth, imheight
Else If gfxw = 1024
width = GraphicsWidth()/4-ImageWidth(background)/8
height = GraphicsHeight()
imwidth = 44
imheight = 44
ResizeImage background, width, height
ResizeImage im, imwidth, imheight
Else If gfxw = 720
width = GraphicsWidth()/4-ImageWidth(background)/8
height = GraphicsHeight()
imwidth = 44
imheight = 44
ResizeImage background, width, height
ResizeImage im, imwidth, imheight
Else If gfxw = 400
width = GraphicsWidth() Shr 1-ImageWidth(background)/8
height = GraphicsHeight()
imwidth = 32
imheight = 32
ResizeImage background, width, height
ResizeImage im, imwidth, imheight
Else If gfxw = 800
width = GraphicsWidth()/4-ImageWidth(background)/8
height = GraphicsHeight()
imwidth = 44
imheight = 44
ResizeImage background, width, height
ResizeImage im, imwidth, imheight
Else
imwidth = 32
imheight = 32
ResizeImage im, imwidth, imheight
EndIf


width = 400
height = 600

Dim playermesh(maxblocks)

;playermesh(0) = LoadAnimMesh("media/ninja.b3d")
;playermesh(1) = LoadAnimMesh("markio/mariorun.x")
;playermesh(2) = CreateCube()
;playermesh(3) = CreateSphere(100.5)

;For i = 0 To 3
;	HideEntity playermesh(i)
;Next

Global player1

Dim playertype$(maxblocks)
playertype$(0) = "Ninja"
playertype$(1) = "Markio"
playertype$(2) = "Cube"
playertype$(3) = "Sphere"

For x = 4 To maxblocks
playertype$(x) = "Sphere"
playermesh(x) = CreateSphere(100.5)
HideEntity playermesh(x)
Next

Dim enemymesh(maxblocks)

Dim enemytype$(maxblocks)

For a = 0 To 3
enemytype$(0) = "Ninja"
enemytype$(1) = "Markio"
enemytype$(2) = "Cube"
enemytype$(3) = "Sphere"
Next

;enemymesh(0) = LoadAnimMesh("media\ninja.b3d")
;enemymesh(1) = LoadAnimMesh("markio\mariorun.x")
;enemymesh(2) = CreateCube()

;For x = 0 To 2
;HideEntity enemymesh(x)
;Next

;Include "includes/Imphenzia_Audio.bb"

Global sky1

Global showbox

Global mh

Global mayturn

Global playerchosen

Global characreate

Global newid

Global welcome

;If maxblocks > 0
;welcome = SFX_Load("media\welcome.wav", "group1", False)
;SFX_Play(welcome,0.5,False)
;EndIf

load_gui()

For x = 0 To maxblocks
If playermesh(x) <> player1 Then FreeEntity playermesh(x)
Next

AmbientLight 255,255,255

Sky = CreateSphere(100)
ScaleEntity Sky,100000, 100000, 100000
;EntityOrder sky, 9
FlipMesh Sky
EntityColor Sky,68,207,252

While Not KeyHit(1)
mh=mousehit(1)
If mh
	width1 = GraphicsWidth()
	height1 = GraphicsHeight()
	For x = 0 To 1
		For y = 0 To maxblocks
			imx = (0.2 * width1) + (0.57 * width1 * x) + (origx#) + (pos_x#)
			imy = (0.07 * height1) + (0.1 * height1 * y) + (origy#) + (pos_x#)
			If ImageRectOverlap(im, imx,imy,mx,my,1,1)
				which = y * 2 + x
			 If which < maxblocks
				selected = which
				oldplayer1 = player1
				If which <> oldwhich Then
				If AnimLength(player1) > 0 Then Animate player1, 3,1,idleanim,1
				For x = 0 To 1
				LoadChar.TChar(playertype$(x),1,"char.ini")
				If playertype$(x)=1
				For myChar.TChar = Each TChar
				positionplayer(myChar\model,myChar\x#,myChar\y#,myChar\z#)
				Next
				EndIf
				Next
;				If which = 0 Then playermesh(0) = LoadAnimMesh("media\ninja.b3d")
;				If which = 1 Then playermesh(1) = LoadAnimMesh("markio\mariorun.x")
;				If which = 2 Then playermesh(2) = CreateCube()
;				If which = 3 Then playermesh(3) = CreateSphere(100.5)
;				HideEntity player1
;				ShowEntity playermesh(which)
;				player1 = playermesh(which)
			
Select which
 Case 0:  Animate player1, 3,1,idleanim,1 : ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 1:  Animate player1, 3,1,idleanim,1 : ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 2: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Case 3: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
 Default: ScaleEntity player1,1.0,1.0,1.0 : PositionEntity player1,1,1,8 : RotateEntity player1,0,-180,0
End Select
					oldwhich = which
				Else If which = oldwhich
					showbox = 1
				EndIf
			EndIf
		 EndIf
		Next
	Next
EndIf
UpdateWorld()
RenderWorld()
Flip
Wend

Function LoadChar.TChar(modelName$,anim1,settingsFile$)
	CharCount = CharCount+1
	If CharCount>=MAXCHARS
		Delete First TChar
		CharCount=MAXCHARS
	EndIf
	Local newChar.TChar = New TChar
	If anim1 = 1
	newChar\model = LoadAnimMesh(modelName$)
	Else
	newChar\model = LoadMesh(modelName$)
	EndIf
	Local inFile%=ReadFile(settingsFile)
    newChar\x#=EntityX(newChar\model)
	newChar\y#=EntityY(newChar\model)
	newChar\z#=EntityZ(newChar\model)
	WriteFloat infilea,newChar\x#
	WriteFloat infilea,newChar\y#
	WriteFloat infilea,newChar\z#
	CloseFile(inFile)
	If Not inFile ;RuntimeError("Unable to load char settings")
	infilea=WriteFile("char.ini")
	newChar\x#=EntityX(newChar\model)
	newChar\y#=EntityY(newChar\model)
	newChar\z#=EntityZ(newChar\model)
	WriteFloat infilea,newChar\x#
	WriteFloat infilea,newChar\y#
	WriteFloat infilea,newChar\z#
	CloseFile(inFile)
	inFile%=ReadFile(settingsFile)
	newChar\x# = Float(ReadLine(inFile))
	newChar\y# = Float(ReadLine(inFile))
	newChar\z# = Float(ReadLine(inFile))
	CloseFile(inFile)
	EndIf
End Function



Stevie G(Posted 2009) [#151]

for the love of God, can somebody please just help me make it so this thing works?



I'm guessing people are getting sick of your attitude!

For x = 0 To 1
				LoadChar.TChar(playertype$(x),1,"char.ini")
				If playertype$(x)=1
				For myChar.TChar = Each TChar
				positionplayer(myChar\model,myChar\x#,myChar\y#,myChar\z#)
				Next
				EndIf
				Next


You are already using x to increment the main loop, I suggest you use another variable name for this part.

Looking at most of your posts I think you really want to start doing something simpler to build up your skills.


Guy Fawkes(Posted 2009) [#152]
no. its the opposite. im getting sick of all YOUR attitudes. alls most of u r, r smartasses, and im sick of it..


Guy Fawkes(Posted 2009) [#153]
and just because ur a smartass, doesnt mean im going to give up because i cant do it. so BACK OFF!


LineOf7s(Posted 2009) [#154]
That's the spirit DSW - keep going! I'm sure there's still a handful of people left in the world somewhere you haven't put off wanting to help you!

You are entitled! Maintain the rage! Who are these people who dare not to <ahem> "provide you with example code"?!!





...or, of course you could actually appear to make an effort to try to fix your code rather than splashing it all over teh internetz and demanding people make it work.

PS: For large sections of code, {codebox} (except using [] instead of {}) is preferred to {code}


Stevie G(Posted 2009) [#155]

no. its the opposite. im getting sick of all YOUR attitudes. alls most of u r, r smartasses, and im sick of it..



and just because ur a smartass, doesnt mean im going to give up because i cant do it. so BACK OFF!



I rest my case ......


Mahan(Posted 2009) [#156]

no. its the opposite. im getting sick of all YOUR attitudes. alls most of u r, r smartasses, and im sick of it..



@DSW - Just for the record:

When I answer to you I provide you with stubs/pseudo code instead of working source code, on purpose.

This is actually because I want to do you a favor, even though it may not seem so right now from your point of view.

What I (and several others too, like Bobysait etc) give you are the building blocks we recommend you to use to solve problems and write good manageable code.

The concepts/patterns/idioms we recommend are not by any means invented by us, but it's the collective "best practice" that developer communities around the world have researched/tried/studied/developed since the dawn of modern computers in the late 50ies.

You probably heard the saying "Give a man a fish and he will have food for one day. Teach him fishing and he'll have food for the rest of his live"?

Giving you a working code (that you'd use without understanding) is equivalent with giving you fish, from that saying.


So maybe you could start with a basic demo involving just a player, the camera, and items to pick up. Then you put this player in Type, and use a list for models.

Once you have this working well, add other entities.



This is solid and sound advice, Bobysait gives. You can (re)use this concept on every technique that you want to try out, by simply writing small test-programs, outside the scope of you current project, to try out the behavior of different language elements etc.

I've been programming professionally for about 15 years now, and I still do this almost daily: Write small programs (like 2-20 lines) to try out if some idea I (or my colleagues) have is suitable for something i (we) intended to use it for.


Now on to your attitudes and bursts of outrage:

I heavily discount those based on what I call lack of experience and young age, and the fact that I too some degree can look back at myself (ages 10-14).

But being balanced and "socially lean" is not only a matter of age (even though matureness, that comes with age, helps a lot).

My main motivation behind trying to be nice to people in general, is actually based on egoism(!) mainly, even if I can enjoy the side effect that others feel good to. The thing is that in normal life you'll get much further with a positive and good attitude (despite drawbacks) than by expressing your "reptilian instincts".

Example: I've been involved in the recruitment process in a company I worked for. We often chose a person with less qualifications over another, just because we felt (from interviews) that the former was more socially lean, and that he would work better in a development team.

I've also seen the opposite, that one person, despite having mad technical skills (and I mean it!), disrupted the work of teams due to lack of compassion and social skills. He ended up sitting for himself in a corner, doing "his" projects, but with very poor possibilities to advance his career.

This is not because I intend to lecture you, DSW, but trying to help you understand the benefits of social competence.

edit: spelling


Ginger Tea(Posted 2009) [#157]
i said to someone else (i think) in some other (now old) thread, i think it was about an mmorpgomgwtfbbq, i remember chasecams being brought up
but i digress

what i said or a paraphrase there of was
start with small projects to get to know the syntax of blitz and what you can achieve with a few lines, then work on expanding that, preferably turning parts of the code into reusable modules
and gave an example of how pong evolved into space invaders

pong a game we should all know, even if we were too young to play it first time round, is fairly similar to breakout (or akrinoid or any other bat and ball game) and the guy who designed space invaders said that when he first saw breakout he had the idea of the 'bricks' firing back at you

so although each game has been remade to death, they are still relevant to evolving your videogame programming skills
crawl before you can walk, walk before you can run, gold medalists wernt born sprinting

and psudo code is brilliant for breaking the cookie cutter mould of cut and paste coding, your given all the information in english and not blitz/other language,
clear the screen
put a sprite at the top left corner
if right arrow key is pressed animate and move sprite along the screen

gets you to understanding screen coordinates, scan codes and loadanimimage
the exact same piece could be in code in the demo folders, but if like me you load it up, run it and play all you are doing is running a program not programming


Bobysait(Posted 2009) [#158]
DSW [Member of ©Xylvan-Corporation] :)


Ross C(Posted 2009) [#159]
Yeah, DSW, your not doing yourself any favours here. Telling guys like Stevie G, he's a smart ass and has a bad attitude. You should LISTEN to these guys. Start small. Actually complete something. Make it a challenge for yourself.

I repeat. You CANNOT under any circumstances, create a project, like a character creator, and know little about how to code it. It will not work. This thread is living proof of it. What do you have to lose by starting smaller? Your still young. And if you keep up at this rate, you will have no-one willing to help you at all. Then you'll be completely snookered.

We know it's the only way you can learn. So learn something ALOT less complicated. Have you made a pong clone? Tetris Clone? If so, post the code here. If not, get cracking, and ask for help. At least you'll be getting somewhere.

Alas, you'll probably take this is another post, DISSing you or whatever. People here are giving you good advice. Listen to them. They are doing it for YOUR benefit.


Flemmonk(Posted 2009) [#160]
i said to someone else (i think) in some other (now old) thread, i think it was about an mmorpgomgwtfbbq, i remember chasecams being brought up


hehe I was waiting for that phrase to be written here. Lolz!

DSW (the great artist of non-tabbed code) all of your code is wrong, I suggest you re-write it, here are your problems, I wont tell you what they are but you have to figure them out for yourself, you can cheat by looking in the Help file under "Functions", it will tell you how to write functions properly.

Inside your function:
	CloseFile(inFile)
	EndIf
End Function


In the place you're looking:
				If playertype$(x)=1


Also in the place you're looking which is useless because of a previous For/Next loop statement and you're not using Types correctly so I suggest you look up those as well in the help:
				For myChar.TChar = Each TChar
				positionplayer(myChar\model,myChar\x#,myChar\y#,myChar\z#)
				Next


Good Luck! ( I know you only learn off example of code, but the Blitz Community wont change, so you will have to change your ways of learning).


Guy Fawkes(Posted 2009) [#161]
u know what? i dont CARE what u have to say. i will NOT change my ways in learning. none of u understand me.. and i dont mean physically.

so u know what? forget it..


Ross C(Posted 2009) [#162]
I think your being slightly unreasonable here, and somewhat melodramatic.

1. This is a help forum. People give up their free time to help others. Usually quite thoroughly. Warner has put considerable time into helping you with this. He seems to be able to help you in the way you want. I've seen a few other people do the same.

2. You can't lose the plot at people, when, as in point number 1, they are helping you for free.

3. If you can't change your ways of learning, how do you expect other people to change their ways of teaching? Most people just don't have the time to sit down and type out a whole bunch of code, and get it to work how you want.

I think you'll find most folks on here, pretty forgiving, and willing to help you, in the way they teach, should you change your mind.


LineOf7s(Posted 2009) [#163]
...and i dont mean physically

o_O !!


Guy Fawkes(Posted 2009) [#164]
by physically, i mean u dont understand how i learn. so just back the hell off.


LineOf7s(Posted 2009) [#165]
Thankyou for clearing that up.

Happy coding!


Ross C(Posted 2009) [#166]
For the 1,000,000th time. So what if we don't understand how you learn. You don't understand how we teach. Lets call it quits eh? I think you've pretty much exhausted your list of people willing to help you. You have a terrible attitude. I'll put it down to you being young. Come back when you grow up a bit.


_PJ_(Posted 2009) [#167]
Well I guess this was pretty much inevitable.

How many people has DSW said "Back off" to? then wonders when they're not helping?
How many times has advice been given and completely ignored?
Why oh why do you (DSW) still struggle away at code that is clearly beyond your grasp, when ultimately it's clear that you are NOT learning.
I do follow Ross' sentiment
You have a terrible attitude. I'll put it down to you being young. Come back when you grow up a bit.





Flemmonk(Posted 2009) [#168]
DarkShadowWing, have you had a chance to read the help and check the code areas I pointed out? I can elaborate if you require.

I know my help might seem cryptic, but its those links in thoughts and the way of thinking that I find makes people go 'Ding! oh yeah that makes sense!' and 'Ding! oh no, how silly of me, did i really miss that?!!' and it is those Dings! that we remember for the future.

If the 'dings' aren't happening for someone, it is usually the cause of one of two things, one, the individual does not have sufficient knowledge of the Blitz3D language or coding in general, or two, coding just isn't meant for some individuals.

Now this is not to say you should pack up your bags, but perhaps you need to get some basics down pat first. I haven't read this book myself and not sure if it is of any help but at the bottom of the Products page above is "Blitz3D Programmers Manual ($19.99 USD)".

I hope you read messages these people post and not just check them for code, some people go to alot of effort to write replies and genuinely try to help.


Chroma(Posted 2009) [#169]
coding just isn't meant for some individuals

I disagree.


I hope you read messages these people post and not just check them for code

It's no secret that this forum has a lot of jackasses in it. All you can hope for is that they post some relevant code and just ignore their sarcasm they post along with it. But most of the time they just spout off and leave you hanging. It's very common here.


Guy Fawkes(Posted 2009) [#170]
and for the 1M time, Ross. Damn right I have a bad attitude. It's because of people like these (not naming names) who are jackasses..

And u know what? If I had a forum, I sure as HELL wouldn't run it like this.

Yea, Chroma... So fucking true..

I'm tired of it. So say what u want..

I DONT CARE..


Ginger Tea(Posted 2009) [#171]
i get your way of learning (or the way i see it from how you described) thats the hard part about teaching programming
you learn from looking at someone elses pre written code, but it feels like we are being asked to code an example for you to learn from, which in all fact is the answer, you might learn from it, but crikie you might as well just cut and paste it into your code as is.

psudo code is probably the best way of doing this, here is the code in full but written in english
or
her is the code but ive blanked out certain functions and other necessary parts and have left them at the bottom of the code for you to use
then all you have to do is look at the function and the list of options and figure out if blabla1 is print input or whatever seems the most relevant and all blabla1's would be the same.

i did something like this in another thread (perhaps one of yours?)
stealing the concept from spoken language books
"hello my blank1 is ginger tea, how blank2 are blank3?

options
name are you

if you were learning english that would be relevant

as i just said a moment ago a more relevant option would be working code with bits dropped out
how are we to know that when presented with working code you dont just hit the rocket and go "yep that works" and paste it in and not actually look at it and go hmm what does this do and change a variable to see what its really connected to.
short we dont.

if we give you "broken" code that you HAVE to fix, it means you are working for the prize and not given gold medal status for running just for showing up.

and tbh im surprised this hasnt been locked ... it even had xylvians name brought into it and that alone used to be enough to hear keys jangling


Guy Fawkes(Posted 2009) [#172]
say what u want. i dont give a damn anymore..


Ginger Tea(Posted 2009) [#173]
your loss but tbh when your next project comes unglued as it has in the past, all i can sugest to those willing to help is to create a fully working piece of code/snippet and intentionally bork it so you have to look and understand how its borked*
its the best option for your learning method anything else is just giving you the answer.

not knowing enough about the syntax alone can mean simple typeo's become utter nightmares bug hunting

seriously have you started small like weve asked and sugested, jumping head first into an mp3 visualisation then something else then this is a bit deependish

if you were to be making a fps and were coding in c id just link you to the doom and quake source files that id posted many years ago and leave you to it.

*edit: and i dont mean maliciously broken, just wrong in one or two parts that can be found and fixed with a little understanding of blitz
commented code even better ;)

also i decided to go over a few of your older project threads, turns out it was you whom i originally did the language book analogy for
again code borking ala this method with foobar1 foobar2 ect
find foobar1 replace with command replace all
find foobar2 ditto
repeat

and whilst reading my comments i remembered i had a few projects on hold and for that matter, on hold for over 8 months ... sheesh where did my year go (work and the pub mostly)

you go to school to learn then take an exam to assess what youve learnt, never, ever, ever, should the multiple choice exam sheet be filled out for you
if i could be bothered id make an example bit of code up one which works and 3 which dont, even if its a rogue ; somewhere mid line


Bobysait(Posted 2009) [#174]
I apologize, I didn't know DSW could learn just splashing lines and lines of code... so , this is my contribution . you can use it for your waypoints if you dare.

I think this will be very usefull for every noobs is a web :)



have fun ^^
It is full of type, label, function, matrix pointer and there is also projections and conversions 3d to 2d . It is a good way to learn a lot of things ...


Guy Fawkes(Posted 2009) [#175]
actually. that is a very good post. but im still quitting. so forget about it..


Kryzon(Posted 2009) [#176]
Everyone, STOP POSTING HERE.

ENOUGH!!!!1


Guy Fawkes(Posted 2009) [#177]
pfft. ur not a mod. let the mod take care of it. u other people are treating me bad, so im gonna treat u bad.


Guy Fawkes(Posted 2009) [#178]
and now, kryzon, u see how I feel EVERY SINGLE FREAKIN DAY!