Lazarus

Announcements => Third party => Topic started by: Chronos on November 24, 2017, 11:26:40 pm

Title: Big Metro - real-time metro building game
Post by: Chronos on November 24, 2017, 11:26:40 pm
Project homepage: https://app.zdechov.net/BigMetro

This is first release of somehow unfinished but playable game clone of Mini Metro game  https://dinopoloclub.com/minimetro/. Original idea was just for fun to re-implement that game in Pascal. Its kind of fun to build metro lines and watch trains going back and forth transporting passengers :) In real world you don't want to rebuild tube every time when a new station appears somewhere. But here it costs nothing to move and reorganize all lines. So you can always optimize your metro system for better throughput.

Its also interesting to implement zoom-able map with various moving elements as software rendering and achieve lower CPU load. There are not many nice complex fully featured games created in Lazarus/FPC yet. There is a long way for Lazarus to be simply usable for game development. Even simple native multi-platform Windows/Linux/Mac sound system for games is not there. But still we can try to push things forward.
Title: Re: Big Metro - real-time metro building game
Post by: Ñuño_Martínez on November 25, 2017, 11:51:50 am
Cool indeed.  :)

Anyway I don't agree with you in this statement:
There are not many nice complex fully featured games created in Lazarus/FPC yet. There is a long way for Lazarus to be simply usable for game development. Even simple native multi-platform Windows/Linux/Mac sound system for games is not there. But still we can try to push things forward.
Actually there are a collection of libraries and engines for game development with FPC.  May be some are old but we (including myself) are working in new stuff as ZenGL, Allegro.pas, Luna Game Pascal, MinGRo and Castle Engine among others, as well as nice experiments like DelphiDoom, Thyandyr's Voxel Engine and Lua Game Library.  I would agree that there are not a lot of games lately though.

May be you should join Pascal Game Development (http://www.pascalgamedevelopment.com/forum.php) not just to get information but also to help us change how the gamedev community sees Pascal.
Title: Re: Big Metro - real-time metro building game
Post by: Martin_fr on November 25, 2017, 12:07:42 pm
Div by zero

in UGeometric.pas
function LineIntersect(LineAP1, LineAP2, LineBP1, LineBP2: TPoint): TPoint;

Line 113
  LDetDivInv := 1 / ((LDiffLA.X * LDiffLB.Y) - (LDiffLA.Y * LDiffLB.X));

LDiffLB = (0,0)

Code: Pascal  [Select][+][-]
  1. ~"#0  0x00440c41 in LINEINTERSECT (LINEAP1=..., LINEAP2=..., LINEBP1=..., LINEBP2=..., result=...) at UGeometric.pas:113\n"
  2. ~"#1  0x0043d0ee in TENGINE__SHIFTTRACKPOINTS (this=0x2f9c50) at UEngine.pas:1814\n"
  3. ~"#2  0x00438587 in TMETROLINE__CONNECTSTATION (STATION=0x24e398, LINESTATIONDOWN=0x313970, LINESTATIONUP=0x313eb0, this=0x23ef58) at UEngine.pas:888\n"
  4. ~"#3  0x0043e1c7 in TENGINE__MOUSEMOVE (POSITION=..., this=0x2f9c50) at UEngine.pas:2028\n"
  5. ~"#4  0x004361bd in TFORMMAIN__PAINTBOX1MOUSEMOVE (SENDER=0x26a930, SHIFT=..., X=485, Y=451, this=0x269a60) at ./Forms/UFormMain.pas:90\n"
  6. ~"#5  0x0052f23c in MOUSEMOVE (this=0x26a930, SHIFT=..., X=485, Y=451) at include/control.inc:4425\n"
  7. ~"#6  0x0052ef6d in WMMOUSEMOVE (this=0x26a930, MESSAGE=...) at include/control.inc:4384\n"
  8.  


LINEAP1={X = 498, Y = 538}
LINEAP2={X = 515, Y = 555}
LINEBP1={X = 515, Y = 555}
LINEBP2={X = 515, Y = 555}
RESULT=0x262f7b4
LDETLINEA=-680
LDETLINEB=0
LDETDIVINV=1.1945305291614955e+103
LDIFFLA={X = -17, Y = -17}
LDIFFLB={X = 0, Y = 0}
LINEINTERSECT=0x262f7b4
Title: Re: Big Metro - real-time metro building game
Post by: Chronos on February 03, 2018, 09:09:04 pm
Version 1.0.1 (2018-02-03)
==========================

* Modified: High DPI support under Windows.
* Fixed: Zooming by mouse wheel was inverted. Not worked correctly with touch screen.
* Fixed: Avoid division by zero in line intersection calculation.

Download: https://app.zdechov.net/BigMetro
Title: Re: Big Metro - real-time metro building game
Post by: jwdietrich on September 05, 2020, 10:10:45 pm
This app works well on the Mac, too, when being compiled from source code.
Title: Re: Big Metro - real-time metro building game
Post by: trev on September 06, 2020, 05:26:42 am
Too well... I'm addicted :)
Title: Re: Big Metro - real-time metro building game
Post by: trev on September 09, 2020, 03:00:10 pm
Having "researched" the game play for several days and having attained a high score of 3,755 passengers being transported over 72 days I have a few comments for improvements :)

