322 / 5,000
Translation results
.NET is better every year for a developer who still dreams of developing a video game. Without pretensions and without talking about Unity or any other framework, just "barebones" .NET code, we will try to write a game (or parts of it) in the 80's style (because I was a kid in those years). In Christmas style.
4. Marco Parenzan
• Senion SolutionArchitect @ beanTech
• 1nn0va Community Lead (Pordenone)
• MicrosoftAzure MVP
• Profiles
• Linkedin: https://www.linkedin.com/in/marcoparenzan/
• Slideshare: https://www.slideshare.net/marco.parenzan
• GitHub: https://github.com/marcoparenzan
5. The role of C# and .NET
• The language I like
• A style exercise. Make code elegant and simple (not so much time to spend to
maintain)
• «Code and Refactor: il bello dello scrivere il codice» (Lego my love)
• Lot of new games on retro hardware depends on modern tools
C64 Studio
6. How to start: choose a ‘80 game
• https://www.retrogames.cc/arcade-games/rally-x.html
• Not my preferred Commodore 64 game (not even a C64 game...until
2021! https://www.lemon64.com/forum/viewtopic.php?t=77960)
• But a game I like
• Almost «simple»
• With the cars I love
(some RPG)
Arkanoid
Bubble Bobble
Bump'n'Jump
C64 Emulator
Captured
Defender
Elite
F-Zero
Galaga
Hero
Impossible Mission
Lazy Jones
Le Mans
Lode Runner
Mario Bros
Minecraft
Outrun
Pacman
Pong
Rally X
Snake
Sokoban
Tetris
The Turk
Trust
Zak Mc Kraken
8. Rip the graphics
• Create tiles with custom app made by me
Tiler!
• Tiled to check if tilemap is working
(https://www.mapeditor.org/)
• Check if spritesheet is ok with
https://www.piskelapp.com/
• Make some drawing and edit with Paint.net
Generated with Tiler
Checked with Tiled
Checked with piskelapp
9. The core of a game!
• While(true)
• Render(); // current frame from state
• Update(); // update state
• How many times?
• 30/50+ times per second, beyond the retina persistence
t T+0.033 T+0.066 T+0.099 T+0.132
10. Bitmaps, Flickering, «Raster» and Double Buffering
• Fast =Windows Forms (GDI)
• WPF has DirectX, but 2D painting is quite more complicated (never put my
mind on that)
• Raster=the CRT pencil
• Double Buffering=Prepare the new image offline and draw it in one command (if
possible)
• Sync in raster to avoid two frames in a single video refresh
• Support GPU native commands to be helped by GPU itself
11. ‘80 limitations and style
• Arcade Physics=No Physics
• Screen Size is known and fixed (no native rescaling)
• Game dynamics depends on Graphics assets
• Game and graphic assets are written around fixed size
• ‘80 graphics look better on CRT!
• They use limitations on CRT to improve graphics
CRT (real)
LCD (unreal)
12. Some topics
• Sprites
• Spritesheets
• Tiles and levels
• Input
• Stage and Level
• Stage State
• Game State
Let’s look into code
15. Gift #1.
Write your preferred ‘80s game
Xmas Holidays are the best time to do that!
Remember when you were a boy!
This session!
(some RPG)
Arkanoid
Bubble Bobble
Bump'n'Jump
C64 Emulator
Captured
Defender
Elite
F-Zero
Galaga
Hero
Impossible Mission
Lazy Jones
Le Mans
Lode Runner
Mario Bros
Minecraft
Outrun
Pacman
Pong
Rally X
Snake
Sokoban
Tetris
The Turk
Trust
Zak Mc Kraken
17. First: get a Commodore 64!
• Obviously a Commodore 64 in any form
• Real
• Ultimate II+
• Cute32
• SD2IEC
• FPGA
• (Ultimate 64)
• TheC64 (orTheVic20 orThe C64mini)
• Raspberry PI 4 (+USB Joystick or Keyrah)
• BMC64 Bare Metal! No Raspbian
• Combian 64
• Or more simpler with an Emulator
• https://vice-emu.sourceforge.io/
• https://frodo.cebix.net/
• ...
• Emulators in .Net
• An example (https://github.com/RupertAvery/CS64)
18. https://emulation.gametechwiki.com/index.php/Commodore
_64_emulators
Name Platform(s) Latest Version Libretro Core Accuracy FLOSS Active Recommended
PC / x86
VICE (x64sc) 3.5 ✓ Very high ✓ ✓ ✓
Denise 1.1.2 ✗ Very high ✓ ✓ ✓
Hoxs64 1.1.0.5 ✗ Very high ✓ ✓ ✓
Z64K 2.0.0 (2021-07-27) ✗ Very high ✗ ✓ ✓
VirtualC64 4.3 ✗ High ✓ ✓ ✓
VICE (x64) 3.5[N 1]
✓ High ✓ ✓ ~
Emu64 git ✗ ? ✓ ✓ ~
Kernal64 1.7.1 ✗ ? ✓ ✓ ~
Micro64 1.00.2018.03.16 Build 719 ✗ High ✗ ✓ ~
BizHawk 2.7 ✗ ? ✓ ✓ ✗
CCS64 V3.9.2 ✗ High ✗ ✗ ✗
Hyper64 1.00.2008.08.08 Build 20 ✗ Mid ✗ ✗ ✗
MAME 0.238 ✓ Mid ✓ ✓ ✗
Power64 4.9.5 ✗ High ✗ ✗ ✗
Frodo 4.1b ✗ ? ✗ ✗ ✗
19. RallyX...storia interessante del Commodore 64
• Portato in Giappone sulVic 1001 e sulla Max Machine nel 1982 ma mai
licenziato, quindi ha cambiato nome e personaggio
• Radar Rat Race
• https://en.wikipedia.org/wiki/Radar_Rat_Race
• Ah! Non sapevate che i Commodore sono usciti prima di tutto in
Giappone con altro nome?
• VIC1001Vic20
• Max (non esattamente identico) C64
20. «L’Edicola» anni ‘80 per noi del Commodore 64 (e Spectrum
e MSX)
• https://www.edicola8bit.com/
• Copiavano il gioco, cambiavano il nome e la
schermata iniziale
• [magari un vostro amico smanettone nato
negli anni ‘70 era un piratone ]
https://www.edicola8bit.com/giochi.php?id_pare
nt=348
Tapuino
21. Gift #3. «Corsa contro il tempo»
• Non l’avevate capito?
• Un doppio senso...
25. The role of .NET (again)
• .NET everywhere
• We live in a web world
• We live in a mobile world
• .NET in web =Web Assembly and Blazor!
• Web allows to run on Mobile!
26. Patterns, Coupling and making things right!
• Using Canvas is always Javascript
• Interoperability is necessary
• 640/24=2626x26=676 tiles per screen
• 5 sprites at the same time
• 680 call per frame x 30times per second!!!! NO!
• I call per frame30 calls per second.
• So renderFrame to be rewritten in Javascript passing stage object (serializable in
javascript!)
27. Bring to the Web with Blazor
• https://www.rallysharp.it/
• Azure StaticWeb Site
• Improve it!
• Networking in Azure
• Make it more «casual gaming» (touch?)
Touch point dy>dxup > dxup
Javascript event back .net interop
29. Gift #6.
Other code for you
https://github.com/marcoparenzan/MissileSharp
https://github.com/marcoparenzan/Sharptris
https://github.com/marcoparenzan/Sokosharp
https://github.com/marcoparenzan/mariobros