Changing control schemes between camera views? - unity3d

I am a beginner gamedev and trying to figure out how to go about implementing my game's inventory management system. I am developing a third person RPG, with heavy emphasis on inventory and crafting, and so it needs to be done right.
I essentially have a tablet device the player will be able to use to access statistics about themselves and should also be their method of ascertaining crafting recipe. An example scenario is as follows: player obtains three recipe items, Apple, Leaf, and Ash. They want to craft a healing poultice in the field. They remove their backpack, which serves as both inventory and a less powerful crafting station, and the camera moves to focus on the backpack as if it were an inventory screen, allowing the player to arrange their ingredients as necessary and then craft.
My problem is I haven't figured out how to manage the control switch. Ideally the player shouldn't be able to walk around and do normal traversal while crafting. Indeed having WASD usable as menu manipulation controls would be preferable. The game is of the type that realtime usage of inventory is part of the experience, so I dont want a static pause screen. What avenue do I need to pursue in my research for this?
I've looked into Cinemachine and state switching/statemachines but I'm still fairly puzzled by that whole affair. I can switch to a state so far, but only sometimes get out of it. I'm away from my computer at the moment so I don't have an example but this concept has been nagging me for hours.

Related

HoloLens 2 Not Retaining Anchor Placement

we're using the HoloLens 2 and Azure world anchors to place the content within a room but when viewing the app content the anchors/room are spun 90% or 180% from where they should be. They are always square on and never diagonal, so it's like the room is being flipped.
We’re confident it's not the code, as we've successfully used it in multiple other locations, it just this one room we can't get it to work in.
To ensure it’s not our code we’ve tried rebuilding the app, as well as ensuring we’re on the latest versions of Unity and MRTK. The HoloLens 2 firmware are also up-to-date and we’ve also tried adding a delay to the code, just in case the network's too fast and it needs some latency to do it’s thing but none of this has helped.
Additionally, the anchors stick in a position for 5-20mins, then will move to a new position - so occasionally they seem to be working but even a broken clock is right twice a day!
There’s no consistency across headsets either and the anchors will be a different position for each one. The app and code is rock solid in all other locations and we've tested placing the content on another wifi network and the same wifi network but another location and all works as it should. We've tried removing all and nearby holograms to refresh the spatial map but this doesn't cure the issue. We've also tried making the room less complex as well as more complex but again this doesn't fix things and if it does it's only temporary.
Our gut feeling is it’s something out of our control, such as wifi points throwing it out of whack, or interference of some kind such as magnetic or radio etc. If it's useful or relevant we also use Photon to facilitate a shared experience across devices.
Any suggestions much appreciated!

Sending game state only for entities that are "visible"?

Let's say I have an open world game that supports multiple players.
The game stores their positioning by X and Y in this world.
Also, whoever is playing the game can see a canvas of 11x11, where his player-self is represented on this screen, always centered.
The game world has 1000x1000 squares to walk using keys.
What I know is that:
I could emit events whenever a player walks,
check this event data at the server-side (to see if it is possible and the speed is correct/anti-cheating measures),
update the game state which contains all players and positioning,
re-emit this state from the server so every client would be able to render properly this new player.
The problem is, should I really update someone who isn't even being seen?
When everyone is walking around, moving items, earning levels, etc - those events are being emitted from the client, and that's okay, but thinking about the server-side, it will re-emit that for each update state, and, maybe that will be overloaded?
Also, sending the whole game state, even if it isn't being rendered, opens so many breaches to cheating that this made me think that there is another option.
I'm a beginner at Networking and Game Development, and that is being hard to get into my mind - so I decided to try and put it into a question. This way, maybe with someone reading what I'm thinking about, I might get some clarification. Perhaps I'm just thinking about it the wrong way.
Q: should I really update someone who isn't even being seen?
There is no need.
The normal way MMORPG games do in the server side is to cyclely process network packages and some other calculations like the connection of players like skill cast or something else.
The central of a server may look like below
void run()
{
while (true)
{
processNetwork();
processSkills();
processMoves();
...
}
}
The loop will run several times a second, like 20 frames a second is enough cause players can not feel the little frame, they think they move/play smoothly but the trueth is not.
For your question, player only need to see some little area, when he moves, the server will braodcast his postion to others in the area and the players in his area in the next frame.
And that is just the simpliest model, actual model will be more complicated and we will detach different functions of the game to different server, sucn as chat server, battle server, auction server and others.

