Author Topic: Railways : a railroad management game. (Progress topic)  (Read 2886 times)

0 Members and 1 Guest are viewing this topic.

Offline Trewdbal

  • CPC464
  • **
  • Posts: 8
  • Country: fr
  • Liked: 24
  • Likes Given: 0
Dear friends,

I'm glad to introduce my current project, "Railways" : a railroad management game.
I'm using CPCtelera.



Why this game ? Because I believe that management is an under-represented genre on CPC. And because trains are fun !

Although I'm on early development stage, I would like to share the first results to get back your feelings.
Be indulgent, it is my first development for the CPC platform !

The code is available on my github account : Trewdbal/Railways - GitHub
Direct link to download the .dsk : https://github.com/Trewdbal/Railways/raw/master/railways.dsk

The map is proceduraly generated.
Move the cursor with arrow keys.
Press Enter for the in-game menu.
Actually, you can add stations (rotate it with space bar), build railways (change pattern with space bar), get information about a tile, destroy a tile.

For the moment, it does not work on 464. Maybe memory issues...
« Last Edit: 23:12, 03 February 16 by Trewdbal »

Offline Fessor

  • CPC6128
  • ****
  • Posts: 189
  • Country: de
  • Liked: 150
  • Likes Given: 40
Re: Railways : a railroad management game. (Progress topic)
« Reply #1 on: 00:35, 04 February 16 »
Looks like Railroad Tycoon!


Offline GeoffB17

  • 6128 Plus
  • ******
  • Posts: 532
  • Country: gb
  • PCW since '85
  • Liked: 114
  • Likes Given: 7
Re: Railways : a railroad management game. (Progress topic)
« Reply #2 on: 01:12, 04 February 16 »
Yes, I was thinking that.   I played Transport Tycoon a LOT, and was especially amused by the railway options.


Actually, still got the game set up on one of my PCs.


I think that TT, like some other games of like vintage, has been re-incarnated by 'fans', who have substantially re-written the system to be multi-platform, but avoid too many copyright problems by requiring that you have the original game, as the new version requires many of the original graphics files.


Same thing happening with my even bigger favourite, Settlers II.   I spend many hours playing that.   Too many hours.   A number of summer nights just vanished, I started playing about 10 pm, and next thing, I realised it was starting to get light next morning!!


Not got the right machine for this one, mind you.   Mind you, could do the tracks on the PCW??


Geoff

Offline ||C|-|E||

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 1.787
  • Country: gb
    • index.php?action=treasury
    • Mundo CPC
  • Liked: 1005
  • Likes Given: 1017
Re: Railways : a railroad management game. (Progress topic)
« Reply #3 on: 01:33, 04 February 16 »
It looks very nice! These games are usually not my cup of tea, but this one seems very promising and neat  :D

Offline SRS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 530
  • Country: de
  • Schneider CPC464 - what else ?
  • Liked: 531
  • Likes Given: 268
Re: Railways : a railroad management game. (Progress topic)
« Reply #4 on: 17:56, 04 February 16 »
Wow ! Nice idea and work in progress.

for the 464 issue: i got it to work on WinAPE in 64k os464 amsdos configuration:



-> looking at the source code:

maybe you could bring draw_cursor and draw_tile "together" - to save some dozen bytes :)


Offline Trewdbal

  • CPC464
  • **
  • Posts: 8
  • Country: fr
  • Liked: 24
  • Likes Given: 0
Re: Railways : a railroad management game. (Progress topic)
« Reply #5 on: 18:52, 04 February 16 »
Thank you for your messages !
Indeed, my current project is clearly inspired from Railroad Tycoon game mechanics.

What I done until now is related to the environment, so it was relatively easy.
A critical task will be coding the path of the trains. Maybe with graphs ?

I think that TT, like some other games of like vintage, has been re-incarnated by 'fans', who have substantially re-written the system to be multi-platform, but avoid too many copyright problems by requiring that you have the original game, as the new version requires many of the original graphics files.

OpenTTD is the best clone of Transport Tycoon Deluxe, and I believe you don't need original graphics files. You should have a look if you liked the original.

For my part, I played a lot with Railroad Tycoon 2, which is IMHO the best game of the RT franchise.

Not got the right machine for this one, mind you.   Mind you, could do the tracks on the PCW??

GeoffB17, I don't know the specifications of the PCW enough to say if it would be possible without a considerable effort.

for the 464 issue: i got it to work on WinAPE in 64k os464 amsdos configuration:

Interesting ! I used Arnold and it doesn't work. I get a red screen which seems to be a memory corruption.

-> looking at the source code:

maybe you could bring draw_cursor and draw_tile "together" - to save some dozen bytes :)

Thank you for spotting that  8) . I will have a look.
« Last Edit: 18:54, 04 February 16 by Trewdbal »

Offline TFM

  • Visit the mysteries of the CPC at www.futureos.de
  • Supporter
  • 6128 Plus
  • *
  • Posts: 9.899
  • Country: aq
  • Space Chicken for FutureOS is free!
    • index.php?action=treasury
    • FutureOS - The revolution on CPC!
  • Liked: 1977
  • Likes Given: 4650
Re: Railways : a railroad management game. (Progress topic)
« Reply #6 on: 19:05, 04 February 16 »
Looks promising! Keep the good work going!  :)
TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Offline Neil79

  • 6128 Plus
  • ******
  • Posts: 927
  • Country: gb
    • INDIERETRONEWS
  • Liked: 500
  • Likes Given: 159
Re: Railways : a railroad management game. (Progress topic)
« Reply #7 on: 19:35, 04 February 16 »
Niiice  8)
The latest in Indie & Retro News!!! IndieRetroNews - Indie Retro News on twitter

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 601
  • Country: es
    • Fremos Blog
  • Liked: 817
  • Likes Given: 790
