05-27-2008, 11:10 AM
ok so, i've been busy, and haven't had time to update it, but in the near future I would be trying to optimize the engine by using arrays instead of arraylists (technical terminology which u don't have to worry about) which i'm using now (arrays are faster according to Chiko). For data, it already is all stored into arrays, but not the sprites, so that's one thing.
then I'll have to set up the basic stuff (jumping and running aren't working yet. dunno how jumping works; running shouldn't be too hard). oh and for walking and running, I think I won't make it like lf2, coz then i can save just that bit of processing time for the loop. instead i made it be frames 5~10 for the whole thing (5-6-7 is left leg forward, 8-9-10 is right leg forward) i.e. in normal pic setup it'll be pic 4,5,6,7,6,5,4 corresponding to the frames.
anyways, a small preview of the data format:
for now, u only can set up one bdy area. ax, ay, az replace dvx, dvy, dvz (dv = a =S). mass is the character's mass, so like, if u're heavy, u'll fall down to the ground faster.
bdy thingy- (corresponding to lf2 values)
x1: x
x2: x+w
y1: y
y2: y+h
z1: centery - zwidth (not listed but exists, it's default to centery - 6 unless u declare this tag)
z2: centery + zwidth (not listed but exists, it's default to centery + 6 unless u declare this tag)
course, in lf2 zwidth is default at 12 (which means z1 in lf2 is centery - 12).
and also there's some stuff u have to note: the platform thingy is complicated, so like, it uses your x,y,z coodinate (which is somewhere about centerx centery and "z" value) to determine your "floor" position). for this reason, it makes you fall downwards towards the ground if your y value is smaller than your floor value, but then it also makes u stop "moving" if your bdy is within a "floor"'s area. (which is a 3d block thingy, like itr kind 14). however, my thingy doesn't work like lf2's itr kind 14. in lf2 if u move, it moves u one frame before it checks if u're blocked by the itr kind 14. if u are then on the following frames it stops you from moving. my algorithm is, it moves u data wise, then if your new position is in the itr kind 14 area, it moves u back, as though u didn't move at all (this is done in processing, so when it draws the images to the screen, you see your character as it didn't move at all (look at previous video)).
oh and background data preview (if i must):
there u can see ur z1 and z2 tags. and u define rect angles with r,g,b values. layers are always rendered behind characters, and sprites are used for the "floor"s, which are essentially platforms. oh and if the pic # doesn't exist, it just won't draw anything (just like lf2).
on top u can see there's s_fric_x and s_fric_z. That's static friction, which is um, the rate ur character will slow down when he's on the ground if his vx or vz is > 0 (magnitude wise). so like if u're in the air, your character has no friction working against it (i didn't implement air resistance =\) so he moves at a constant speed.
there's a bug i just found out which is when you jump into a platform as a wall, instead of stopping you moving into the wall and letting you continue moving in the upwards direction (i.e. you stop moving into the wall but still move vertically up), your character just "sticks" to the wall.
so, future update list:
-make a menu
-make controls definable
-fix the bug
-make scrolling possible
-running
-jumping
-engine optimization
-sound
-etc.etc.etc.
yea that's basically it for today. I gotta go sleep. (I had to reprogram my whole computer studies assignment coz it wasn't user friendly >.>)
Azriel~
then I'll have to set up the basic stuff (jumping and running aren't working yet. dunno how jumping works; running shouldn't be too hard). oh and for walking and running, I think I won't make it like lf2, coz then i can save just that bit of processing time for the loop. instead i made it be frames 5~10 for the whole thing (5-6-7 is left leg forward, 8-9-10 is right leg forward) i.e. in normal pic setup it'll be pic 4,5,6,7,6,5,4 corresponding to the frames.
anyways, a small preview of the data format:
Code:
comment {
test character.
}
header{
name: Bandit
mass: 60
type: 0
}
sprite {location: res/actor/bandit_0.gif w: 79 h: 79 row: 10 col: 7}
movespeed {
walk_x: 4 walk_z: 2
run_x: 8 run_z: 1.3
}
frame 0{
bsc [pic: 0 state: 0 wait: 5 next: 1 centerx: 39 centery: 79]
bdy [x1: 21 x2: 64 y1: 18 y2: 78]
}
frame 1{
bsc [pic: 1 state: 0 wait: 5 next: 2 centerx: 39 centery: 79]
bdy [x1: 21 x2: 64 y1: 18 y2: 78]
}
frame 2{
bsc [pic: 2 state: 0 wait: 5 next: 3 centerx: 39 centery: 79]
bdy [x1: 21 x2: 64 y1: 18 y2: 78]
}
frame 3{
bsc [pic: 3 state: 0 wait: 5 next: 999 centerx: 39 centery: 79]
bdy [x1: 21 x2: 64 y1: 18 y2: 78]
}
frame 5{
bsc[pic: 4 state: 1 wait: 2 next: 6 ax: 0 centerx: 39 centery: 79]
bdy[x1: 28 x2: 55 y1: 15 y2: 78]
}
frame 6{
bsc [pic: 5 state: 1 wait: 2 next: 7 ax: 0 centerx: 38 centery: 79]
bdy [x1: 28 x2: 55 y1: 15 y2: 78]
}
frame 7{
bsc [pic: 6 state: 1 wait: 2 next: 8 ax: 0 centerx: 39 centery: 79]
bdy [x1: 28 x2: 55 y1: 15 y2: 78]
}
frame 8{
bsc [pic: 7 state: 1 wait: 2 next: 9 ax: 0 centerx: 42 centery: 79]
bdy [x1: 28 x2: 55 y1: 15 y2: 78]
}
frame 9{
bsc [pic: 6 state: 1 wait: 2 next: 10 ax: 0 centerx: 39 centery: 79]
bdy [x1: 28 x2: 55 y1: 15 y2: 78]
}
frame 10{
bsc [pic: 5 state: 1 wait: 2 next: 5 ax: 0 centerx: 38 centery: 79]
bdy [x1: 28 x2: 55 y1: 15 y2: 78]
}
frame 210{
bsc [pic: 60 state: 4 wait: 1 next: 211 ax: 0 ay: 0 centerx: 39 centery: 79]
bdy [x1: 33 x2: 53 y1: 33 y2: 77]
}
frame 211{
bsc [pic: 61 state: 4 wait: 1 next: 212 ax: 0 ay: -16.299999 centerx: 39 centery: 79]
bdy [x1: 33 x2: 53 y1: 33 y2: 77]
}
frame 212{
bsc [pic: 62 state: 4 wait: 1 next: 0 ax: 0 ay: 0 centerx: 39 centery: 79]
bdy [x1: 31 x2: 52 y1: 15 y2: 78]
}
for now, u only can set up one bdy area. ax, ay, az replace dvx, dvy, dvz (dv = a =S). mass is the character's mass, so like, if u're heavy, u'll fall down to the ground faster.
bdy thingy- (corresponding to lf2 values)
x1: x
x2: x+w
y1: y
y2: y+h
z1: centery - zwidth (not listed but exists, it's default to centery - 6 unless u declare this tag)
z2: centery + zwidth (not listed but exists, it's default to centery + 6 unless u declare this tag)
course, in lf2 zwidth is default at 12 (which means z1 in lf2 is centery - 12).
and also there's some stuff u have to note: the platform thingy is complicated, so like, it uses your x,y,z coodinate (which is somewhere about centerx centery and "z" value) to determine your "floor" position). for this reason, it makes you fall downwards towards the ground if your y value is smaller than your floor value, but then it also makes u stop "moving" if your bdy is within a "floor"'s area. (which is a 3d block thingy, like itr kind 14). however, my thingy doesn't work like lf2's itr kind 14. in lf2 if u move, it moves u one frame before it checks if u're blocked by the itr kind 14. if u are then on the following frames it stops you from moving. my algorithm is, it moves u data wise, then if your new position is in the itr kind 14 area, it moves u back, as though u didn't move at all (this is done in processing, so when it draws the images to the screen, you see your character as it didn't move at all (look at previous video)).
oh and background data preview (if i must):
Code:
header {
name: Great_Wall
xmin: 0 xmax: 2400
ymin: 288 ymax: 800
zmin: 16 zmax: 168
s_fric_x: 2.5
s_fric_z: 1.1
}
layer {location: res/bg/gw/sky.gif x: 0 y: 128}
layer {location: res/bg/gw/hill1.gif x: 0 y: 142}
layer {location: res/bg/gw/hill2.gif x: 800 y: 142}
rect {
r: 154 g: 110 b: 90
x: 0 y: 324 w: 2400 h: 154
}
shadow {res/bg/gw/s.gif}
sprite {location: res/bg/gw/road1.gif w: 235 h: 154 row: 1 col: 1}
sprite {location: res/bg/gw/road2.gif w: 93 h: 68 row: 1 col: 1}
sprite {location: res/bg/gw/road3.gif w: 104 h: 36 row: 1 col: 1}
floor {
pic: 999 x: 0 y: 0
x1: -1 x2: 2401
y1: 477 y2: 478
z1: -1 z2: 169
}
floor {
pic: 0 x: 0 y: 171
x1: 0 x2: 38
y1: 477 y2: 478
z1: -104 z2: 28
}
floor {
pic: 1 x: 235 y: 256 width: 2400 loop: 93
x1: 235 x2: 2401
y1: 410 y2: 478
z1: 17 z2: 17
}
floor {
pic: 2 x: 0 y: 442 width: 2400 loop: 104
x1: 0 x2: 2401
y1: 454 y2: 478
z1: 164 z2: 169
}
floor {
pic: 2 x: 0 y: 342 width: 2400 loop: 104
x1: 0 x2: 2401
y1: 454 y2: 478
z1: 64 z2: 69
}
there u can see ur z1 and z2 tags. and u define rect angles with r,g,b values. layers are always rendered behind characters, and sprites are used for the "floor"s, which are essentially platforms. oh and if the pic # doesn't exist, it just won't draw anything (just like lf2).
on top u can see there's s_fric_x and s_fric_z. That's static friction, which is um, the rate ur character will slow down when he's on the ground if his vx or vz is > 0 (magnitude wise). so like if u're in the air, your character has no friction working against it (i didn't implement air resistance =\) so he moves at a constant speed.
there's a bug i just found out which is when you jump into a platform as a wall, instead of stopping you moving into the wall and letting you continue moving in the upwards direction (i.e. you stop moving into the wall but still move vertically up), your character just "sticks" to the wall.
so, future update list:
-make a menu
-make controls definable
-fix the bug
-make scrolling possible
-running
-jumping
-engine optimization
-sound
-etc.etc.etc.
yea that's basically it for today. I gotta go sleep. (I had to reprogram my whole computer studies assignment coz it wasn't user friendly >.>)
Azriel~