The same GameObject accessible by two players in Unity Networking (UNT)

Anyone know, or have some ideas, how to have a GameObject in Unity3D Multiplayer (UNT) that is accessible for two player. What i want to do is to have an object that can be dragged from both players.
I have been looking at tutorials and read documentation but have not yet figured out how to solve this.
I used a simple workaround, I made three GOs (one that is being moved (main one), and two GOs that just receive informations from two players). When one player drags main GO on their screen their GO sends info to corresponding GO on other screen, it receives information and moves the main GO, same thing happens with another player. (I did this in Photon)
Most of the multiplayer engines don't support two way communication, so you have to create two one way communications to simulate one two way communication.

Flash game simple performance tricks

I'm trying to make some simple flash games but before I start purring mega bytes of data into the game it's better to seek wisdom from pro coders since I;m totally new to AS3.
1st Question is: what's the best way to load the game faster?
since bandwidth is limited like hell for me and loading a flash game takes some time I'm trying to make the game start as fast as possible and load the rest of materials in the gaming process.I saw this on lots of facebook games.
2nd: how to keep the RAM usage low?
do you advise to remove the loaded image/movie clip from the stage as soon as its out of the frame? does this lower the RAM usage? and if I load the removed object again does it use the loaded one or it start to download it from the source folder again?
3rd: whats the trick to load the materials into client PC?
I saw many facebook games that take some time to load for the first time but next day it loads like its data is stored on the Hard disk. do I have to do something or flash player does it automatically?
4th:Is there a way to load the images/movie clips into flash player while playing? I mean if the level of games are movie clips and player is playing first level the game continue to load next level and on then ad them to the stage as demanded by code.
Lead me with your experience please.
These tricks are not as simple, but yes, all of this is possible.
The "best" way to load the game faster is a fiction, you will anyway need at least the main game code to be loaded in order to play the game. If your levels are pretty huge, yes, you can load levels after actually loading the game. You can also load music the same way. For this, you will need a separate SWF or a set of URLs to get these from, and after your game fully loads (without sounds, levels or whatever you were capable of placing aside) you initiate an asynchronous load request (use Loader class for this) and after it completes, you'll be able to play either one sound, or one level, or total set of sounds or levels, depending on how do you organize your external asset storage.
The short answer is "reduce, reuse, recycle", that is, you'd better store big assets like a bitmap (an instance of BitmapData class) as a single object, and use references to display numerous copies of it throughout the game. You'd better use an object several times, say a bullet that flied once and expired, hit something, missed and left screen, etc, can be told "go back right here, here's your new parameters" and the object will not be wasted. Other tricks are also possible.
This is an automatic action of Flash player, or rather the browser, known as "local cache". If you request something off an URL, the request is passed to the browser, which, after downloading, stores a local copy for future reference. The storage is still limited, and also the copy can "expire" if it was stored for too long, which makes the browser re-download the URL content. Flash player uses browser's URL retrival, thus local caching applies to SWFs or other kind of data.
You can make levels into metadata, that is, you are downloading a set of different data via any means possible, then you parse that set, create the required MovieClip (or a Sprite) via code, stuff all the assets into it at intended positions and go with that. A metadata can be fairly large, and can be placed elsewhere as any other file you can share via Internet and download by an URL. Use Loader class to call for URLs and get data retrieved from the net, devise a way to properly store the metadata and a generator+parser to manage those levels as you design the game.
Hope this helps.

How the dynamics of a sports simulation game works?

I would like to create a baseball simulation game.
Are these sports management games based on luck? A management game entirely based on luck is not fair, but it cannot be too predictable either. How does the logic behind these games work?
It's all about probability and statistics. You set the chance of something happening based on some attributes you assign, and then the random factor comes in during play to make things less predictable and more fun. Generally you get a load of statistics from some external source, encode them into your game's database, and write a system that compares random numbers to these statistics to generate results that approximate the real-life observations that the stats were based on.
Oversimplified example: say your game has Babe Ruth who hits a home run 8.5% of the time, and some lesser guy who hits one 4% of the time. These are the attributes you test against. So for each pitch you simulate, pick a random number between 0 and 100%. If it's less than or equal to the attribute, the batter scores a home run, if it's greater than the attribute, they don't. After a few pitches you'll start to see Babe Ruth's quality show relative to the other guy as he will tend to hit over twice as many home runs.
In reality you'd have more than 1 attribute for this, depending on the kind of pitching for example. And the other player might get to choose which relief pitchers to use to try and exploit weaknesses in the batter's abilities. So the gameplay comes from the interplay between these various attributes, with you trying to maximise the chance that the attribute tests work in your favour.
PS. Apologies for any mistakes regarding baseball: I'm English so can't be expected to understand these things. ;)
As you have already figured out, the core component of such games is the match simulation engine. As Spence said so, you want that simulation to "look right" rather than to "be right".
I worked on a rugby game simulation some time ago and there's an approach that works quite well. Your match is a finite state machine. Each game phase is a state, has an outcome which translates to a phase transition or changes in game state (score, replacements, ...).
Add in a event/listener system to handle things that are not strictly related to the structure of the game you're simulating and you have a good structure (everytime something happens in your simulation, a foul for instance, fire an event; the listeners can be a comment-generation system or an AI responsible for teams' strategies).
You can start with a rough simulation engine that handles things at a team level using an average of your players' stats and then move on to something more detailed that's simulating things at a player level. I think that kind of iterative approach suits a game simulation very well because you want it to look right, and as soon as an element looks right you can stop iterating on it and work on another part of your system.
Random is of course part of the game because as you said so, you don't want games to be too predictable. A very simple thing to do is to have virtual dice rolls against a player and team statistics when they are performing a particular action (throwing the ball for instance).
Edit: I make the assumption that we're talking about management games like Hattrick, where you're managing a roster and simulating game results rather than 2D/3D graphical simulations.
Usually timing plus a randomness to make the game replayable EDIT To clarify I mean in terms of when the pitch comes at you, if it was exact you could learn to play it perfectly, you would need a small randomness around the exact time that you swing to make the game have some chance). AI has a big part in this if you do things like curve balls, add the ability to steal bases etc.
Getting games "right" isn't a factor of design or maths so much as a feel. You will try something, play it, and see if it was fun. If it isn't try different algorithms or gameplay until you get it right.
A simulation is very much about an imagined world in that you create classes that represent all aspects of an imagined world. You need to model the players, specify the game rules, and game dynamics.
http://cplus.about.com/b/2008/05/31/nathans-zombie-simulator-in-c.htm
Look here for agent based model: http://www.montemagno.com/projects.html
One great thing about creating your own game is that you get to decide how the game logic is going to work. If you want the game to have a high degree of luck you can design that in. If you don't want the game to have a high degree of luck then you can design it out.
It's your game, you get to make up the rules.
Are you talking about a baseball game you play or a game simulator? Baseball games can be arcade-like or fantasy sports like or a blend.
I was at Dynamix when Front Page Sports Baseball was made. It was stats-based, meaning that you could play out games and seasons using the stats of the various players. That meant licensing Major League data. It used stats to influence outcomes.
There was a regular mode and a "fast-sim" mode that could breeze through the games faster.
I think Kylotan has the right strategy. Baseball has stats for everything. Simulate a game to the most detailed level you can manage. Combine player stats to determine a percentage chance for every outcome. Use randomness to decide the outcome.
For instance: The chance of a hit is based on Batting Average, Pitcher's ERA, etc. The opposing team's feilding percent determines the chance an out becomes an error.
Every stat you display to the 'manager' when selecting lineups should have some effect on gameplay - otherwise the manager is making decisions based on misleading information.
you ought to check out franchise ball. there is a browsable demo.
http://promo.franchiseball.com