News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

For Foxes Sake WIP

Started by micky4fun, August 19, 2012, 03:54:41 AM

Previous topic - Next topic

micky4fun

theres a couple of nice looking projects in the show case that im very much looking forward to when released,
so i think im going to start a longer project here , with the option to jump to another small project inbetween
that way gives me some freedom , so heres a simple looking and hopefully simple to program scrolling platform game in the mario type theme
with things to collect , dodge , kill etc
at the moment the map blocks are 64x64 pixels so a 16X12 screen at 1024x768 resolution , a bit large i know but going to try and get away with this if i can
heres a starting level screen shot , but this will take a while to complete i would have thought

btw , some of you might reconise the man from another demo in the PB folder

mick :)

ATLUS

nice idea =) good luck micky4fun

kevin

#2
Quote
so heres a simple looking and hopefully simple to program scrolling platform game in the mario type theme
with things to collect , dodge , kill etc
at the moment the map blocks are 64x64 pixels so a 16X12 screen at 1024x768 resolution , a bit large i know but going to try and get away with this if i can
heres a starting level screen shot , but this will take a while to complete i would have thought

 Yeah making the levels is always the sticking point.  So do yourself a huge favor and build a level/world editing tool.  Doesn't have to be pretty,  just enough to stick the blocks in place, drop the starting positions of the characters and set whatever global variables the world has.  

  Thankfully, the original mario games are based on some pretty simple rules, so the coding side of it should be a breeze.    


Quotebtw , some of you might reconise the man from another demo in the PB folder

   I think that's another blink one.  It's a version of some other guys walking dude, can't remember the name.  Will have to search for the thread in minutes,  it's on here somewhere.

    Found it, It's Draco's Tale (login required)


BlinkOk

sounds good mick. i've heard some very good things about the tiling system in PB.
there are a lot of very good free tile graphics out there if you wanna look around too

stevmjon

cool micky. looking forward to see what you come up with.

i found platformers fun to make. learnt a lot too. post code when you can so we can see your progress.

  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.

micky4fun

#5
Hi All

QuoteSo do yourself a huge favor and build a level/world editing tool.  Doesn't have to be pretty,
yes think i will take your advice here , i can be a bit of lets just get going , but as i am going to take time on this i will knock one up and your right again it wont be pretty , haha

Quotesounds good mick. i've heard some very good things about the tiling system in PB.
there are a lot of very good free tile graphics out there if you wanna look around too
yep BlinkOk will try and go a bit deeper in the maps commands , only really used it very lighty in Bank Job game

Quotecool micky. looking forward to see what you come up with.
thanks stevmjon , me to , platform games are my favourite type of game , so about time i tried one
yes will post any updates as soon as it starts taking shape

mick :)

BlinkOk

there are a few 3rd party/free level editors out there. you might wanna check them out too.

Sigtrygg

Hello Mickey4fun!

Sounds and looks interesting! Let you know us, how you manage your program?
I like jump and run games, too!  :)

Sigtrygg

LemonWizard

#8
I don't know how old this post is but I'm going to reply.
Mick if you want I can sit down with you and take some time to help you build a nicer tile/level editor.
The first step is to figure out a sort of format for your levels.
If you design a level file first it becomes alot easier to read in and out the level data.
I recently got into doing this sort of habit rather than having to re load all my level data every single time I wanted to test a new mechanic in my test level using my dkc2 game engine. xd and yeah it will save you a ton of time when debugging to already have set up.

The first method you should use once you load all your images/sound/media and set all your variables and arrays up is start loading the level.

To help you out I'll post my level loading code from my dkc2 editor. Feel free to adjust/change it to your liking. Actually. I'll do you one better.
I'll give you the code that saves the level file and the code that loads it!


Saves:
PlayBASIC Code: [Select]
if mouseinbox(0, 600, 0+(128*2), 664)
if leftmousebutton()

if fileexist("C:/brambles_map2.txt")
deletefile ("C:/brambles_map2.txt")
endif


writefile "levels\brambles_map2.txt", 1

writeint 1, Mapwidth
writeint 1, mapheight
writeint 1, charx
writeint 1, chary
writeint 1, scrollx
writeint 1, scrolly

for tempx=1 to Mapwidth
for tempy=1 to mapheight
writeint 1, map(tempx, tempy)
writeint 1, solids(tempx, tempy).x1
writeint 1, solids(tempx, tempy).y1
writeint 1, solids(tempx, tempy).x2
writeint 1, solids(tempx, tempy).y2
next tempy
next tempx

for tempx=1 to MAPWIDTH/2
for tempy=1 to MAPHEIGHT/2
writeint 1, TILEMAP(tempx, tempy)
next tempy
next tempx

