Code a game competition Nov-Jan 2018 - Minimum £500 prize fund

Started by Qube, November 15, 2017, 04:44:30

Previous topic - Next topic

Derron

Thanks for the insight.

This is what I used as highscore class in "Ape's Banana Conquest" (2nd in the Monkey-X competition 2 years ago):



Class THighscore
Field entries:HighscoreEntryList = New HighscoreEntryList
Field entriesMax:Int = 5


Method AddEntry:Void(entry:THighscoreEntry)
entries.AddLast(entry)

entries.Sort()
'only keep X entries
While entries.Count() > entriesMax
entries.RemoveLast()
Wend
End


Method Clear:Void()
entries.Clear()
End Method


Method GetBestEntry:THighscoreEntry()
Return entries.First()
End Method


Method GetLowestEntry:THighscoreEntry()
Return entries.Last()
End Method


Method GetBestScore:Int()
If entries.Count() = 0 Then Return 0
Return THighscoreEntry(entries.First()).GetScore()
End Method


Method GetLowestScore:Int()
If entries.Count() = 0 Then Return 0
Return THighscoreEntry(entries.Last()).GetScore()
End Method
End


Class THighscoreEntry
Field name:String
Field score:Int

Method New(name:String, score:Int)
Self.name = name
Self.score = score
End


Method GetName:String(maxLength:Int = -1)
If maxLength > 0 And name.Length() > maxLength
Return name[.. maxLength]
Endif
Return name
End Method


Method GetScore:Int()
Return score
End Method


Method CopyFrom:THighscoreEntry(entry:THighscoreEntry)
Self.name = entry.name
Self.score = entry.score
Return self
End


Method IsSame:Bool(other:THighscoreEntry)
If Not other Then Return False
Return name = other.name And score = other.score
End Method
End


Class HighscoreEntryList Extends List<THighscoreEntry>
Method Compare:Int(a:THighscoreEntry, b:THighscoreEntry)
If a.GetScore() < b.GetScore() Return 1
If a.GetScore() = b.GetScore() Return 0
Return -1
End
End

(Hmm, should consider uploading the sources to github somewhen... had 0 support-the-dev-sales on amazon since 2 years now)

@ giving up
I try to give my best, wife already blamed for the evenings I spent with that project. And I even did not tackle the advanced tricks I planned to do *sniff*. But the basics for the tricks are already implemented, so I just need to survive the "game mechanics"-part and then I can do the "visual tinkering/effects" (which I prefer in my current situation).

STEVIE G

Finally got all the pickups / hazzards working quite well.  This is a wee test video of an AI race running at 640x480 but double pixels sizes and band across top/bottom.  Movement is per pixel to make it look smoother. 



I'll have the option to play at any 2D resolution but presumably I must limit on screen drawing to a virtual res of 320x200 ... to maintain that jerky movement?

If I get the chance I might try to do a mask to hide the cars behind the barriers.  Working on depth in 2d is a bit of a bugger - took me ages to get the sort order correct.

Now it's on to menu's etc...   :o.

Derron

Z-order:
Just use the "bottom"-coordinate ("Y2") of a sprite to determine its z-index. So the border of the racing track might begin earlier than a car (eg. it contains a |xxxxxx| fence) but the bottom is surely covering what's behind.

Another approach is to assign elements to a grid - and use the tile which contains an element as the z-index-indicator (higher elements still start on a tile but cover upper ones too).


@ Sound
Is this a "retro sound"? Dunno how much "chiptune" is needed as yours already sound like from the 16bit consoles. I would like to use similar "quality" too (literally: bells and whistles)


bye
Ron

Steve Elliott

Looking good Stevie, although the cars seem to be running off the track and up the barriers.
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

BasicBoy

Looks really good Stevie, and I like your use of the limited colour palette.


BasicBoy.
--

Qube

Quote@Qube have you looked at my maptile editor? it might be just what you are looking for?
Unfortunately I need a custom job which works out as a tile map / level builder / animations etc. Should be able to whip up a crude enough system to do the task in a couple of days.

QuoteI'll have the option to play at any 2D resolution but presumably I must limit on screen drawing to a virtual res of 320x200 ... to maintain that jerky movement?
Looking pretty nifty that, Stevie :) - Yes, virtual resolution must be 320x200 with 16 colour palette but you can scale to any screen size you want so long as the virtual resolution remains ( blocky pixels and all those neat things ).

QuoteI try to give my best, wife already blamed for the evenings I spent with that project.
Was it a "Get away from the computer and sit with me and watch stupid TV programmes" :P - Just tell her "Look, honey darling sweetykins... This is my hobby. Now I can either do this or go to the pub and get rat arsed. Your choice!".. Then run! ;D
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

STEVIE G

Quote from: Derron on December 13, 2017, 19:01:37
Z-order:
Just use the "bottom"-coordinate ("Y2") of a sprite to determine its z-index. So the border of the racing track might begin earlier than a car (eg. it contains a |xxxxxx| fence) but the bottom is surely covering what's behind.

Another approach is to assign elements to a grid - and use the tile which contains an element as the z-index-indicator (higher elements still start on a tile but cover upper ones too).

I don't think the first suggestion will work.  I'm knew to 2d so bear with me ...

I build 3 layers of track elements - the bottom everyone can drive on top of, the second, only cars above a certain height can drive on and the final layer goes over everything.  The car height determines the layer it's drawn.  So I sort all the cars objects and draw those on layer 1 first and those on layer 2 second (after the track elements are drawn). 

