Recent

Author Topic: Big Metro - real-time metro building game  (Read 3651 times)

Chronos

  • Full Member
  • ***
  • Posts: 212
    • PascalClassLibrary
Big Metro - real-time metro building game
« 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.
« Last Edit: December 18, 2018, 11:40:50 pm by Chronos »

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1061
    • Burdjia
Re: Big Metro - real-time metro building game
« Reply #1 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 not just to get information but also to help us change how the gamedev community sees Pascal.
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6675
  • Debugger - SynEdit - and more
    • wiki
Re: Big Metro - real-time metro building game
« Reply #2 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
« Last Edit: November 25, 2017, 12:10:22 pm by Martin_fr »

Chronos

  • Full Member
  • ***
  • Posts: 212
    • PascalClassLibrary
Re: Big Metro - real-time metro building game
« Reply #3 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
« Last Edit: December 18, 2018, 11:41:03 pm by Chronos »

jwdietrich

  • Hero Member
  • *****
  • Posts: 1138
    • formatio reticularis
Re: Big Metro - real-time metro building game
« Reply #4 on: September 05, 2020, 10:10:45 pm »
This app works well on the Mac, too, when being compiled from source code.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.0.10 | FPC 3.2.0 | PPC, Intel, ARM | macOS, Windows, Linux

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1003
  • Former Delphi 1-7, 10.2 User
Re: Big Metro - real-time metro building game
« Reply #5 on: September 06, 2020, 05:26:42 am »
Too well... I'm addicted :)
o Lazarus v2.1.0 r63871, FPC v3.3.1 r46876, macOS 10.14.6 (with sup update), Xcode 11.3.1
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 amd64 (VMware Fusion VM)
o FPC 3.0.4, FreeBSD 12.2-STABLE r365646 amd64
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 20.04 (Parallels VM)

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1003
  • Former Delphi 1-7, 10.2 User
Re: Big Metro - real-time metro building game
« Reply #6 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.
o Lazarus v2.1.0 r63871, FPC v3.3.1 r46876, macOS 10.14.6 (with sup update), Xcode 11.3.1
o Lazarus v2.1.0 r61574, FPC v3.3.1 r42318, FreeBSD 12.1 amd64 (VMware Fusion VM)
o FPC 3.0.4, FreeBSD 12.2-STABLE r365646 amd64
o Lazarus v2.1.0 r61574, FPC v3.0.4, Ubuntu 20.04 (Parallels VM)

 

TinyPortal © 2005-2018