Creating a simulation game

Started by , Wed 06/02/2008 15:57:32

Previous topic - Next topic

m0ds

Heyo! I have a small question or favour to ask, and thats about creating sim games where you build cities, theme parks, hotels, car parks, etc. I've been looking all over the net for some kind of "sim" creation tool but there doesn't seem to be one, unless someone knows of one?

I'm very interested in these types of games and I'd love to try making a really small one. Because it doesn't seem possible to find a sim creation system, I'd really like to know if anyone is willing to spend some time with me trying to make something in AGS, something simple that allows you to place certain objects within one square of a grid in a 320x200 room. Surely it can't be that hard? And if it's not possible with AGS, is it possible with some other engine like RPG Maker or something?

Basically I'm looking for some advice, or to find a programmer who has a spare day or so to see if we can build a basic thingy that allows you to play a sim game. The only thing I would really need help with at this stage is the initial thing of creating tile areas and working out when the user clicks "Build tree" and then clicks on one of the tiles/squares, it places it. And right clicking on it deletes it, or something.

I'm sure I'd figured out how to do it in my head the other night, but now for the life of me I can't remember what my solution was. So I probably just dreamt it!! ;) I'm fairly sure there aren't any games of this nature using AGS yet, but if there are please do point me in their direction. I'm also fairly certain it can be done in AGS, and I think in the past people have explained it is possible, it just requires some scripting that I'd never understand, hehe.

So, how can this be achieved in AGS? And is anyone willing to try it? If not then can you give me some pointers on the kind of scripting codes I'd need to be using and stuff. How do I create a whole screen of pre-defined square areas, etc.

Anyway, any advice, suggestions or just comments on how wonderful sim games are would be appreciated. I've been addicted to RCT3 and JP:Operation Genesis and although they're 3D they have really made me want to do something along those lines. Even if its just a top down, crap graphicy thing like the original Sim City ;) Ideally I want to make something for my friends kids, who love trains. So I just wanted to make something where you could create "tracks" and stuff. Making trains run on them is a whole new ball game, and I'd imagine would be insanely hard to do, but being able to just "create" railway layouts would be a great start. So yee-ah, any help appreciated :)


example

SSH

You know you can download the original Railroad Tycoon for (legal) free at: http://downloads.2kgames.com/railroads/Railroad_Tycoon.zip
12

m0ds

Cool, I'll have a play - so thanks Andrew... But it's only going to make me want to make my own more ;) Plus I really want to make something custom and easy for these kids, who are very, very young.

SSH

So, it should be easy. You could simply divide mouse.x and y by the size of your grid to work out the grid square. And Rawdraw the track sprites onto the background. Erase would just be rawdrawing a blank sprite. A GUI to have your track toolbox. And an array to remember what track was where for when you want to run trains on it.
12

m0ds

Thanks! Well, its rawdraws and arrays that I don't understand as I've never had to use them before, so thats where I'd specifically need some help. Also, you'll need to explain the dividing of mouse x and y, what do you mean? By the size of one square or of the screen?

SSH

Code: ags


struct rows {
   int col[32];
}

rows row[20];

#define SQUARE_SIZE 10

int gridx=mouse.x/SQUARE_SIZE;
int gridy=mouse.y/SQUARE_SIZE;
row[gridy].col[gridx]=current_track_type;
int rawx=gridx*SQUARE_SIZE;
int rawy=gridy*SQUARE_SIZE;
RawDrawImage(rawx, rawy, current_track_sprite);



12

m0ds

Thanks! But I'll be blatent. Any chance you could create a tiny AGS game that uses that code and upload the game files? It'd be really useful. I really don't have a clue what that code means, how to modify it or where in the AGS script file it should go without any explanation. It looks pretty simple, but, well, an actual file to work from would be far quicker cos otherwise I'm going to just keep asking you question after question, hehe!

InCreator

Game maker! Game maker! Game maker!

GM is TOTALLY the thing you should use for your game. And I'm happy to provide ANY coding help you could need, having long and deep experience with this system.

But sim should be small-scale. Don't even try to think about Transport Tycoon scale, for example. Original sim city is maybe biggest thing you could do with GM - without too heavy slowdown.

m0ds

Ooh, thanks! I'm definitely going to try GM, because it's quicker to download and learn that than it ever would be to get SSH to put that code into an AGS game... ;) But seriously, I'd rather work with AGS because I know it so well, and I know it's capable of doing these things even if its not designed for it.

InCreator

#9
If you need ANY help, ask.
But if you're never used GM before, let me give you first important tips:

* Do not use icon gui system in game maker. It's awful. "Execute a piece of code" is and will be only icon you need. So,

* Start learning functions immediately. This road building thing you showed would take only 20 minutes or so to create in game maker.

* For road thing, draw a tileset first, then cut it into pieces, make a sprite in GM where every bit is a subimage of animation, and with some simple coding, you can set different subimage for every track piece object. This is way faster and simpler than making different sprites for different track pieces.

* GM functions are easy to learn. All image-related functions start with "image_something", keyboard events "keyboard_something" and so on. So, it's quite easy to find them from GM helpfile.

* Just like in AGS example SSH provided, in GM you could also use arrays to make whole thing. But there's ton of other possibilities to make this.

* Everything is object-based. Every road bit should be an object, every train, house, so on.
To tell difference between objects that are copies of SAME object, every object has an unique value in variable ID.
For example, if you make an object named "track", and insert 3 of them into room, while they are absolutely same, value of track.id is different for each piece. A bit early to say this, but knowing what you're about to do, you DO need to know this. Makes life alot easier!

* Most of the game and code goes into "step" event for objects

* Do make your own variables, you have to declare them (similar to Turbo Pascal or even AGS). But in GM, it's as simple as giving them initial value in "create" event. For example, health = 0; in create event will ensure that your object has a variable named "health". And so on.

* To make a variable usable to ALL objects, instead of object name, you must use keyword "global".
For example, track.health is a variable for object "track", but global.health is a variable to every object. Like AGS GlobalInts.

m0ds

Thanks, well, I'm looking around at it and it seems fairly simple to use! I've already started playing with tiles and stuff. But for every one I place it deletes the one above it, goddamn! Not sure if I've drawn my tile to big or something. Anyway, cool - it looks simple so I'll keep playing. Thanks for the tips too InCreator, I shall PM you as soon as I need to know something. And, this engine is capable of 3D games too? Madness! Ok, well, back to it for a bit...

InCreator

#11
Turn off "delete underlying" for this.

But 3D is very basic, messy and difficult. To make something good, you should use external DLL-s, like Irrlicht engine (there's a port to Game Maker) or something like this. I don't suggest messing with 3D though, there's way better engines for this. Like NeoAxis for example.

m0ds

Neat! Nah its cool, I was just impressed that it seemed to be able to do 3D games. Still, I've got to go offline now but Im going to have a play, see what I can produce. I doubt I'll really make any progress but it'll be good to have a go.

As I said previously though, I don't really trust any other engine. Especially not ones with splash screens and pro editions, so I still would really LOVE to be able to do all this in AGS. But maybe GM will teach me a little more about how I CAN do it in AGS. Cheers dude!!

InCreator

Pro edition actually has only tiny changes from shareware version. It doesn't reduce GM capabilities noticeably, and is visible mostly to long-time veteran users only. But if I remember correctly, version 5.3 is still free, AND without splash screen or any limitations. And there's really little of changes in later versions, mostly handful of (quite useless, work-around-able) functions and built-in editors.

Also, v5.3 GM is noticeably faster and stabler, with much lower minimal requirements to a computer than 6 and 7 versions.

Ponch

Quote from: InCreator on Wed 06/02/2008 22:48:49
v5.3 GM is noticeably faster and stabler, with much lower minimal requirements to a computer than 6 and 7 versions.

I still use 5.3 and it runs just fine. I tried 6 and 6.1 but eventually went back to 5.3. I've made three Barn Runner games with GM and 5.3 is the way to go if you ask me. However, you can (probably) make a SimCity game with AGS.

I have an "in the works" game that I plan to release once the Barn Runner games are done. At one point I had a star base screen (think XCom) where you could customize your base as the game went on. I used hot spots to check where the player was placing what sort of structure on the terrain map. The graphics were based around a hex tile and designed in such a way that they fit together in any way. Each tile had its own cost, its own stats and added various bonuses (and detriments) to your growing base.

I scrapped that part of the game to focus more on "Star Flight meets Star Control" style game play but (for 2.56d at any rate) it seemed to work as a smallish city builder just fine in AGS. Granted it was limited to 20 "units" due to the hotspot limit, but I was able to build some nice little structures with it. If I was able to do it that way (which I admit is a little limiting if you want to do a sim larger than an space outpost), I'm sure that someone who is a better coder than I could really do something great with it.

Short version, while GM is probably easier for this sort of thing, I have no doubt it could be done in AGS, plus doing it with the power of the big blue cup would be serious bragging rights!

- Ponch

SMF spam blocked by CleanTalk