Release of DKC2 WIP Code PLUS Tutorial Video /review

Started by LemonWizard, May 09, 2017, 06:38:31 AM

Previous topic - Next topic

LemonWizard

DOWNLOAD LINK HERE
http://www.filedropper.com/dkc2engineupdate_1
Updated the download link it should work now sorry about this.
This was compiled with playbasic compiler version 1.64P3 and IDE version 1.1.7b

CODE BELOW
Note: It uses resources so you require the actual download to run it.
Also note: I haven't worked on this in quite some time I just added the framerate limiter because it was way too fast.
Have fun! Explanation of controls is below the code.

If any of you are feeling adventerous maybe you can tweak it or add more things.
Additionally here is a video demonstrating the way the objects engine in the source code works if one were
to add new objects to the engine:

TUTORIAL ON OBJECT ENGINE HERE
https://www.youtube.com/watch?v=Ani0In3RxX8



SOURCECODE BELOW
https://pastebin.com/xCwPqMHJ

CONTROLS /Basics BELOW
This engine is as cleaned up as it's going to get.
Here are the controls:

Enter : Brings your 'player' back up to the top.
Up down left right: Moves dixie
Spacekey: Dixie Jumps
Hold space key after jumping: Dixie's helicopter spin
Left or right shift when on Rambi (Happens un intentionally sometimes) dismount
Note: Being on rambi causes blast barrels to glitch up this is still a huge WIP

When clicking on Collision mode Dixie will move to wherever the right mouse button is held.
When in collision mode the left mouse button will place (green) collidable blocks. These are collision hitboxes for tiles.
To place tiles graphically you need to be in editing mode.
If not then it is just [ ] Actually I remember now to get tile placement turned on you need to press \ on your keyboard.
Lastly you can left click a tile then left click on the map to place it (the tiles are in the right window)
And finally if you hold down the left control button and move the mouse horizontally across the tile select screen you will get
a tile strip.
This can be useful for placing repeating tile patterns fast.

Objects:
The objects edit menu is opened by pressing right shift.
The last object the mouse was over while holding the left mouse button will be the one you get and the selection is somewhat buggy.
The Rambi character will follow the object you selected, it's a bug I haven't removed yet. Dont' worry about it.
To finish placing the object, go to the map with the object you want placed and press the right mouse button.

Debug info: The map X Y and camera X Y I do believe are displayed.
      Also the hitboxes are always rendered this is for testing objects.

Saving doesn't work reliably yet.. atleast.. You'd have to uhm change the code I do believe to get it to load changes.
When you first start the engine up you'll be on the world map.
Press space key to begin playing as prompted.

Lastly, the button "Play Mode" brings you out of collision mode and lets you play.
Beware collision detection with things like blast barrels is still always on so during collision mode do not hold the right mouse button
near objects like blast barrels unless you want dixie to collide with them.
That's pretty much it have fun!

kevin


LemonWizard

Quote from: kevin on May 09, 2017, 07:38:14 AM

can't download it

I just re-checked the link see if this one works, I changed it:
http://www.filedropper.com/dkc2engineupdate_1

kevin


  Had look through... It runs here, but really really slow.  Seems like there's a number of places where the code could be streamlined though,  for example the level loader takes something like 75 seconds to pull the structure into memory. 

Here's a replacement,

PlayBASIC Code: [Select]
   Type FileFormat_MapDataBlock
Tile,x1,y1,x2,y2
EndType

BytesToLoad = MapWidth*MapHeight * SIZEOF(FileFormat_MapDataBlock) ; compute TOTAL size of this chunk

ThisBank = NewBank(BytesToLoad) ; Alloc a bank for this data

ThisBankPtr = GetBankPtr(ThisBank)

// Read data from device
Readmemory 1,ThisBankPtr, BytesToLoad ; read device as fast as the drive can send it



Dim TilePtr as FileFormat_MapDataBlock pointer

;
for tempx=0 to MAPWIDTH-1
for tempy=0 to MAPHEIGHT-1

// compute where the next tile is within temp bank
TilePtr = ThisBankPtr + ((TEMPx * MapHeight) + TempY) *SIZEOF(FileFormat_MapDataBlock)

// copy data out of bank into arrays
map(tempx, tempy) =TilePtr.Tile

solids(tempx, tempy).x1 =TilePtr.X1
solids(tempx, tempy).y1 =TilePtr.Y1
solids(tempx, tempy).x2 =TilePtr.X2
solids(tempx, tempy).y2 =TilePtr.Y2

next tempy

; dunno what this does
dkcoinframe=dkcoinframe+1
if dkcoinframe=>7
dkcoinframe=1
endif


next

; delete the temp bank
deletebank ThisBank






stevmjon

hey lemonwizard

i ran the demo in v1.65 (won't run in v1.65B beta though, as handling types has changed a bit).
i haven't looked through the code yet, but can you add tile graphics or the collision tiles themselves using the mouse?

the code is long, looks like you have put a lot of time and effort into this. looks like the last edit was 2015. have you done any work on this over the last year?

i used to code in one page like this too. is this preferred or are you not sure how to add pages? to add them, in the ide click on the yellow icon in the middle that is 'manage source files'. this opens a window that allows you to add new pages (called source files in playbasic).
seperating different tasks to its own page/source file makes it a lot easier.

well, keep up the good work.

  stevmjon
It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

kevin


LemonWizard

Quote from: kevin on May 16, 2017, 11:29:16 PM

I guess it's the final of this Donkey Kong Country 2 WIP   



Yeah sorry I'm not actively working on this project right now but it isn't dead. I have full intentions to finish it someday.