o A High Score facility (saved to a file?) so I don't need pen and paper.
o The number of days that have passed being displayed under the clock would be a nice touch.
o Once a certain number of stations have been added, it becomes increasingly hard to find the latest one because sometimes it is placed on an existing line (but not connected) and sometimes it is hard to spot where the latest one has appeared until you notice the number of passengers growing at it.
o Sometimes the type of passenger that starts waiting at station/s appears before the matching type of station appears which leads to overcrowding and my eventual firing.
Title: Re: Big Metro - real-time metro building game
Post by: Chronos on December 01, 2020, 12:28:12 pm
A new version was released with some improvements:

Quote
Version 1.1.0 (2020-11-28)
==========================

* Added: Show highest score on game over.
* Added: Support for dark mode.
* Added: Top left back button to exit from game to game menu. Allow to restart game and continue with playing.
* Added: Support for Escape key for exiting game and menu.
* Added: Support for full screen mode. Can be changed in options and by hitting F11 key.
* Added: Remember form dimensions between application restarts.
* Added: Multi-language support. Supported English and Czech languages.
* Added: Main game menu with options section.
* Modified: Use InnoSetup 6 with modern style.
* Modified: Update project web links.
* Fixed: Canvas width and height is not updated correctly on Windows. Use additional CanvasSize parameter in drawing methods.
* Fixed: Correct vertical position of game over text.
* Fixed: Show correct application icon and removed version from name in Windows installed application item.

Download: https://app.zdechov.net/BigMetro
Title: Re: Big Metro - real-time metro building game
Post by: trev on December 02, 2020, 05:47:14 am
Compiling for Intel 64 bit macOS results in:

Quote
Free Pascal Compiler version 3.3.1 [2020/10/25] for x86_64
Copyright (c) 1993-2020 by Florian Klaempfl and others
(1002) Target OS: Darwin for x86_64
(3104) Compiling Common.pas
(3104) Compiling UCommon.pas
/Users/trev/Documents/Programming/LAZPROJECTS/BigMetro2/Packages/Common/UCommon.pas(292,19) Warning: (5093) Function result variable of a managed type does not seem to be initialized
/Users/trev/Documents/Programming/LAZPROJECTS/BigMetro2/Packages/Common/UCommon.pas(344,9) Error: (5000) Identifier not found "UtsName"
/Users/trev/Documents/Programming/LAZPROJECTS/BigMetro2/Packages/Common/UCommon.pas(344,16) Error: (5007) Error in type definition
/Users/trev/Documents/Programming/LAZPROJECTS/BigMetro2/Packages/Common/UCommon.pas(346,3) Error: (5000) Identifier not found "fpuname"
/Users/trev/Documents/Programming/LAZPROJECTS/BigMetro2/Packages/Common/UCommon.pas(347,18) Error: (3205) Illegal qualifier
/Users/trev/Documents/Programming/LAZPROJECTS/BigMetro2/Packages/Common/UCommon.pas(505,19) Warning: (5093) Function result variable of a managed type does not seem to be initialized
UCommon.pas(682) Fatal: (10026) There were 4 errors compiling module, stopping
Fatal: (1018) Compilation aborted
Error: /usr/local/bin/ppcx64 returned an error exitcode
Title: Re: Big Metro - real-time metro building game
Post by: jwdietrich on December 02, 2020, 08:47:26 am
Compiling for Intel 64 bit macOS results in:

Quote
...
Error: /usr/local/bin/ppcx64 returned an error exitcode

The previous version from September 2020 compiled seamlessly on the Mac. The bug(s) seem(s) to have been introduced afterwards.
Title: Re: Big Metro - real-time metro building game
Post by: Chronos on December 02, 2020, 09:45:45 am
I don't have any MacOS installation right now so I can't test such build. I wanted to install MacOS into VirtualBox so I can test applications with Mac and create packages but OS was crashing VirtualBox at that time.

It would be really nice if we would be able to build windows and mac applications directly from linux. But currently it is too complicated even to build i386 linux app from 64-bit linux.
Title: Re: Big Metro - real-time metro building game
Post by: trev on December 02, 2020, 10:35:46 am
I can provide command line access via ssh to either an M1 Mac mini or an Intel Mac mini or there's the  https://www.macincloud.com service from $1/hour.
TinyPortal © 2005-2018