2d sidescroller engine in progress: DKC2 remake. Test dev.

Started by LemonWizard, January 01, 2012, 03:30:37 AM

Previous topic - Next topic

buggage

QuoteAnd would you believe after about 3 or 4 hours of coding and preparing more graphics by focusing the sprites properly in seperate frame images, I'm not even done getting all the sprites for dixie yet?

http://www.mariouniverse.com/sprites/snes/dkc2

http://sdb.drshnaps.com/display.php?object=7654

Will these help?


LemonWizard

UPDATE

I fixed a glitch where barrels were falling off of platforms because the checking system I had to see if they landed was ONLY within visible screen boundaries.
Believe it or not this wasn't a result of putting the collision code in the drawing routine but it was however a result of trying to use the same collision code that works for the player in this.
now I need to set up an input configuration screen because the controls are getting a bit er... for editing. Yeah..

So far you can check the index of a barrel object, and view it.
I'm going to put an official "object" viewer into the engine next so that it displays different objects you have selected and give the game engine a better input handling system.

Where, the input is collected at the start of the loop, and then stored in memory.

Then, a few crucial input checking steps will take place before the engine decides which input is the most valid.

Fix a few graphical glitches and finish polishing up dixie's grab sprites. WOO. Progress.
Phew.

This is the first and only platforming engine I've seen say other than terraria where an object can fall an extremely long distance, and still be accounted for off screen. Granted I play alot of super nintendo games, and in most of those games objects that are on screen don't end up staying in memory very long if you go too far.

I also figured out how to create a respawn system for enemies, so that when a player goes offscreen even if the enemy has moved away from it's original path or starting point it gets placed back.
We're going to have some fun with this in the next few days if moving doesn't take up all my time! :P BY WE I MEAN ME and anyone else who tries this out.
Once I get some of the other game mechanics worked out I'll fix up the banana system and life system, and start adding in baddies. Such as bees,

LemonWizard

Quote from: buggage on January 20, 2012, 05:46:22 PM
QuoteAnd would you believe after about 3 or 4 hours of coding and preparing more graphics by focusing the sprites properly in seperate frame images, I'm not even done getting all the sprites for dixie yet?

http://www.mariouniverse.com/sprites/snes/dkc2

http://sdb.drshnaps.com/display.php?object=7654

Will these help?



Yes it would help thank you but I've already seen those two sites.
More less, the work involves taking those sprite sheets and splitting each image into a frame and then figuring out the offsets for that frame and animating it, or editing the sprite within the frame so it's centered right for each frame in the anim.


LemonWizard

Here's an update.
I got the tiles and some backdrops from the brambles levels in dkc2.
Meaning, 2d paralex layered scrolling is being integrated.
I also fixed dixie's walk/run speed.
I fixed the bug where barrels weren't landing on platforms that were off screen and a bug while in collision mode where if you placed a platform below a barrel that was already on a platform the barrel would fall through the platform it was on in favor of the next one down. Mind you (This bug could be a feature in another game sometime down the road )
Dixie can now pick up barrels facing both ways but it's a bit buggy same with putting down barrels.

Here's a screenshot showing her proudly holding up her first barrel in this engine and in the brambles scene with bananas, No brambles tiles integrated yet but tonight I'll either put tiles into the game engine (maybe :/) or enemies. Who knows.. who knows indeed ^^; we'll see.
Keep in mind, alot of the code for dixie's sprite is very sketchy right now since it's still WIP.
I'm getting closer to perfecting a few things though about the way she moves and making it closer to the original.

Here's a screenshot!!!


LemonWizard

And more progress.

I got some kind of a tile system integrated.

It's going good.

Tiling with the brambles tileset isn't exactly the easiest though. I think I'm missing a few.
Screenshot

LemonWizard

I've added tiles to the game engine, and now I have a video showing them off. And a few other things about the game engine as well.
Enjoy.

Who would have thought playbasic was capable of this?
And this is only the start.

http://youtu.be/mTRRzKzNNg8


LemonWizard

and now there's been an update.
I added bees, the bugs that walk around, beatles.
I added a better tile editing system.
A second screen for picking objects. (Woo)

You can now select one of four barrels.
No screenshot because my eyes burn like crazy I've been at this forever. I'm infact making this post then sleeping. Don't worry I do get sleep.
Anyhow..

Basically I added a ton of new cool stuff and here's a download link:

http://www.filefactory.com/file/c2b1507/n/Alpha_0.01.rar

The controls are this

Collision mode:
Left click: Places solid green tiles
Right click: moves dixie to your location
Arrow keys (Scroll the map)

Tile editing mode:
Press the / key on your numblock pad and it lets you pick and place tiles.
Use the up or down arrow keys on your numpad, to move the tiles themselves around (TO scroll within the tile selection area)
Left click on the level: Places a tile
Left click on the tile selection: Selects a tile
Pretty straightforeward.

Play mode:
Spacekey is helicopter spin (hold)
Left and right keys (move left and right)
Upkey: Jump
Space key while facing a barrel : pick up the barrel
Down key while holding the space key: put the barrel down
Jump,  hold foreward and space: helicopter spin left or right, say across large gaps? ;)

How to access a second menu:

Left Shift key or right Shift key will change between viewing the tile selection menu or the barrel selection menu.
Controls for selecting a barrel.
Left click on a barrel of the type of your choice.
Then, left click, anywhere in the level editing area. (The area where you see all the brambles and the sky moving)
When your satisfied with where the barrel is, right click. Anywhere, doesn't matter.
The barrel will get de selected and voila.

To test it, make sure you're in collision mode and right click above the barrel. This will move dixie to it. If you fall down, Press enter to get to the top of the level OR just use the arrow keys (WHILE IN COLLISION MODE REMEMBER) and the right mouse button to bring dixie where you want her.
Then, let her hang in mid air in collision mode above your barrel or beside it, and then click on playmode.

Although it is to be noted the barrels will BLAST you and move your view across the screen even if you aren't in collision mode, so keep dixie away from those blast barrels until you're ready! Alright guys... I HOPE that you will try this out. I'm working really hard on this.
And it's not even close to being complete yet. It kind of feels unreal that I'm pulling this off hehe.



NOTE: Right when the editor starts your in view mode YOU Have to click on collision mode to activate it.
See all those barrels and bugs falling? I would quickly place platforms below them by using the arrow keys to scroll past them and placing solid tiles below them in a row.
The save feature is bugged right now. Sorry!

Oh yes. I added bees.
Don't worry they won't hurt you.

Cya for now.

LemonWizard

Current Code:

PlayBASIC Code: [Select]
; PROJECT : Castle Crush
; AUTHOR : NA
; CREATED : 12/27/2011
; EDITED : 1/23/2012
; ---------------------------------------------------------------------
openscreen 1024, 768, 32, 1
;castle=loadnewfximage("castlecrush.png")
openscreen 1024, 768, 32, 1
;castle=newfximage(12000, 500*16)
;rendertoimage castle
cls rgb(255, 255, 255)
;imagemaskcolour castle, rgb(255, 0, 255) ;purpleish?
;imagemaskcolour castle, rgb(255, 255, 255) ;white
mode=loadnewfximage("mode.png")
HEIGHT=500*16
WIDTH=12000
save=loadnewfximage("save.png")
playmode=loadnewfximage("Playmode.png")
grid=false
backdrop=loadnewfximage("Sprites/Bramble_backdrop.bmp")
imagemaskcolour backdrop, rgb(255, 255, 255)
sky=loadnewfximage("Sprites/Bramble_sky.bmp")
levelname$="castle crush"
wallx=0
wally=0
bananatimer=timer()+30
spinframe=1
spinframetimer=timer()+30
maxhelicopterfall=4
barreli=loadnewfximage("Sprites/barrel.bmp")
imagemaskcolour barreli, rgb(255, 255, 255)
dixieholdingbarrel=false
barrelwidth=30
barrelheight=39
pickingup=false
puttingdown=false
barrelfalltimer=timer()+30
fallspeed=1
menu=1 ;menu means current view of objects/tiles/sprites


