Confused about NPC's and map editor

I’m working on a 2d orthogonal tiled game and i’m not so sure the tiled map editor will be enough…This is my first major project…I’ve made a few small games like brickbreaker and pacman…I will be using 16x16 tiles and moderately small maps. Probably 64x64…So i’m going to have multiple maps. I’m not sure what to do, because I don’t want to have to set the tile properties for every single map I make…What can I do?

Also, i’m not sure how to make the NPC’s…I’d like to be able to have animals running around, people that you can talk to, etc. My first thought was to use an object layer…But this won’t work. I’ll need to be able to set images, make the NPC talk, and things like that. I know i’m going to need some type of scripting system, but i’m not sure how I can implement it into tiled to add to the maps…It seems kind of redundant to hard-code the NPC’s into the game…They will change.

In the end, I want to be able to take this game online so players will be able to create maps…I’m nowhere near ready to do it online yet…Thus why i’m making it single player for now. I hope this makes sense, I tried to explain it in the best way possible.

Think about it logically. What does each map need to contain? Tiles and Mobs (NPCs). So each map needs to hold a array of NPCs. You don’t need to manually specify where each spawns, you can just do it randomly if you’re ok with that.

Well, that’s the thing. I do need to specify where they are. For instance, I have a character standing in front of a house that the player can talk to by walking up to.

Whew that is a mouthful, but it sounds to me like you are trying to make an RPG of sorts. Well you made Pac-man, so I’m thinking that you understand the basics of collision detection and how to move ghosts around. It is just taking that exact same logic and making it so you can do NPC’s and characters.

To be honest, the best way to do this would be a tile based system. It will be very similar to pac-man. Instead of a predetermined map, the ghosts are allowed to move wherever they want. Instead of colliding and the main character dying, you just have text pop up or some kind of interactivity between the ghosts and the main character.

Of you are just starting out, you might not want to make a expandable system first. Connecting your world to a script is a very daunting task, and it makes the game harder to package for no good reason. Going online just makes matters worse. Try to keep it hard coded, and also try to make your objects separated. The more basic you make things, the easier it will be to code your game.

Anyway, this is just vague advice. Maybe you can go into more detail of exactly what kind of game you are trying to create.

Sorry. I’m scatter-brained right now haha. I’m making a farming game similar to harvest moon…like i’ve seen so many other people making…haha. I’ve had the idea for a few years now being a fan of the series. Just never got around to trying to make it. I’m using a tiled system with Tiled as an editor. I’ve already got it setup and the character walking around and everything. I know I could do it using the object layer and object properties. I could use a variable on each object specifying what type of NPC it is and the different parameters needed for that NPC…

It just seems like there is a better way. I use to develop for a game called GraalOnline and I guess i’m use to that and trying to make it similar. In the map editor you can place an NPC on the map which you can set an image for it by default or you can script it as well as the actions.

What do you a better way? The way you’re describing seems to me like a pretty efficient way as it is. You place the objects on the map and set their individual properties. Then you could make some type of parsing system in Java that reads each of these objects and assigns an animation frames, A.I script, etc based on the properties of each object.

I think you need to first seperate your games architecture into relevant Components:

-The Renderer, how is my world brought to the screen.

-the World layout and layers (how are static and dynamic object in the world positioned,
for example: a bottom layer for the ground, a layer for static buildings, a layer of dynamic objects (NPCs)

-How do I fill the world with content / eg how to load Data.
this could be done with a custom Tile editor, saving the editet worlddata in to textfile,
For NPCs, you could use xml or your own simple definietion script to customize each NPC (position, ID, looks, stats, name etc)

I would not hardcode every NPC and Dialog in the long run, especially if the game gets bigger.
Hardcoding can be done in a prototype to try out stuff.
Best is to use xml or your own file format to store and edit the world, and to seperate the code-logic from the content.

If there are only few entities of a type on the map, an array with a 1:1 match to the tiling of the world is quite some overhead (and it has a lot of empty cells, which annoy the processor cache). At times it is better to use HashMap which is indexed with the entity coordinates.

But arrays are good for a start, if you have little experience with tiled worlds yet, go for arrays. I’m using arrays in my last RPG attempt too.