|
Forum Index : Microcontroller and PC projects : Lemmings....
| Author | Message | ||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11818 |
I hope you are using the tilemap engine? It is absolutely made for this sort of game. |
||||
| Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1531 |
Here’s an entertaining documentary about the making of Lemmings. Russell Kay is a little difficult for a non-native speaker to understand ![]() 'no comment |
||||
| Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1531 |
I haven't experimented with the tilemap yet. But using Flash load image and Blit Flashfunction saves you from having to create a library and so on. In this test, 75 sprites run at the same time with relatively little flickering at 252 MHz. Flash load image The path refers to the “Sprites” folder from my last post 'instead of 3, insert the Number of a free flash Slot here: Flash load image 3,"Sprites/Lemming.bmp",o MODE 2:CLS :Input "Nummer of Lemmings ",snum As integer Dim LX(snum),ly(snum) For nr=1 To snum LX(nr)=Int(Rnd*304) ly(nr)=Int(Rnd*224) Next Do For y=0 To 1 For nr=0 To 15 FRAMEBUFFER wait CLS For s=1 To snum Blit Flash 3,n,nr*16,64+(y*16),lx(s),ly(s),16,16,9 Next Pause 40 Next Next Loop It looks very promising btw, I found the Lemmings Level List and the complete Music cheers Martin Edited 2026-08-16 21:06 by Martin H. 'no comment |
||||
| Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1531 |
little demo ![]() Lemmings.zip 'no comment |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 6090 |
Nice !!! Only the HUD need new pixel art. The rest looks fine for this small level. The movements are fast , even with 50 on screen. Compliments ... ! Envision mouse control ? Volhout Edited 2026-08-20 01:27 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
| Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1531 |
That would be the obvious solution, but then there are issues with the RP2040 Pico – you’d need an additional keyboard/Gamepad controller. Feel free to tweak the HUD – I’m not entirely happy with it myself. I only included it because of the screen layout. This is what it looks like on the Amiga: ![]() Edited 2026-08-20 01:48 by Martin H. 'no comment |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 6090 |
PS2 mouse works on pico. But we can also include Wii or nes controller. Volhout PicomiteVGA PETSCII ROBOTS |
||||
| Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1531 |
This is what it might look like ![]() 'no comment |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 6090 |
Hi Martin, The new HUD is a major improvement. I think your demo is impressive, but it will be near impossible to use it as a basis for a game becuase memory. You use both framebuffer and framebuffer layer. That leaves 37k free heap , from which 28k will be reserved for variables. Hence only 9kbyte to work with. Currently the game screen is an image, and as such you could try to make a game. Then 9kb would be good enough. But when you start using the tiles for the game screen, you need an array for just the game screen, and your 9kb is gone. It would be much easier when you use either L or F buffers, or design the game around graphical game screens. If that is at all possible. I haven't thought through it far enough to see if this is possible. Digging holes would not be a problem, explosions would not be a problem (dirt gone..is dirt gone). Maybe it can be done... complexity would be if a game screen is larger than visual area. When scrolling through modified landscape (dug holes that scroll outside the visible screen, must re-apear when you scroll back). I think it could only be done when each level constrains to visible area. Volhout PicomiteVGA PETSCII ROBOTS |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 11818 |
|
||||
| Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1531 |
Hello Peter, Thanks again for the tip. At the moment, I only have the levels as PNG files (see the link above); first I need to find (or write a program to find) matching elements and use them to create a tilemap for the levels. So I’m still in the preparation stage. 'no comment |
||||
| Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1531 |
Hi Harm, We can do without framebuffer F; that was just to get it up and running quickly. Framebuffer WAIT :CLS and then redrawing the sprites on Layer L works for up to about 60 sprites on the screen @252 MHz without noticeable flickering (And even if a sprite does happen to flicker, that’s not really a problem, in my opinion.). In normal gameplay, an info card appears before each level, describing the level. That is precisely when there would be enough time to reload the elements and tilemap for the next level. In the game itself, the rules for the individual Lemming types, which the programme processes, are only ever needed up to the next step. So, for example, if a ‘Walker’ realises it no longer has any ground beneath it, it would fall (this is entered as the object type for this sprite, and the y-position is used to determine, upon ‘impact’, whether the Lemming survives or might even have a parachute). etc. ![]() Edited 2026-08-20 20:48 by Martin H. 'no comment |
||||
| joker Regular Member Joined: 06/02/2024 Location: GermanyPosts: 53 |
Lemmings.zip Hello, I know CMM2 users are a minority here but we are still alive Here is the CMM2 version of Martins little Lemmings demo: CMM2Lemmings.zip The demo runs resonable with 200 Lemmings. I had it run with 1500 Lemmings, but the frame rate drops a bit .Cheers Matthias |
||||
| Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1531 |
Nice, You’ve used the full-colour PNGs Here is a little Video of the Pico Demo I don’t have CMM2, but with a few minor tweaks, your script will also run in mmb4windows 'MMB4W OPTION BASE 0 OPTION EXPLICIT OPTION DEFAULT NONE CONST LEMMINGS_NUM=200 CONST LEMMINGS_SPEED=60 CONST PAGE_DISPLAY=0 CONST PAGE_BUFFER =1 CONST PAGE_SPRITES=2 CONST PAGE_BACKGND=3 CONST LEM_X=0 CONST LEM_Y=1 CONST LEM_Dir=2 CONST LEM_Anim=3 CONST col_BLK=RGB(Black) DIM Integer Lem(LEMMINGS_NUM,4) DIM Integer nr mode 3,16 PAGE write PAGE_SPRITES load PNG "img/lemmings1.png",0,0 PAGE write PAGE_BACKGND load PNG "img/level01.png",0,0,8 load PNG "img/hud.png",0,160,8 play modfile "tenlemmings.mod" Lem(0,LEM_X) =280 Lem(0,LEM_Y) =120 Lem(0,LEM_Dir) =int(RND*2) Lem(0,LEM_Anim)=int(RND*8) for nr=1 to LEMMINGS_NUM-1 Lem(nr,LEM_X) =36+int(Rnd*166) Lem(nr,LEM_Y) =choice(nr<LEMMINGS_NUM/2,50,120) Lem(nr,LEM_Dir) =int(RND*2) Lem(nr,LEM_Anim)=int(RND*8) next DIM Integer lx,ly,di,an DIM Float tim,T,D PAGE write PAGE_BUFFER do tim=TIMER+60 : T=TIMER PAGE copy PAGE_BACKGND to PAGE_BUFFER Text 120,18,str$(LEMMINGS_NUM)+" Lemmings","C",7,,rgb(yellow) Text 120,27,str$(D,4,1)+" ms","C",7,,rgb(yellow) for nr=0 to LEMMINGS_NUM-1 lx=Lem(nr,LEM_X) : ly=Lem(nr,LEM_Y) : di=Lem(nr,LEM_Dir) : an=Lem(nr,LEM_Anim) blit (di<<7)+(an<<4),0,lx,ly,16,16,PAGE_SPRITES,&B100 an=(an+1) mod 8 PAGE write PAGE_BACKGND if di Then inc lx,-1 : if Pixel(lx+4,ly+8)<> col_BLK then di=0 else inc lx : if Pixel(lx+12,ly+8)<> col_BLK then di=1 end If inc ly,choice((Pixel(lx+8,ly+16)<> col_BLK),-1,1) Lem(nr,LEM_X)=lx : Lem(nr,LEM_Y)=ly : Lem(nr,LEM_Dir)=di : Lem(nr,LEM_Anim)=an PAGE write PAGE_BUFFER next D=(TIMER-T) PAGE copy PAGE_BUFFER to PAGE_DISPLAY,B do : loop until TIMER>=tim loop until keydown(0)>0 ![]() Edited 2026-08-21 00:01 by Martin H. 'no comment |
||||
| Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1531 |
Volhout, I’ve summarised the music here and added the sound effects ![]() '----------------------------------------------------------------------------- ' SoundFX Samplenumbers in MOD '----------------------------------------------------------------------------- sAssignSkill=&H0A sBearTrap=&H0B sBuilderWarning=&H0C sDrowning=&H0D sElectroTrap=&H0E sEntranceOpening=&H0F sExplosion=&H10 sh*tsSteel=&H11 sLetsGo=&H12 sOhNo=&H13 sRopeTrap=&H14 sSkillButtonSelect=&H15 sSplat=&H16 sTenTonTrap=&H17 sVaporizing=&H18 sYippee=&H19 It was a durty job, but someone’s got to do it Music.zip EXCEPTIONS sfx.mod no music, only the SFX awesome.mod,beastI.mod,beastII.mod and intro.mod just Music no SFX ---------------------------------------------------------- In addition, the animations for entering and exiting have been added to the sprite sheet ![]() Cheers Martin Edited 2026-08-28 05:12 by Martin H. 'no comment |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 6090 |
Thanks Martin, I downloaded the materials, although I am currently no working on Lemmings. Just for a future moment.. Good to have it in the archive, First I need to solve to either use Tilemap, or work withou framebuffer F, otherwise the game Will not fit RAM. Volhout PicomiteVGA PETSCII ROBOTS |
||||
| Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1531 |
Harm, To be able to work with it, if you’d like to use the template. Dim ssrc(15,4) '----------------------------------------------------------------------------- 'Lemming types and attributes 'Sourscoordinates 0=xr,1=yr,2=xl,3=yl,4=Number of Animationframes '(where to find the sourcesprite) 'Climber 'Floater 'Exploder 'Blocker 'Builder 'Basher 'Miner 'Digger '----- Not assignable ----- ' Walker ' Faller ' Shrugger ' Flipper ' Splatter ' Homer '----------------------------------------------------------------------------- Const LemWalker=1 ssrc(1,0)=0:ssrc(1,1)=0: sprt(1,2)=128:ssrc(1,3)=0: ssrc(1,4)=8 Const ALemClimber=2 ssrc(2,0)=0:ssrc(2,1)=16: ssrc(2,2)=0:ssrc(2,3)=32: ssrc(2,4)=8 Const LemFloater=3 ssrc(3,0)=0:ssrc(3,1)=48: ssrc(3,2)=128:ssrc(3,3)=48: ssrc(3,4)=8 Const LemExploder=4 ssrc(4,0)=0:ssrc(4,1)=64: ssrc(4,4)=32 Const LemBlocker=5 ssrc(5,0)=0:ssrc(5,1)=96: ssrc(5,4)=16 Const LemHomer=6 ssrc(6,0)=0:ssrc(6,1)=320: ssrc(6,4)=8 Const LemSinker=7 ssrc(7,0)=0:ssrc(7,1)=112: ssrc(7,4)=30 Const LemBuilder=8 ssrc(8,0)=0:ssrc(8,1)=144: ssrc(8,2)=0:ssrc(8,3)=160: ssrc(8,4)=16 Const LemBasher=9 ssrc(9,0)=0:ssrc(9,1)=192: ssrc(9,4)=16 Const LemDigger=10 ssrc(10,0)=0:ssrc(10,1)=208: ssrc(10,2)=0:ssrc(10,3)=240: ssrc(10,4)=32 Const LemMiner=11 ssrc(11,0)=0:ssrc(11,1)=272: ssrc(11,2)=96:ssrc(11,3)=288: ssrc(11,4)=22 Const LemFaller=12 ssrc(12,0)=224:ssrc(12,1)=128:ssrc(12,4)=2 Const LemClimberEnd=13 ssrc(13,0)=128:ssrc(13,1)=16: ssrc(13,2)=128:ssrc(13,3)=32: ssrc(13,4)=8 Const LemSplatter=14 ssrc(14,0)=0:ssrc(14,1)=80: ssrc(14,4)=16 Here is the summary, i.e. the mapping of the individual sprite types to the coordinates on the source image Sourscoordinates: lem,0=xrright,lem,1=yright lem,2=xlleft,lem,3=yleft lem,4=Number of Animationframes First I need to solve to either use Tilemap, or work withou framebuffer F, otherwise the game Will not fit RAM. Yes, the tilemap issue is a challenge, as it doesn’t seem to be a problem in some levels, whilst in others it looks impossible. I suppose there’s no choice but to modify them so that they can be rendered as tiles. I’m taking a look at the NES version, as it works tile-based. It is possible to work without framebuffer F by separating the calculations from the drawing. The drawing takes place directly on layer L and is so fast that no flickering should be visible. Framebuffer wait, CLS (Layer) , and then draw all sprites using Blit Flash. Edited 2026-08-28 18:10 by Martin H. 'no comment |
||||
| Martin H. Guru Joined: 04/06/2022 Location: GermanyPosts: 1531 |
![]() Even though it looks almost the same as before, the game now uses the Lemmings’ actual controls. Mouse control also has been added Some of the Lemmings type functions are already built in. (For more details, have a look at the Sub move_lms ) ![]() Lemmings.0.2.0.zip That’s the basic framework of how the game might work. For the different levels, I’m looking at the NES and Sega Master System versions, as both systems use tile-based backgrounds – which is what could be done on the Pico using tilemap. framebuffer F is no longer used, as the display output is fast enough. You can use the mouse crosshairs to determine how long the flickering lasts. On the Pico 2 (252 MHz), the slight flickering stops at around the level of the entrance. Cheers Martin Edited 2026-09-03 00:16 by Martin H. 'no comment |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 6090 |
Hi Martin, Looks amazing...You are a wizzard !!! Now I have to get my Aegon VGA unit out, since ti has mouse support. Playing it atm on Mixtels PicoGameVGA unit. I'll take a closer look on what you did this weekend probably (with the Aegon unit). Volhout.. Edited 2026-09-04 05:50 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
| Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 6090 |
Hi Martin, Some early feedback. 1/ You are using 2 variables (snum and lmax) for the maximum number of lemmings. This confuses, because you can spawn lemmings(lmax) that never get animated (snum). 2/ You have a loop time of 50ms (set by tt). Despite reserving room for 80 lemmings, with 30 lemmings you run out of time already. Maybe I should dive into the code deeper to see where we can save time. But you already defined the full framework for the game. So it should not get any worse than this. Every lemming is displayed, and every lemming went through its behaviour rule check. So regardless the lemming type added, this should stay roughly the same (except when they start digging, and scenery must be adapted as well). I still have to check with a unit that has a mouse. Volhout Edited 2026-09-04 17:10 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2026 |