for temp=1 to 30
writeint 1, b_barrels(temp).facing_type
writeint 1, b_barrels(temp).x1
writeint 1, b_barrels(temp).y1
writeint 1, b_barrels(temp).x2
writeint 1, b_barrels(temp).y2
next temp

closefile 1


endif
endif





Loads:

PlayBASIC Code: [Select]
read=false
if fileexist("levels\brambles_map2.txt") then read=true

IF READ=TRUE
readfile "levels\brambles_map2.txt", 1
ink rgb(0, 0, 255)
tile_to_read=1
totaltiles=MAPWIDTH*MAPHEIGHT
rendertoscreen
Mapwidth=readint(1)
mapheight=readint(1)
charx=readint(1)
chary=readint(1)
scrollx=readint(1)
scrolly=readint(1)
dim map(MAPWIDTH, MAPHEIGHT)
dim TILEMAP(MAPWIDTH/2, MAPHEIGHT/2) ;32 by 32 pixel tiles
dim solids(MAPWIDTH, MAPHEIGHT) as solid_tile

coinframetimer=timer()+30





for tempx=1 to MAPWIDTH
for tempy=1 to MAPHEIGHT
map(tempx, tempy)=readint(1)
solids(tempx, tempy).x1=readint(1)
solids(tempx, tempy).y1=readint(1)
solids(tempx, tempy).x2=readint(1)
solids(tempx, tempy).y2=readint(1)
x1=solids(tempx, tempy).x1
y1=solids(tempx, tempy).y1
x2=solids(tempx, tempy).x2
y2=solids(tempx, tempy).y2
;rendertoimage castle
;box x1, y1, x2, y2,
;rendertoscreen