inbarrel=false



tiles=loadnewfximage("Sprites/Tiles Editing.bmp")
dim tiles(598)

tile=1
rendertoimage tiles
for tempx=1 to 23
for tempy=1 to 26
x1=(tempx-1)*32
y1=(tempy-1)*32
x2=tempx*32
y2=tempy*32
;x1=x1+tempx ;account for white space
;y1=y1+tempy ;account for white space
;x2=x2+tempx ;account for white space
;y2=y2+tempy ;account for white space
tiles(tile)=newfximage(32, 32)

getimage tiles(tile), x1, y1, x2, y2
imagemaskcolour tiles(tile), rgb(255, 255, 255)
tile=tile+1
;if tile>598 then tile=598
;sync
next tempy
next tempx

rendertoscreen
deleteimage tiles



dim dixieright(18)
dim dixieleft(18)
for temp=1 to 18
dixieright(temp)=loadnewfximage("Sprites/dixieframe"+str$(temp)+".bmp")
imagemaskcolour dixieright(temp), rgb(255,255, 255)
dixieleft(temp)=newfximage(55, 45)
copyimage dixieright(temp), dixieleft(temp)
mirrorimage dixieleft(temp), 1, 0
next temp


dim dixiejumpright(4)
dim dixiejumpleft(4)

for temp=1 to 4
dixiejumpright(temp)=loadnewfximage("Sprites/dixiejump"+str$(temp)+".bmp")
imagemaskcolour dixiejumpright(temp), rgb(255, 255, 255)
dixiejumpleft(temp)=newfximage(55, 74)
copyimage dixiejumpright(temp), dixiejumpleft(temp)
mirrorimage dixiejumpleft(temp), 1, 0
imagemaskcolour dixiejumpleft(temp), rgb(255, 255, 255)
next temp

;load and flip dixie's spinning animations for hovering helicoptering


dim dixiespinright(10)
dim dixiespinleft(10)
for temp=1 to 10
dixiespinright(temp)=loadnewfximage("Sprites/dixiespin"+str$(temp)+".bmp")
dixiespinleft(temp)=newfximage(getimagewidth(dixiespinright(temp)), getimageheight(dixiespinright(temp)) )
copyimage dixiespinright(temp), dixiespinleft(temp)
mirrorimage dixiespinleft(temp), 1, 0
imagemaskcolour dixiespinright(temp), rgb(255, 255, 255)
imagemaskcolour dixiespinleft(temp), rgb(255, 255, 255)
next temp


dim dixiepickupbarrelright(14)
dim dixiepickupbarrelleft(14)

for temp=1 to 14
dixiepickupbarrelright(temp)=loadnewfximage("Sprites/dixiepickupbarrel"+str$(temp)+".bmp")
dixiepickupbarrelleft(temp)=newfximage(getimagewidth(dixiepickupbarrelright(temp)), getimageheight(dixiepickupbarrelright(temp)) )
copyimage dixiepickupbarrelright(temp), dixiepickupbarrelleft(temp)
mirrorimage dixiepickupbarrelleft(temp), 1, 0
imagemaskcolour dixiepickupbarrelleft(temp), rgb(255, 255, 255)
imagemaskcolour dixiepickupbarrelright(temp), rgb(255, 255, 255)
next temp



dim barrel_(4)
barrel_(1)=loadnewfximage("Sprites/Barrelup.bmp")
barrel_(2)=loadnewfximage("Sprites/Barreldown.bmp")
barrel_(3)=loadnewfximage("Sprites/Barrelleft.bmp")
barrel_(4)=loadnewfximage("Sprites/Barrelright.bmp")
for temp=1 to 4
imagemaskcolour barrel_(temp), rgb(255, 255, 255)
next temp





;load zingers graphics