The issue I had was if Car1 was going down a slope (say towards the bottom of the screen) and it's to be drawn above layer1 but Car2 is close behind and higher so it is due to be drawn above layer 2.  Car2 is drawn last so appear in front so I have to check for this and correct it. 

Quote
@ Sound
Is this a "retro sound"? Dunno how much "chiptune" is needed as yours already sound like from the 16bit consoles. I would like to use similar "quality" too (literally: bells and whistles)

I didn't realise we were limited to 'chiptune' and 8 bit sounds?

Quote from: Steve Elliott on December 13, 2017, 19:09:55
Looking good Stevie, although the cars seem to be running off the track and up the barriers.

Yes, well - see above - it annoys me too but I'll see if I can come up with a solution - probably need to build masks out of the existing track pieces using just the lowest drawn barriers?

Steve Elliott

#247
Quote
I didn't realise we were limited to 'chiptune' and 8 bit sounds?

We're not, as far as I'm concerned.  I just chose a suitable free online track.  I can't do music, it's not my thing.
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

Qube

QuoteI didn't realise we were limited to 'chiptune' and 8 bit sounds?
No limits on the sound / music :) - I'm going for retro-ish type synth music but it's not 8-bit chip tune stuff.
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Steve Elliott

Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

STEVIE G

Quote from: Qube on December 13, 2017, 19:43:16
QuoteI didn't realise we were limited to 'chiptune' and 8 bit sounds?
No limits on the sound / music :) - I'm going for retro-ish type synth music but it's not 8-bit chip tune stuff.

Phew ..  ;D

Derron

Ok, Qube beat me with his reply ...so no further comment (haha I still comment anyways...) about no _written_ restrictions for sound: but I bet the more retro, the better it suits to your graphics.


@ z index
I do not understand why it cannot work as I tried to describe.


OK... while I tried to proof that it works then I already found a situation in which it does not work - excuse my "artwork" now ;-)



   ABCDEFGHIJKLMNOPQRST
01
02  _   ____
03 ( ) |____|
04  |   °  ° 
05 =|======.
06  x  _    \
07    ( )    \    __
08     |      \  °\_\
09     |       \   \ \
10     x        \  °--'
11               \


My approach would say: the first tree starts at "B6", the horizontal road-track-tile start at "A5", so tree is drawn after the road (6>5).

It only seems to fail if an element _bends_ around something. So if your track was not split into horizontal, corner, vertical, then you might eg. end up with saying it starts at "O11" and has to be drawn after the trees. To correct this you need to split the curve as said into the horizontal parts (not changing "Y"), the curve (changing both, x and y) and  so on.
This is then a tile-grid-similar approach I would say.

What am I missing in my thought, what makes it "not working" as sketched out?


bye
Ron

STEVIE G

Quote from: Derron on December 13, 2017, 19:59:06
Ok, Qube beat me with his reply ...so no further comment (haha I still comment anyways...) about no _written_ restrictions for sound: but I bet the more retro, the better it suits to your graphics.


@ z index
I do not understand why it cannot work as I tried to describe.


OK... while I tried to proof that it works then I already found a situation in which it does not work - excuse my "artwork" now ;-)



   ABCDEFGHIJKLMNOPQRST
01
02  _   ____
03 ( ) |____|
04  |   °  ° 
05 =|======.
06  x  _    \
07    ( )    \    __
08     |      \  °\_\
09     |       \   \ \
10     x        \  °--'
11               \


My approach would say: the first tree starts at "B6", the horizontal road-track-tile start at "A5", so tree is drawn after the road (6>5).

It only seems to fail if an element _bends_ around something. So if your track was not split into horizontal, corner, vertical, then you might eg. end up with saying it starts at "O11" and has to be drawn after the trees. To correct this you need to split the curve as said into the horizontal parts (not changing "Y"), the curve (changing both, x and y) and  so on.
This is then a tile-grid-similar approach I would say.

What am I missing in my thought, what makes it "not working" as sketched out?


bye
Ron

The track tiles aren't split up into parts like so ..



This was the scenario I was talking about - the red car is higher but the blue car should be in front.  While taking a screenshot - I see that my bodge doesn't fix the problem - it does now though  ;)

I think I'll need to create extra versions of then track tiles which are just the lowest barrier and draw them once the cars are drawn - similar to the bridge.  Should work in theory.


Derron

Ah... ok I thought you split up "road" and "barriers" (as this allows for dynamic things like "muddy puddles" during rain etc).

If you do it as the screen exposes it, then yes, a mask - or "barrier only"-sprite will help.

In this case it comes handy that we have limited colors to play with (and up to no dithering for now in your sprites). means you can easily extract them.


BTW: do not forget to add these gas-exhausts and some "fumes". And as I was talking about "muddy puddles": oil puddles will help too (to anger your opponents).


I really hope your projects work under windows - or even linux, cannot await to try these out. Then this will expose all these little culprits a developer misses when solo-developing something (you know what to press, how the game expects your input ... but how does it handle a "new player").

bye
Ron

therevills

I've now got hostages which jump on-board the chopper... now should you be able to kill them? Hmm game-play designs decisions, maybe a hard mode! 

It's funny that this has turned into a chop lifter clone (ish) as that game never entered my mind, I started this game due to seeing a screen shot of Desert Strike



and Gfk's new helicopter WIP game Rotorhead inspired me: