Page 1 of 2

OpenCity Revival, by me.

PostPosted: 04 Sep 2016, 01:25
by ChristopherH
Hello everyone.

I've been digging into the OpenCity codebase. Now I'm not that good with C++, but it seems expandable when it comes to industries.

I added two more power stations, wind and oil:

The graphics are my own in blender, but I re-used some existing OpenCity textures for the Oil power plant. Wind turbine currently has none but these will be added.

This took me a few weeks. I'm looking at a purchase ledger to be added next, then hopefully move onto upgrading it to SDL 2.0, but that's a lot more complex than the general copy-and-pasting additional power plants and getting it all going, which is all this was.

Notice that the Oil power plant is named "CanonicOil". Hohohohoho, I'm so funny.

Hopefully this excites someone.

Sources:
https://www.dropbox.com/s/4zx58rj7utio2 ... ar.xz?dl=0

The original project was GPL. Still is, obviously.

Re: OpenCity Revival, by me.

PostPosted: 04 Sep 2016, 17:43
by charlie
Nice work! I would really love to see this go somewhere. I used to regularly check the Open City website when I was maintaining the blog but progress was glacial.

Re: OpenCity Revival, by me.

PostPosted: 04 Sep 2016, 23:55
by ChristopherH
Hi Charlie, I'm glad you like my work. Thing is this was mostly copy and pasting and finding out why the game would segfault and tweaking things. I would really like to update the game to SDL2 and from there work on other stuff. The XML file lets you change the city size, and according to that file, you shouldn't raise it past 100 x 100. I'm not sure why this is, I emailed the original developer but he has not replied as of yet. I'd be interested to know if it is a CPU problem or a memory leak or something like that.

My reference point is SimCity 4. I have played Cities: Skylines extensively recently and it's very good but SimCity4 Rush Hour was the perfect city building game in every way.

I was also looking at MyGUI but I'm unsure how to start with that. I'm going to make some example programs and test things out.

The graphics engine is OpenGL2.1 from what I can tell. I'm not sure if I want to upgrade that or not. There's lots of documentation for that API out there and this game actually currently runs on the Raspberry Pi 3 with the opensource MESA vc4 driver. However, for some reason, possibly a driver bug, the land is not shown. Other textures work. I'd really like to maintain compatibility with this hardware for the biggest audience possible and the VideoCore4 GPU in the Pi only supports OpenGL 2.1 as the maximum featureset.

This is all lofty however. For the time being I'm going to work on a replacement Wind Turbine model that doesn't suck, add a few buildings here and there to make the city more "alive" and play around with SDL2 to get to grips with it.

I'm away for 4 weeks soon for a holiday so I hope nobody expects any progress before then.

I would also like to repeat that my C++ coding abilites are limited and weak and I am trying my best but have already started from scratch a few times to get to this stage. I'm hoping the development will be faster than the old team, I feel I got a lot done in the last few weeks.

Thanks for looking and take care!

Re: OpenCity Revival, by me.

PostPosted: 05 Sep 2016, 00:10
by mdtrooper
Well, is there a code repository such as git or svn?

And your work is awesome.

Re: OpenCity Revival, by me.

PostPosted: 05 Sep 2016, 00:36
by charlie
Perhaps if you would rather pool your own personal resources into the coding side of things then you might inquire over at OpenGameArt(.org) to see if anybody is interested in helping with the modelling.

Re: OpenCity Revival, by me.

PostPosted: 06 Sep 2016, 09:42
by Imerion
Awesome to hear you picked this up! Feel no pressure to do this or that, any improvements you do at all are worth it and it should all be for fun. Will be fun to try this some day. :)

Re: OpenCity Revival, by me.

PostPosted: 06 Sep 2016, 11:40
by Julius
charlie {l Wrote}:Perhaps if you would rather pool your own personal resources into the coding side of things then you might inquire over at OpenGameArt(.org) to see if anybody is interested in helping with the modelling.


In fact the modular assets from Kenny might work fine, see for example the road pack or the building, nature etc.:
http://opengameart.org/content/3d-road-tile-pack
http://opengameart.org/content/modular-3d-buildings
http://opengameart.org/content/nature-pack-extended

all his stuff can be browsed here (also other building and vehicles etc., not all 3D though):
http://opengameart.org/users/kenney?page=1

Re: OpenCity Revival, by me.

PostPosted: 06 Sep 2016, 12:04
by charlie

Re: OpenCity Revival, by me.

PostPosted: 07 Sep 2016, 14:01
by dulsi
Conversion to SDL2 is pretty easy. The SDL2 migration guide gives you all the information you need to convert a program. I've done it twice now for Bt Builder and Troll Bridge. I'd suggest creating a repository somewhere so people can easily help or see what you are up to.

Re: OpenCity Revival, by me.

PostPosted: 09 Sep 2016, 14:07
by charlie

Re: OpenCity Revival, by me.

PostPosted: 15 Sep 2016, 17:49
by Duion
Why don't you use an up to date engine like Torque3D, it might be a bit harder to get started, but in the end you can have full 3D realistic graphics like cities skylines.

Re: OpenCity Revival, by me.

PostPosted: 25 Sep 2016, 17:33
by DGMurdockIII
nice i love this game hope you keep up the work on updating it

Re: OpenCity Revival, by me.

PostPosted: 26 Sep 2016, 10:48
by charlie
Duion {l Wrote}:Why don't you use an up to date engine like Torque3D, it might be a bit harder to get started, but in the end you can have full 3D realistic graphics like cities skylines.

That's just dangerous talk. That kind of pie in the sky thinking is what kills open source projects. Don't aim for the standards of an AAA game. Have clear, attainable, well understood goals rather than false dreamy ambition.

Re: OpenCity Revival, by me.

PostPosted: 27 Sep 2016, 18:23
by StephenJSweeney
Don't aim for the standards of an AAA game. Have clear, attainable, well understood goals rather than false dreamy ambition.


This needs framing.

Re: OpenCity Revival, by me.

PostPosted: 28 Sep 2016, 04:03
by c_xong
StephenJSweeney {l Wrote}:
Don't aim for the standards of an AAA game. Have clear, attainable, well understood goals rather than false dreamy ambition.


This needs framing.

The way I understand it, projects get riskier as they get larger, and rewriting a game to use a different engine is a pretty large project. Even more so for FOSS projects which depend on volunteer enthusiasm. A very likely outcome is that the developer loses interest because no progress is being made.

The latest large project I undertook was to add rudimentary network multiplayer to C-Dogs SDL; this involved extensive rewrites of the guts of the game and took 1 year total. This is despite lots of preparation with prototypes, and I lost interest many times and was sidetracked with other projects. I'd be very cautious about people undertaking such projects, especially if I wasn't sure they had the dedication and skills to pull it off.

Sometimes rewrites are worth it, to get the productivity gains. For example those Atari classics took months for experienced hackers to write, but can be done today by novices within days using game makers. Most of the time it isn't worth it though.

Re: OpenCity Revival, by me.

PostPosted: 28 Sep 2016, 11:42
by ChristopherH
Hi everyone, I am back off holiday next week, so I will look into this project then.

mdtrooper {l Wrote}:Well, is there a code repository such as git or svn?

And your work is awesome.


I will be setting up a git repository soon-ish.

dulsi {l Wrote}:Conversion to SDL2 is pretty easy. The SDL2 migration guide gives you all the information you need to convert a program. I've done it twice now for Bt Builder and Troll Bridge. I'd suggest creating a repository somewhere so people can easily help or see what you are up to.


Thanks, I'll take a look. Will set up a git when I get home to my own PC with the latest source on it.

Duion {l Wrote}:Why don't you use an up to date engine like Torque3D, it might be a bit harder to get started, but in the end you can have full 3D realistic graphics like cities skylines.


Why don't you use it? Doesn't sound fun.

Just to be clear to everyone, I am _NOT_ good at C++. At all. I'm amazed I've got as far as I have. Just to be clear, when I set up the repo people are free to provide new code and suggestions as such, if I even understand what you've written, but it's not a committee. If anyone says "Oh, why don't you just add multiplayer?" or "Wouldn't it be good if you supported Vulkan?" feel free to code these things, but currently I can't, and don't intend to.

I've found a project online called Energy Tycoon. I remember playing it years ago but it crashed after a while. Perhaps I can use some of the assets.

Re: OpenCity Revival, by me.

PostPosted: 29 Sep 2016, 13:40
by Duion
charlie {l Wrote}:
Duion {l Wrote}:Why don't you use an up to date engine like Torque3D, it might be a bit harder to get started, but in the end you can have full 3D realistic graphics like cities skylines.

That's just dangerous talk. That kind of pie in the sky thinking is what kills open source projects. Don't aim for the standards of an AAA game. Have clear, attainable, well understood goals rather than false dreamy ambition.

And this is just ignorant talk, this is what really kills open source projects. You aim low, achieve even lower and get forgotten.
You have to code the game logic anyway, so you can stick it as well on a high quality foundation, like up to date graphics, there is not much difference in efford required as you might think. There are many games out now that have been made by small indie teams but can compete with AAA titles thanks to the technolog being available to everyone now.

Re: OpenCity Revival, by me.

PostPosted: 29 Sep 2016, 14:28
by ChristopherH
https://github.com/chrishancox/opencity2

Here is the repo. You'll notice there's only a test file in it so far, I'm trying to add the project files to it in the terminal but it's not letting me for some reason and it's not intuitive...

Duion {l Wrote}:
charlie {l Wrote}:
Duion {l Wrote}:Why don't you use an up to date engine like Torque3D, it might be a bit harder to get started, but in the end you can have full 3D realistic graphics like cities skylines.

That's just dangerous talk. That kind of pie in the sky thinking is what kills open source projects. Don't aim for the standards of an AAA game. Have clear, attainable, well understood goals rather than false dreamy ambition.

And this is just ignorant talk, this is what really kills open source projects. You aim low, achieve even lower and get forgotten.
You have to code the game logic anyway, so you can stick it as well on a high quality foundation, like up to date graphics, there is not much difference in efford required as you might think. There are many games out now that have been made by small indie teams but can compete with AAA titles thanks to the technolog being available to everyone now.


That's fine, but I don't feel like I'd enjoy it or learn anything.

Re: OpenCity Revival, by me.

PostPosted: 29 Sep 2016, 14:54
by charlie
Duion, please take this kind of discussion elsewhere. Who are you to say what is aiming low? He's pursuing an interest, a hobby, and to put that up with the expectations of a game that is produced by dozens or hundreds of people as their jobs is frankly ridiculous (which was your original assertion i.e. Skylines). It isn't helpful.

Re: OpenCity Revival, by me.

PostPosted: 29 Sep 2016, 15:00
by ChristopherH
Okay, source force-committed, it's online now.

Re: OpenCity Revival, by me.

PostPosted: 29 Sep 2016, 15:57
by ChristopherH
I tried to do the process of SDL2 conversion by changing the headers to <SDL2/SDL.h> etc... but I come across some crazy errors I don't understand so I should probably learn C++ better first.

Re: OpenCity Revival, by me.

PostPosted: 29 Sep 2016, 18:17
by farrer
ChristopherH {l Wrote}:I tried to do the process of SDL2 conversion by changing the headers to <SDL2/SDL.h> etc... but I come across some crazy errors I don't understand so I should probably learn C++ better first.


Did you take a look on the SDL2 migration guide? When I converted DNT to use SDL2, all the errors and problems that happened while changing were easily fixed with a look on it.

Re: OpenCity Revival, by me.

PostPosted: 29 Sep 2016, 19:23
by ChristopherH
farrer {l Wrote}:
ChristopherH {l Wrote}:I tried to do the process of SDL2 conversion by changing the headers to <SDL2/SDL.h> etc... but I come across some crazy errors I don't understand so I should probably learn C++ better first.


Did you take a look on the SDL2 migration guide? When I converted DNT to use SDL2, all the errors and problems that happened while changing were easily fixed with a look on it.


{l Code}: {l Select All Code}
const String Sdl::GetRuntimeVersion()
{
   const SDL_version* lpVersion = SDL_Linked_Version();
   //assert(lpVersion != NULL);

   String lsStringVersion;
   lsStringVersion << (short)lpVersion->major << "." << (short)lpVersion->minor << "." << (short)lpVersion->patch;

   return lsStringVersion;
}


This is the troublesome part. Apparently SDL_Linked_Version doesn't exist in SDL2.

Here's the SDL entry:
http://sdl.beuc.net/sdl.wiki/SDL_Linked_Version

It was last edited by none other than the original OpenCity dev himself. So I'm not sure if this is something he added himself. It's only present in what's described in the code as the "sharp plus framework". It looks to me like he was trying to test out some new code, possibly to replace the old, creaky stuff?

Re: OpenCity Revival, by me.

PostPosted: 29 Sep 2016, 20:19
by farrer
ChristopherH {l Wrote}:This is the troublesome part. Apparently SDL_Linked_Version doesn't exist in SDL2.

(...)

It was last edited by none other than the original OpenCity dev himself. So I'm not sure if this is something he added himself. It's only present in what's described in the code as the "sharp plus framework". It looks to me like he was trying to test out some new code, possibly to replace the old, creaky stuff?


What he's doing in this function is just concatenating the .so (or .dll if on windows) SDL version to a string he'll later use in the function int TestSystemInformationSoftware() at test/framework/main.cpp line 218. Apparently, there's no other call of Sdl::GetRuntimeVersion() in any other part of the code.

And on TestSystemInformationSoftware, the string returned by the former is just flushed to the Terminal class (not sure if it is the std:out or a widget terminal, as I didn't searched for it on the code). Making short: it seems like just 'debug' info flushed out. You can just delete the former function (Sdl::GetRuntimeVersion()) without any practical effect besides not seeing which version of SDL the application is running.

Edit: Just to make sure: the only assertion he made at this function is commented out (so, he's just flushing the SDL version). And even if the assetion wasn't commented out: testing if 'no version' calling a function of the former .so will make no sense. Just remove out the function and its call.

Re: OpenCity Revival, by me.

PostPosted: 30 Sep 2016, 19:28
by TiborBuzási
You could try using SDL_GetVersion() instead, which seems to have the same purpose in SDL2.

Here's a link to the wiki:
https://wiki.libsdl.org/SDL_GetVersion