dim zingerfacesleft(3)
dim zingerfacesright(3)
for temp=1 to 3
zingerfacesleft(temp)=loadnewfximage("Sprites/zingerframe"+str$(temp)+".bmp")
Login required to view complete source code



TODO:
new flow chart for dkc2 engine

GUI changes

Tile placement

Collidable tiles

Scrolling

These are all fine
as soon as you click inside the tiles it should switch to tile placement.
not sure though hm..

We'll have objects window.

Objects: Solid blocks         CHECK/INPROGRESS
Sprites: Enemies
Objects: Tile hurt player      CHECK/INPROGRESS
Objects: Banana            CHECK/INPROGRESS
Objects: Coin
Objects: DKCOIN
Objects: Red/Green/Blue balloons
Objects: Target/finish
Objects: Start Location       CHECK/INPROGRESS
OBJECTS: Regular Barrel Grab/Throw/pickup/putdown CHECK/INPROGRESS
OBJECTS: Blast Barrel all direction   CHECK/INPROGRESS


List of enemies to add:
Zinger stationary          CHECK
Zinger flying foreward/up/down/paths    CHECK
Mosquitoes.
Necky
cannonball guy firing slow
cannonball guy firing fast
Sneak
BUG               CHECK


Two Screenshots

1:
Dixie about to jump into a blast barrel (still in debug mode)


2:
Beatles standing on platform with dixie and walking:


LemonWizard

So no new screenshots yet been busy with school and physical life.. and actual life stuff.
XD
But lots of planning.

Finally figured out a way to add some versatility to the game engine.
From now on once I update it, new sprites and whatnot will use framesheets for their animations.
They will have their own object.
I'll initiate 100 or so (however many special types there needs to be) for each character.. and parse a scripting file which
defines their type's attributes.
Which will make it easier for me to create new framesheets that are linked to objects.
Also.. every sprite in game will go through an object engine when I'm done creating it.
The object engine will process sprite events versus having them all hard coded.

in order for this to happen I need to code up an object event layer.
So as follows it will handle these things:

velocity
collision
input
scripts
sprite frames
sprite movement

Unfortunately for most of the engine, as it's already been built heavily up off the ground not everything can pass through the object engine.

I have to re code how collision checks work in order to link collision to the object engine.
Or do checks, during the collision checking loop of the game engine's core, and call the object engine to reference points.
This might save time in the long run since the collision check could not only speed up the checking of character objects against solid tiles.
But perhaps if the collision check routine was not called during the draw/update routine then it would speed up the draw/update routine.
Making the entire thing speed up.

I'm not sure how I'm going to link it all together since right now I've been using hybrid procedural and object oriented type techniques.
I'm going to re design some of how the game engine should work though now that I have a proto type to work with and draw logic from.

The goal in the end is to have more readable code, which is easier to maintain and more functional.

I think I've come a long way with my programming abilities and I do believe that this is why I am able to pursue such an undertaking now.

Things to look for if I do finish this will be an incredibly flexible game engine created in playbasic which handles and covers 2d hitbox based collision with basic physics and movement. Etc. framesheet loading/saving. scripts. and a few other tricks.
I have a long way to go on the design of this thing but it's getting there.
The next thing I might want to look into is actually setting up triggers for scripts, which allow multiple actions such as :

Beescript.txt->

:condition
PLAYERHIT
:actions
Playsound:Playerdie
PlayANIM Target: Player ANIM: Playerdie
ENDSCENE
MSG_ENGINE_MAIN(level_end)


A scripting language like that would be ideal for this type of game..

micky4fun

Hi all

LemonWizard , this looks cool , looks quite involved , wish you luck with this game , keep the good work up
will keep an eye out for updates

mick :)

LemonWizard

I haven't had much time for forums, or programming because of math courses. Blareghh.

I am working on a few things, so this project is on the side at this time. Unfortunately.
HOWEVER I will be getting back to it quite quickly.. once summer starts. YAY summer.


There are a number of things that need improvement in the game engine itself and as I've posted before it needs re structuring or the project will be hard to maintain. I can't wait to continue working on this.