;tile_to_read=tile_to_read+1
next tempy
print "Loading SOLID TILE DATA PLEASE WAIT "
print "Reading Across X: "+str$(tempx)
print "Total Reads remaining: "+str$(MAPWIDTH-tempx)
percent#=((tempx*100)/MAPWIDTH)
print "Percent completed "+str$(percent#)
ink rgb(percent#*2, percent#, 255)
box 200, 50, 200+(percent#)*5, 60, 1
ink rgb(0, 255, 0)
box 200, 50, 200+100*5, 60, 0
drawimage dk_barrel_(dkcoinframe), 180+percent#*5, 20, 1
sync
cls rgb(0,0,0)





dkcoinframe=dkcoinframe+1


if dkcoinframe=>7
dkcoinframe=1
endif

next tempx



for tempx=1 to MAPWIDTH/2
for tempy=1 to MAPHEIGHT/2
TILEMAP(tempx, tempy)=readint(1)
next tempy
next tempx

for temp=1 to 30
b_barrels(temp).facing_type=readint(1)
b_barrels(temp).x1=readint(1)
b_barrels(temp).y1=readint(1)
b_barrels(temp).x2=readint(1)
b_barrels(temp).y2=readint(1)
next temp


closefile 1

falling=true
mode$="playmode"

ENDIF





Of course this is a bit advanced because the loading screen has a progress bar rendering on it as well.
And not only that but also the sprites are read in as well and their positions on the map.

kevin

#9
Mick,

Quote
 yes think i will take your advice here , i can be a bit of lets just get going , but as i am going to take time on this i will knock one up and your right again it wont be pretty , haha

 That'd be first :) ...  Anyway, there's a lots and lots of ways to externalize the 'game' data from the program.   Many of which are more hassle than they're worth.  The easiest solutions store the minimal amount of level/character entity info in the file.  I'd prolly use a markup format (Text files) rather than a binary format, as it allows the 'level maker person' to make changes easily.  (NotePad).    

 So depending what you're aiming at, you'd define the animations, character types, level layouts, world properties and level all externally.  Ideally, the structures are set out in some human readable form.  Basically you load the text file(s) into memory, split it each one to an array, then run through it (top to bottom) looking for the action tags.   Ideally the tags should make sense to head reader.




; Start Of Section Define
Level-Start

   ; Time player has to complete level
   Time Limit = 60

    ; etc etc

Level-End
; End Start Of Section Define



Animations-Start


;
AddAnim
{
             Name= PLAYER_RUNNING
   MaskColour = $ff00ff
   Frames   =Running1.png,Running2.png
}


AddAnim
{
             Name=PLAYER_WALKING
   MaskColour = $ff00ff
   Frames   =Walking1.png,Walking2.png,Walking3.png
   
}

Animations-END




     
     The program doesn't use this information as is, it imports/parses the materials into whatever arrays/structures inside the game.   So the actually programming isn't really any different.  With one HUGE exception, resource are dynamically allocated.   Making the program a lot more expandable. 




 

Food For Thought,

* Entity Example (Loading Game Levels)
* Combine two words to make an array?(Sprite Animations)
* Thesius XIII





BlinkOk

#10
http://www.ogmoeditor.com/ or http://codeboje.de/list-of-2d-map-editors/
then you can just get on with the game

micky4fun

#11
Hi all

well lots of help here thanks guys

LemonWizard , thanks for code have looked through it and given me a few ideas ,
BlinkOk , thanks for link to level editor , i have just installed that and will give that a go , just going to read the tutorial , ahh more there now loads to choose from , well thats tomorrow taken up ,
Kevin , thanks for code snippets and advice on level/map editor

well today i have spent most of the day just doing that , trying to make a level/map editor , well tried 2 differant ways but then ran into problems if i wanted a large map/level
then ironically , i tried making a map editor using the map commands and that seems the best at the moment its basic but can be added apone  , though i have one small problem with that , but dont think at this stage its a worrie
but someone there might see what im doing wrong , if i can explaine it properly
ok here goes , if you load the map editor up ,  at the moment im using 64x64 pixels per tile on a screen res of 1024x768 so 16x12 tiles, yep rather large
so to start just do a 16 tiles across by 12 tiles down by 1 screen across by 1 screen down
now use mouse to select tile to use from above tiles , then place them on grid layout by pressing mousebutton 1 , delete tile if placed in wrong place by pressing mouse button 2
you can use arrow keys to move map if you do a large one later on , but try this first to see my problem , i have 17 squares by 13 instead of 16 by 12 , i have just the little white box of the image to fill tiles not needed

ok once your map is done , just do a screen border to start , then press spacebar to save the file , this will be data1 file

now copy that file to the platform v1 folder overwriting file already there
load up platform v1 and run , you man always falls from top of screen to bottom , so make sure he has a block to fall on
then just use the arrow keys to move him , all very basic movements at the moment

the saved data1 file contains first the map x amount and then the map y amount , then all the tiles
the trouble i have is in the map editor v1 i need to get rid of the unwanted row of tiles x and y
and onced saved will load ok into platform v1 program , but its not a major worry , but would be nice to clear up

ok bed long day
thanks again guys
mick :)


kevin


   Looking at the editor I'm not sure why you've got map level and array to mirror the level.   But anyway, I suspect the sizing is different because  array bounds are inclusive->inclusive and map levels are inclusion -> exclusive.   So an array of 10 items, actually has 11 valid indexes   (0,1,2,3,4,5,6,7,8,9,10 )  Where a level that's 10 tiles wide say, has only 10.  0,1,2,3,4,5,6,7,8,9

   In the editor,  what i'd prolly do is set up areas of gadgets.  So one area would be the block palette (like you've got),  another might be help window.  Some just text drawn to a image and splodged in front.  Where Key short cuts..  Another might be menu dialog      Since this is simple GUI,  when the user clicks or moves the mouse,  it's important the programs reaction is relative to the area.  So when over the block palette clicks, this only affect block selection and not drawing.    Same goes for any other windows. 

   Anyway, ideally the two program would use the same include files, which is something you've never done before.  An include is just a chunk of code, generally fully functions or declarations (types/ arrays / constants).   Having them both share code, makes programming a 1000 times faster.  You write once and the once both sides share the changes.     

   

micky4fun

Hi all

well thanks again to all ,
i did try all the level editors and the D2Dmapeditor was the nearest i could use i think ,
i will come back to that a little later and give it a full try out , if not may continue with mine
but for the time being now i want to get use to the map commands and suss out what i can and cant do , what is easy for me to do and what will be to hard for me to get to grips with and go the easy root,

QuoteLooking at the editor I'm not sure why you've got map level and array to mirror the level
oh dear , oh yes i have taken the grid array out now and used the peektile command to get the tile info out to save as file

ok while tinkering around today i was wondering if theres an easy way to get my man to jump up one tile at a time , while standing under say 3 tiles on top of each other and say while on second tile still be how to move left and right on that tile
and jump up one more tile even though that tile is directly above him , as in picture
hope i have explained that well , would i have to do a map with differant levels to do that ?

i have include code , so i want him to move along first stack of tiles walk in front of them . and jump up one tile level even when there are 3 tiles above hes head and land just one level up from where he was

is that possible without being very complicated anyones help would be appricated
thanks
mick :)

BlinkOk

#14
here is a little dude i made ages ago (he's in the PB banner), run, jump and stand (the stand one is a stand + look around)
i'm not sure if the run is too fast for what you want but if it's ok you're welcome to use him



originals: run - stand - jump