News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

Railways : a railroad management game. (Progress topic)

Started by Trewdbal, 22:06, 03 February 16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Trewdbal

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...

Fessor


GeoffB17

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

||C|-|E||

It looks very nice! These games are usually not my cup of tea, but this one seems very promising and neat  :D

SRS

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 :)


Trewdbal

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 ?

Quote from: GeoffB17 on 00:12, 04 February 16
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.

Quote from: GeoffB17 on 00:12, 04 February 16
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.

Quote from: SRS on 16:56, 04 February 16
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.

Quote from: SRS on 16:56, 04 February 16
-> 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.

TFM

TFM of FutureSoft
Also visit the CPC and Plus users favorite OS: FutureOS - The Revolution on CPC6128 and 6128Plus

Neil79

The latest in Indie & Retro News!!! IndieRetroNews - Indie Retro News on twitter

ronaldo

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 :).

Gryzor

Ah not my cup of tea, but it's always so nice to see new things being developed!

Trewdbal

Quote from: ronaldo on 21:25, 04 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 !!

Quote from: ronaldo on 21:25, 04 February 16
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.

Quote from: ronaldo on 21:25, 04 February 16
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 ?

arnoldemu

Quote from: Trewdbal on 14:35, 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?

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

ronaldo

Quote from: Trewdbal on 14:35, 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).

Quote from: Trewdbal on 14:35, 06 February 16
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.

Trewdbal

Quote from: arnoldemu on 15:45, 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.

arnoldemu

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

Powered by SMFPacks Menu Editor Mod