-
3 Attachment(s)
Labyrinth Preview
Hi Eros,
I don't want anyone to get crazy so here is the code :)
Of course it was designed as the bug correction test ... so anybody who want's to test he must install at least thinBASIC 1.0.9.5 preview, because only with that you will get proper single line IF handling.
Thanks Eros for ( as always ) super fast debug and release !
Bye,
Petr
P.S. The code is quite large, so you bet I will update it and comment with some tutorial on TBGL pages in next weeks
P.P.S. Features of the latest version
:arrow: type variables for collision data storage
:arrow: particles and reflections
:arrow: shooting ( even in slow-motion now)
:arrow: spectacular explosions :)
:arrow: enhanced fileformat supporting multiple textures in level, even fog effects
-
Labyrinth Preview
Wow,
great! The wrong forum is pardoned. :lol:
Roberto
-
Labyrinth Preview
Hi Roberto,
thanks, how could it occurr to you I posted in wrong forum, it contains code which was executed in bad way with previous versions :lol:
It seems my expression "Of course it was designed as the bug correction test " was a bad camouflage :D
Bye,
Petr
-
Labyrinth Preview
Thread splitted from Bug Report forum.
-
Labyrinth Preview
Petr,
wow, wow, wow. That's what I want to see!!!!
I will use this code to study new technique for speeding up again code execution. I want is fast, faster, fastest.
On my new laptop it runs at 55/60 FPS. I will test on other machines.
An info: what is the meaning of the symbold inside .world file?
. is open space
# is a wall
The others?
Ciao
Eros
-
Labyrinth Preview
Hi Eros,
the format is little bit messy, I just used "level", which friend of mine uses for some AI program in Java. He had "just" 2D output in Java, so we settled it would be nice to watch replay of movements of robots in the labyrinth in 3D, both using robot fixed camera and overall view of the labyrinth.
The format of level is following:
First row:10X20Y means level is described as field of 10x20 characters
Second row:Whatever, originally some more numeric data
Next rows:
# is wall, only tiles with this character will be bumped as wall at this time
. is generally free space
g as "gold", treasure for the robots
b as "battery", energy source for robots
r,l,u,d are initiall positions of the robots, facing right,left,up and down
Of course in the preview there are no robots, treasures and batteries at the time, I want to create fully animated mechanical beasts in thinEdge and then put them there :)
Bye and thanks for moving the topic to place where it belongs :),
Petr
P.S. The main bottleneck of posted source is the particle engine, if you set %MAXPARTICLES to one, it will run much faster. I have to optimize it more, even the collision map should be arranged a little bit.
-
Labyrinth Preview
Too serius people live here, for me no problem for the 'post area', just a little witticism :D
I got an error on line 137 Token X, I'll have to check may be it's due to wrong version of my TB.
Regards,
Roberto
-
Labyrinth Preview
Hi Roberto,
yes, it is ideal to run this script under latest version, for example 1.0.9.5.
The older ones had problems with single line IF statement, and this caused the problem with "X" member of TYPE variable
Petr
-
Labyrinth Preview
I would like to add lateral moving with CTRL key.
I mean if CTRL+LEFT move lateral LEFT without turning left, if CTRL+RIGHT move lateral RIGHT without turning right.
How to do?
Eros
-
Labyrinth Preview
Hi Eros,
good suggestion. All modern first person shooters allow this kind of move.
The solution is pretty simple, just update the code in control checking area with this:
[code=thinbasic]
IF GETASYNCKEYSTATE(%VK_RIGHT) THEN
IF GETASYNCKEYSTATE(%VK_CONTROL) THEN ' straffing
CamPosX = CamPosX + 1.5/FPSCount * SIN(CamAngleLR+1.57)
CamPosZ = CamPosZ + 1.5/FPSCount * -COS(CamAngleLR+1.57)
ELSE
CamDeltaAngle = 2/FPSCount
END IF
END IF
IF GETASYNCKEYSTATE(%VK_LEFT) THEN
IF GETASYNCKEYSTATE(%VK_CONTROL) THEN ' straffing
CamPosX = CamPosX + 1.5/FPSCount * SIN(CamAngleLR-1.57)
CamPosZ = CamPosZ + 1.5/FPSCount * -COS(CamAngleLR-1.57)
ELSE
CamDeltaAngle = -2/FPSCount
END IF
END IF
[/code]
If CTRL is not pressed, it will behave as usually
If yes, it will simply move camera in direction perpendicular to current vector of movement.
CamAngleLR as angle of camera for left right moves :) is directed right forward, by adding/substracting ~half of famous number Pi ( Pi/2 in radians equals to 90 degrees ) we will move by side by distance of 1.5/FPSCount ( move relative to actual frame rate )
Hope this is what you wanted,
Petr