Questions on how to create a game similar to Pac-Man - iphone

I want to make a game that will be similar to Pac-Man from scratch. I don't want to use a games engine either, just plain old Xcode.
Basically the game would consist of a map that fits the screen, walls within the map, food, enemies and a player.
I just wanted to know what the best way forward would be. I plan on creating the map first, and then doing everything else after that. Where should I begin?

I plan on creating the map first
Keeping in mind that you'll probably want several maps, you might want to create a map editor first, which would let you place "wall" graphics and define the paths along which the player & ghosts are allowed to travel. If you define those paths with nodes at each intersection, the ghost AI becomes easy to solve with A* path finding. Your map editor can use the distance between intersections to calculate the "weight" of each path segment.

Related

Instantiating Objects at Different Intervals Unity

I am trying to make a 3D jumping game where my character is standing still and the objects and background are moving towards him to make it seem like he is running. I have a bunch of models for buildings that I am instantiating using an empty game object that I use as a spawner. I want the buildings to spawn one after each other, so whenever one building has moved far enough and left enough space the next one should spawn. I first tried to do this with InvokeRepeating, but the buildings are different widths so it does not work well with a constant repeat rate. I then tried to put a collider on my spawner and spawn a building whenever the spawner collider is not colliding with anything, but it seems to just spawn buildings infinitely. Is there a way to fix this or a better way to do this?
There are many different ways of doing this.
The most straightforward is possibly to let each building spawn the next one, as I assume they each know how wide they are and thus when it's time for the next.
Well , first things first your problem is looking more like a design problem. I would recommend searching things like "procedural world building" , also object pooling. There is lots of examples of runner games that do what you describe.
You can check the palyer position to instantiate , you can create parts of the road as prefabs , make lots and lots of prefabs and instantiate them as you go etc. The question you asked is simply too wide to give an actual answer. So if you have any more spesific questions , it'll be nice to answer !

How to grab the 2D views/textures from a 3D Object in Unity

I am working on a Projection Mapping Project and I am prototyping in Unity 3D. I have a cube like object with a 3D terrain and characters in it.
To recreate the 3D perspective and feel I am using two projectors which will project in a real world object which is exactly like the Unity Object. In order to do this I need to extract 2D views from the shape in Unity.
Is there an easy way to achieve this ?
Interesting project. It sounds like you would need multiple displays, one for each projector, each using a separate virtual camera in Unity, like documented there.
Not sure if I understood your concept correctly from the description above. If the spectator should be able to walk around the cube, onto which the rendered virtual scene should be projected, it would also be necessary to track a spectator's head/eyes to realize a convincing 3D effect. The virtual scene would need to be rendered from the matching point of view in virtual space (works for only one spectator). Otherwise the perspective would only be "right" from one single point in real space.
The effect would also only be convincing with stereo view, either by using shutter glasses or something similar. Shadows are another problem, when projecting onto the cube from outside the scene. By using only two projectors, you would also need to correct the perspective distortion, when projecting onto multiple sides of cube at the same time.
As an inspiration: There's also this fantastic experiment by Johnny Chung Lee demonstrating a head tracking technique using the Wii Remote, that might be useful in a projection mapping project like yours.
(In order to really solve this problem, it might be best to use AR glasses instead of conventional projectors, which have the projector built in, and use special projection surfaces that allow for multiple spectators at the same time (like CastAR). But I have no idea, if these devices are already on the market... - However, I see the appeal of a simple projection mapping without using special equipment. In that case it might be possible to get away from a realistic 3D scene, and use more experimental/abstract graphics, projected onto the cube...)

Multiple Tilemap Maps Loaded Dynamically

Feel free to close this question if it is deemed too subjective. I realize that it might very well be, as it may focus heavily on best practices, which, if not an industry standard, may be subjective.
The Problem & Idea:
I'm using the tilemap system in unity (2D), and its been working great, but I have a few concerns regarding my particular usage. What I'd like to have is multiple "battle maps" that will get instantiated when the battle scene is switched to. My current idea is to just make each type of battle map a prefab (prefab on the grid, since the tilemaps are just layers), and then instantiate the grid when the scene loads in.
Is this best practice or is there any better way? Does having 10 maps vs 200 maps make a difference?
Other Things I've Considered:
Would it be a better idea to make one huge tilemap with all of the battle maps drawn a distance away from each other and just restrict the camera to moving only within the "current" battle map? The absolute max size I could see a map being is, let's say 30x20 tops, probably closer to half that though.
An earlier idea was to use small pixel map images to render the maps in. This was before I found out about Unity's tilemap system, which, admittedly, I'd rather use because it is so much simpler to visualize, and less work to develop.
The Scenario:
For simplicity's sake, let us assume the game has 2 scenes, the main menu, and a battle scene. Basically, the idea is to enter the battle scene and have a random battle map to be spawned out of what's available. The character(s) get placed, and any additionals also get placed, say, items, or what have you.
Is what I proposed above best practice? And should I consider any other other two systems I've also described? Or is there something I'm not thinking of that would be even better?
I don't believe that any of the above ways wouldn't work, I'm just curious if any of them is the best way to go about doing this.
Your consideration to have all of your battle maps drawn on a single tilemap and restricting the camera to only the region of the current map is an instant red-flag.
In my experience with unity, if I want to have a large level drawn on a grid I will have to break it up into chunks (each chunk is a separate tilemap) for performance reasons in the editor and in the game, so I would not recommend doing that.
If your goal is fast load times, then instancing a prefab as you suggested is not a terrible idea as long as the respective tilemap is fairly small (less than 10000 tiles), otherwise you would almost difinitely notice the map getting loaded in. If you are trying to load large tilemaps seemlessly, it may help to load the tilemap asynchronously before the actual switch occurs.
I would keep only the current map and next map loaded in the scene to ensure a seamless transition and optimal resource usage. Unity's tilemaps are not light.

What would be the best way to do pathfinding on a random object that rotates

I want to do pathfinding on a rotating "planet", similar like the enemies do in mario galaxy, except the planets are rotating. What would be the best way to do it? The planets come in different forms, and it is necessary that I place the waypoint with code. That is because I need to do it with code for my assignment and also I want to make an object pool of waypoints that get placed on the planet the player is currently on.
So is A* the best way to go? I was thinking about the technique I should use and I thought of placing every waypoint on a vertex of the model. But some models can get pretty high in vertices, so isn't that really heavy if I have that many waypoint and then use them for path finding?
Or is there a better way of doing it? I was thinking can't you do it based on the uv's of the planet? The only thing is that the uv's have cuts so how can I tell the enemy to also check the cuts of the uv's for a shorter path?
Best way to animate planets will be to download leanTween or some similar asset and make animation by curve path + rotation.

SpriteKit: Creating a tile based maze

I want to create a game with a maze(not really) in it. The whole map should be surrounded by wall and inside these walls there should be a maze. This maze should be randomly created. On every tile where no wall is placed, the player should be randomly placed. Is there a build in class/function in SpriteKit that can fulfill my requirements or do I need to come up with an algorithm by myself?
PS: A possible visualization would be the game PacMan with randomly created stages.
You can use a tile map to create your maze/levels, but you will need to write the code to do this. It will be a tough algorithm to ensure that each level is playable/winnable. Might be worth starting with defined layouts to get the game play right, then add in random generation.