Re: Railways : a railroad management game. (Progress topic)
« Reply #8 on: 22:25, 04 February 16 »
Nice work, @Trewdbal. Your made a lot of things work in very few time.  :D

I've tested it in a 464 and it works flawlessly: don't know why it shouldn't work. How did you test it?

After looking at your code, I'd give you two advices mainly:
  • Remove any piece of code from header files. Split your code so that all your definitions and code are in .c files. Leave only declarations on your header files to let other files know about your symbols.
  • As @SRS says, there are some functions with quite similar code. Always try to generalize your functions and reuse them. This will save a lot of bytes of code in the long run. Sometimes, making functions more general will make them slower. Take this into consideration only when functions are critical parts of your code (parts that are used frequently).
We will be glad to help whenever you need it :) . Keep up with this nice project!  :D

Edit: Another interesting thing you may want to try is random number generators included in latest CPCtelera version (master branch on github). You may use cpct_rand and cpct_srand same way as rand(), srand() C generators, but with rand() giving you random 8-bit numbers. These latest functions do not require you to be giving entropy bytes and pass all Dieharder tests, so they will be very useful for your procedural world generation :).
 
« Last Edit: 22:29, 04 February 16 by ronaldo »

Offline Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 14.977
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 2949
  • Likes Given: 5121
Re: Railways : a railroad management game. (Progress topic)
« Reply #9 on: 14:19, 05 February 16 »
Ah not my cup of tea, but it's always so nice to see new things being developed!

Offline Trewdbal

  • CPC464
  • **
  • Posts: 8
  • Country: fr
  • Liked: 24
  • Likes Given: 0
Re: Railways : a railroad management game. (Progress topic)
« Reply #10 on: 15:35, 06 February 16 »
Nice work, @Trewdbal. Your made a lot of things work in very few time.  :D

Thanks to your efficient software, I've been very productive indeed !!

I've tested it in a 464 and it works flawlessly: don't know why it shouldn't work. How did you test it?

I test it with arnold under my computer on linux. It crashes at the beginning.
As nobody encounters problems, I suppose it's due to the emulator.

We will be glad to help whenever you need it :) . Keep up with this nice project!  :D

Thank you very much ! Advices and feedbacks are very useful.
By the way, I will take into account ASAP your remarks on my code.

I'm happy to know that you propose now a more convenient random number generator.
With the entropy byte, it was like you need random numbers to get random numbers !
I will build the latest version right now, and update my code.

cpct_randu16 and cpct_randu32 are not working yet ?
« Last Edit: 16:03, 06 February 16 by Trewdbal »

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.332
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2251
  • Likes Given: 3477
Re: Railways : a railroad management game. (Progress topic)
« Reply #11 on: 16:45, 06 February 16 »
I test it with arnold under my computer on linux. It crashes at the beginning.
As nobody encounters problems, I suppose it's due to the emulator.
Please would you share the dsk with me? I will find why arnold crashes.
Thankyou.



EDIT: Sorry, I didn't read your first post fully. I see the dsk is there.

I don't see a crash, which arnold are you using. The wip one?

« Last Edit: 17:12, 06 February 16 by arnoldemu »
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline ronaldo

  • Dev
  • 6128 Plus
  • *****
  • Posts: 601
  • Country: es
    • Fremos Blog
  • Liked: 817
  • Likes Given: 790
Re: Railways : a railroad management game. (Progress topic)
« Reply #12 on: 17:09, 06 February 16 »
I test it with arnold under my computer on linux. It crashes at the beginning.
As nobody encounters problems, I suppose it's due to the emulator.
Some of CPCtelera examples also fail on arnold, while they all work on WinAPE and the real machine. I hope to be able to help @arnoldemu fix these issues in next releases of arnold. However, at its present status, I'd recommend you to use WinAPE. You can easily use the built in command cpct_winape to automatically install and launch winape with any DSK on Linux (you need wine).

I'm happy to know that you propose now a more convenient random number generator.
With the entropy byte, it was like you need random numbers to get random numbers !
I will build the latest version right now, and update my code.

cpct_randu16 and cpct_randu32 are not working yet ?
Well, the first random number generator was an extremely simple LCG that I included in a fast way to have something "random". However, new random generators included are high-quality: I've invested a lot of time selecting, optimizing and testing them.

As they are on the master branch, they are not reflected on 1.2.3 documentation (which is now online). However, you can check the implemented algorithms here:

cpctelera/random.h at master · lronaldo/cpctelera · GitHub

You've got cpct_rand32 and cpct_rand16 which will give you 16 and 32 bits random numbers, and are working perfectly. All these symbols are MACROS that refer to the real algorithms cpct_getRandom_mxor_u(8,16,32). These are based on Marsaglia's XOR-Shift, and all of them use the same seed. Therefore, there is a unique stream of 32-bits values and you will be picking 8, 16, 32 bit values from there.

Please, check the documentation of each algorithm to know more of them. Documentation is always included in the header part of each source file associated to each algorithm.

Offline Trewdbal

  • CPC464
  • **
  • Posts: 8
  • Country: fr
  • Liked: 24
  • Likes Given: 0
Re: Railways : a railroad management game. (Progress topic)
« Reply #13 on: 18:23, 06 February 16 »
I don't see a crash, which arnold are you using. The wip one?

I'm using arnold-nurgle-x86_64-2009-03-17.

@ronaldo : Thanks. random functions works like a charm !
And the cpct_winape command is very useful.
« Last Edit: 18:43, 06 February 16 by Trewdbal »

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.332
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2251
  • Likes Given: 3477
Re: Railways : a railroad management game. (Progress topic)
« Reply #14 on: 19:28, 06 February 16 »
Try this version of arnold:

arnold wip

My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource