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

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

Previous topic - Next topic

TomToad

Quote from: Flanker on November 20, 2017, 18:20:51
Yes but it does only with max2D commands (drawrect, drawcircle, plot etc...), with images (without filtering) it works perfectly.
The above example is using images.  Here is the same thing but with an image containing 4 lines.

The problem is the way SetVirtualResolution renders fractional pixels.  for example, here is a line scaled twice the size
{X}{X}|{X}{X}
{X}{X}|{X}{X}
-------------
{ }{ }|{ }{ }
{ }{ }|{ }{ }

Each bracket represents one actual pixel, while a 2x2 group represents one virtual pixel.  Now if I were to draw the line at y of  0.5 instead of 0.0, then either the line will be drawn at the next full pixel or stay where it is depending on how the values get rounded.
{ }{ }|{ }{ }
{ }{ }|{ }{ }
-------------
{X}{X}|{X}{X}
{X}{X}|{X}{X}

But when you use virtual resolution, it will render on the "Half pixel" or a full normal pixel like so
{ }{ }|{ }{ }
{X}{X}|{X}{X}
-------------
{X}{X}|{X}{X}
{ }{ }|{ }{ }

Which kills the 320x200 look.  At least, that is the way it behaves in Max2D, might be different with other engines.
------------------------------------------------
8 rabbits equals 1 rabbyte.

Qube

Quote from: Steve Elliott on November 20, 2017, 18:56:46
Quote
I found the exact same issue with rotations on images using the render resolution instead of the virtual resolution. So was happy when I did make it work properly.

I'll probably use AGK on this project, care to elaborate Qube?  I'm working on graphics before code.

In AGK to make sure rotations don't use the render resolution and break the 320x200 look or be blurry when scaled up ( rough code outline ) :


SetDisplayAspect( 320 / 200 )
SetVirtualResolution ( 320, 200 )
SetDefaultMinFilter( 0 )
SetDefaultMagFilter( 0 )

gameImage = CreateRenderImage ( 320, 200, 0, 0 )
gameSprite = CreateSprite( gameImage )

Do
SetRenderToImage( gameImage, 0 )
ClearScreen()

// do all you fancy drawing stuff here

SetRenderToScreen()
DrawSprite( gameSprite )

Swap()
Loop
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

#62
Oh, ok - thanks.

Perhaps I need something different as I intend to scale up my game screen 320 X 200 (plus border) 4 times to fit a 1920 X 1080 screen.  So just load and scale all my graphics I guess (without filtering).
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

Quote from: Steve Elliott on November 20, 2017, 19:32:09
Oh, ok - thanks.

Perhaps I need something different as I intend to scale up my game screen 320 X 200 (plus border) 4 times to fit a 1920 X 1080 screen.  So just load and scale all my graphics I guess (without filtering).
The above code is for scaling for any resolution. You can set your window size to 1920x1080 and the exact same code applies.
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

Quote
You can set your window size to 1920x1080 and the exact same code applies.

Ah, the devil is in the detail.  Good stuff, thanks.   :)
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

Flanker

Quote from: TomToad on November 20, 2017, 19:03:09
Quote from: Flanker on November 20, 2017, 18:20:51
Yes but it does only with max2D commands (drawrect, drawcircle, plot etc...), with images (without filtering) it works perfectly.
The above example is using images.  Here is the same thing but with an image containing 4 lines.

Oh yes you're right, I don't know why I didn't noticed it with images and thought it was ok...

You can still use this eventually :
SuperStrict
SeedRnd MilliSecs()

SetGraphicsDriver GLMax2DDriver()

Graphics 1280,720,0,60
SetClsColor 100,100,100

Local widthScale:Int = Floor(GraphicsWidth()/320.0)
Local heightScale:Int = Floor(GraphicsHeight()/200.0)
Local gfxScale:Int = Min(widthScale,heightScale)

Local bufferImage:TImage = CreateImage(320,200,1,DYNAMICIMAGE)
Local bufferX:Int = (GraphicsWidth()-320*gfxScale)/2
Local bufferY:Int = (GraphicsHeight()-200*gfxScale)/2

Local rotation:Float

While Not KeyHit(KEY_ESCAPE) And Not AppTerminate()

Cls

' ////////// YOUR GAME HERE
SetScale 1,1
rotation = rotation + 1
SetRotation rotation
DrawRect 160,100,50,50


' ////////// GRAB THE BUFFER IMAGE FROM 0,0 TO 320,200
GrabImage bufferImage,0,0
Cls
SetColor 0,0,0
SetRotation 0
DrawRect 0,0,GraphicsWidth(),GraphicsHeight()
SetScale gfxScale,gfxScale
SetColor 255,255,255
DrawImage bufferImage,bufferX,bufferY

Flip

Wend

End


It will grab an image from 0,0 to 320,200 and scale it automatically to the best size.
Everyone knew it was impossible, until someone who didn't know made it.

Qube

Currently have a freaky fun time creating synth music :P - Never done synth music with modern day tools but woot woot it's great fun. No doubt you lot will think my creations are just nuts and sound like a jingly old mess but at least I'm giving it a go... Gotta push yourself.

I think after this I'll treat myself to a tip top synth VST as I'm just having too much fun not to invest... But for now, the free synth VST's are really really good.
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.


Qube

Quote from: muruba on November 21, 2017, 03:07:32
Are you using re-noise?
Yup. Been using Renoise for years. It's the best tracker I've come across and I was soooo glad to find it after all those years in Amiga land using NoiseTracker / ProTracker / OctaMED. An amazing plus point is it has VST support \o/ - Long live Renoise!!!
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.

BasicBoy

Quote from: Qube on November 21, 2017, 02:49:27
Currently have a freaky fun time creating synth music :P - Never done synth music with modern day tools but woot woot it's great fun. No doubt you lot will think my creations are just nuts and sound like a jingly old mess but at least I'm giving it a go... Gotta push yourself.

I think after this I'll treat myself to a tip top synth VST as I'm just having too much fun not to invest... But for now, the free synth VST's are really really good.

The free VST synth by Daichi "Synth1" is really quite amazing. Sounds great. Tons of presets available on the 'net, too  :)


BasicBoy.
--


Qube

QuoteThe free VST synth by Daichi "Synth1" is really quite amazing. Sounds great. Tons of presets available on the 'net, too
Have that one downloaded and will have a play, thanks.

QuoteHere's a bit of my chip synth in action:
https://soundcloud.com/mavryck-james/8bit-chiptune-test
Cool, will have a listen later when I get home :)
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.

Dabz

Here's mine so far (attached)

Working on tilemap collisions regarding slopes... Its been donkeys since I wrote a platformer with slopes (Well, donkeys since I've wrote anything really, lol), I forgot about the usual pitfalls, but, it came back in the end! :D

With this, I can check the tile the character is on, and work out the angle of the slope to make the character 90' from the slope if needed, a bit like Sonic, I wont need it for this, but, its future proofing it if I ever decide to do something "proper"! :D

Yes, the resolution isnt set yet, but, I can tweak it by changing a few constants, and it should be tickety boo.

Right, so, with that, I can happily move on to cobbling a game out of it! :D

Dabz
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

Steve Elliott

Very nice.  So it looks like we're all doing platform games?  Me included.
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

Dabz

The thing is... I'm pleased its retro, because I dont have to really rely on graphics, as that's my usual downfall... Like, I can do them, but, it's a chore and I get bored, very very quickl ! :)

And I havent got a consistent style either... I'll work on something for ages, plonk it in the game, and it just looks wrong, so I'll scrap it, restart... Nah... Takes me forever to get stuff right!

So for me, this competition has been inviting for me, because I've suffered coders block for ages, and I'm talking ages mind, and it's always the graphical part that puts me off... When I did iOS games, they were small, graphics didnt need as much work, I got by and finished them. Scaling up from that, well, I'd rather be hanging off the arse end of a hand grinder grinding piss ridden concrete... With no face mask! :D

Right, X-Factor styleee sad tiny violin playing "I'm on a journey" craic out of the way, time to start crunching the res down and getting some proper shite retro graphics in there! :D hehehe

Dabz
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit