Jump to content

Recommended Posts

Hunt prehistoric creatures with your friends online. Build your own base, craft tools, and weapons to survive in a large-scale true cross-platform open world game.

This game is an application of the engine I’ve built, to prove a statement: It is POSSIBLE to build a 3D version of the Internet, where instead of browsing through websites, we could jump from one 3D space to the next. I “invite” everyone to make this happen. I want you guys to build your own 3D spaces implementing your own ideas what the web should look like in the future. We could just link them all together and make this Interconnected Virtual Space happen - yeah, the Metaverse, for the Snow Crash fans out there ;)

Tech Details that I hope provokes further questions:

  • Loading Assets on Demand is even more important in the Browser than on PC or Console.
    Internet speed is only a fraction of the speed of the hard drive. It is essential to only load whats visible if you want to provide an open world environment for users visiting your world the first time. 
  • LOD - Level of Details allows Web Browsers to show something immediately for the users just like an ordinary website. It may look poor and users can see the object improving as they are loaded, still, I think its a good trade-off. Users get a good enough view of their environment instantly and can start interacting with it immediately.
  • Terrain and the Grid System
    I’ve created the terrain in Blender, then I split it up like a chessboard automatically using Javascript. It is easy/cheap to determine that which cell contains the given coordinate and every single cell in the Grid has a reference to its neighbors. This is the basis of server layers of optimization when it comes to rendering, AI, and collision detection, etc. A recursive search is very easy to do, using those links to neighboring cells.
  • Lighting
    I've implanted basic Directional and Ambient Lighting to support Day & Night Cycles and Point Lighting for individual light sources like a campfire, torch etc. To my surprise, the difficult part was to get good looking flames, thanks to the lack of Alpha Sorting in WebGL, what I had to implement in Javascript instead.
  • Animation
    I animate my models in Blender, export them to “.dae". The file format comes with a serious limitation, you can’t define multiple animations and it only maintains a list of keyframes as references. So I maintain a JSON file per “.dae” to define multiple animations by having sets of keyframes. E.g.: “{running: [0, 4], jump: [5,7], ..}”. But I kept it simple and didn’t take it to the realm of animations per body part.
  • Physics
    In short, I was stupid enough to write my own :) ..on the other hand, I have a fine level of control over how much I allow it to run. Again, on mobile, it is crucial to have that level of control to navigate 200+ creatures in real-time. I have two different type of Collision Detection. Collision with the Terrain and collision with other model surfaces. Terrain collision is very cheap, this allows me to move so many NPC at once. Collision with other models is heavier though, but that allows me to climb random looking rocks. I optimized it enough to make it feasible to run on mobile devices. I use a low poly version of the models to determine the collision and I only run it for the models near the Player, utilizing the Grid System I mentioned above.
  • AI
    NPCs can navigate a random terrain, avoid obstacles and “see” and “hear” other NPCs if behind them. At the moment, they move rather robotically, but this allows me to calculate, where they can move next without hitting any obstacles and how long it will take to get there. I only run the AI right before they get to the target location. Basically, 200+ NPCs make only 40-100 AI calls per second. ..I certainly have room for improvement here :)
  • Multithreading in the browser is difficult but necessary to achieve good Frame Rate. Nothing but the rendering should be on the main thread ideally - Good luck to achieve it though :) I’ve managed to push most of the heavy logic into a speared thread, but AI is still running on the main one. In a thread you have very limited access to important functionalities of the browser, therefore, there is only so much you can do. Also, specific objects can only be passed by reference between threads, everything else has to be serialized on one end and deserialized on the other. You want to be careful how often you do it.
  • Audio
    I use the Web Audio API that works as expected. On top of that, I implemented Audio Sprites: I compile all related sounds to a single mp3 file and that comes with a JSON object to define where certain audio snippets can be found. It's a fast, accurate and reliable solution unlike using Audio HTML Tag, but that one has its own use cases as well, e.g.: streaming an mp3 file comes for free, like streaming an internet radio station.
  • Multiplayer - I use WebRTC and not WebSockets - I know, I know, hear me out. The idea was that COOP is a very likely scenario and players may only prefer the company of their friends. I that case, they don’t have to purchase access to a private server, as long as they are happy to let their world go dormant between gaming sessions. Plus, all the logic is implemented for single player mode on the client-side, which logic has to be duplicated on the servers, if I went down the WebSockets rout - just think about where the AI logic should be, server- or client side. I expect this one to be a controversial decision, ..sometimes even I'm not sure whether this was the “right" decision :) There is a whole lot more to this though. Resources could be distributed between players when it comes to AI to ease the load on the Host - I know it is a potential security issue, but there is a use case for it, like AI for distant NPCs in COOP as long as you have no hacker friends ;) ..this could be crucial on mobile devices.
  • Controller Support
    The Gamepad API provides you with raw access to every button and joystick. You certainly have to implement your own layer on top of that. Events for pressing/holding down buttons don't come out of the box. Implementation of the dead zone of joysticks is missing and it is inconsistent how you can access different types of controllers through the API, even the same controller but on different devices. In the end, you will have to provide a controller mapping implementation as well in your settings. But its totally doable and works like a charm.
  • Touchscreen Support
    It's a tricky one. As I mentioned above, on iPhones its completely useless till Apple decides to comply with Web Standards. Even on Android, it is a bit tricky: For the UI you probably want to use HTML. It makes sense because it comes with all the neat features that make our lives easier until you realize that you can’t switch between weapons while running - wait, what? You see, while you are holding down the left side of the screen to maintain speed and try to click on a button, or any HTML element to switch weapons, the click event won’t fire. No click event will be fired while doing multi-touching. As a result, HTML and any fancy framework for that matter are no longer good enough solution own their own. 
  • UI
    When it comes to games we expect a whole lot more from the UI than on a website. Multi-touch support - as discussed above and even controller support is not as straightforward as you might think. You have raw access to the controller, so when a button is selected and the user pushes the joystick diagonally upward, you have no idea what is in that direction, therefore what should be selected next. You have to implement the navigation of your UI with a controller for yourself. And you need controller support because that's the only way to move around in VR and on consoles. Speaking of VR, you want to render your UI twice in VR - once for the right eye and once for the left eye - and only once when not in VR, just something to keep in mind :) Also, rendering the UI could be heavy. This might be a surprise but if you think about it, on a website you don’t do anything but the UI, so you have a lot mere leeway to work with, whereas in a game you don’t want the UI to impact the Frame Rate, so it has to be very lightweight and probably you want Scheduling to have a final say on what gets refreshed. Taking all this into account, I really don’t see how any framework could be a good option - they were simply designed with different requirements in mind and there is more downside to using any of them than upside.
  • Precomputed Scene Occlusion Culling using a Grid System
    Most of the optimization is happening real-time or triggered on a regular basis while running the game with one exception: I render every cell in the Grid System from the point of view of every single other Cell. E.g.: Cell A can see cell B and C but not D. I literally diff two images with javascript to determine whether the given cube can be seen or not. Then I record the results in a JSON file, which is used for rendering. This reduces the number of cubes to be rendered significantly, but it takes about 40 hours to run this optimization for the whole terrain.
  • Running the game on Mobile Devices
    iPhone runs WebGL significantly better than top-end Android devices but practically useless because Apple ignores important web standards. E.g.: Pinch zoom can’t be blocked, therefore when you use your left thumb to move around and right thumb to look around, instead of doing so you end up zooming back and forth the screen. It also doesn't support fullscreen mode - video does, but not the canvas element. Another interesting limitation on iPhone is that you can only have 25 elements in an array in GLSL, which translates to having only 25 bones in an animated model. This doesn't make animation impossible, but you can’t use most animated models that you buy in the stores, you have to do it again with only 25 bones.
  • Profiling
    “What gets measured, gets managed”. The built-in profiler in Chrome certainly has its use-case, but not good enough for what we want, so probably you will have to build your own at some point with specific features. You want to know how long a certain section of your game runs per frame, e.g.: Rendering, AI, Physics, etc. and probably these sections won’t run sequentially, but they are interrupted by other processes that you don’t want to include into the specific measurement. One thing is for sure, you cant do optimization without identifying the source of the lags. - I've certainly wasted enough time trying ;)
  • Scheduling
    As long as you are pushing the limits of the devices it is always a battle for a smooth frame rate. Therefore, you have to implement a scheduling system to manage what is allowed to run and for how long. E.g.: whatever is loaded and processed in the background will have an effect on the frame rate even if it is running on a different thread, you want to throttle that. You don’t want to set variables through WebGL API unnecessarily. AI always varies how much calculations it has to do depending on the number of unique encounters of 200+ NPCs in a random environment. Basically, you will have to limit what runs and how long, manage what is a nice to have calculation and a game-breaking one and try to make it seamless for the user. 

Probably every single topic above deserves a dedicated post, so please feel free to ask anything - there is no stupid question - then I would like to use those questions to write an in-depth post on every single topic that helps fellow devs to overcome similar obstacles - no doubt I will learn a thing or two in the process :)

Live Tech Demo is available on https://plainsofvr.com

landscape-00.jpg

landscape-01.jpg

Link to comment
Share on other sites

I played your game for 15 minutes and got some feedback for ya. I am a developer just like you but for the sake of reality I will provide feedback as a player, a casual one. I am, slightly disappointed.. For a game called 'Age of Reptiles' I don't see many reptiles, although the screenshots clearly show dinosaurs, I wandered for 15 minutes without spotting a single piece of life. Speaking of which, my movement jitters, the textures are at points too stretched or buggy, lots of cyan squares around the ocean. I hear jungle noises while I am clearly not in one and not to mention all the flying vertices that are not being buffered properly. I can see you are really motivated about this and I definitely am not here to take that away from you, but as a developer I need to be honest and keep this clear and straight by saying this needs lots and lots of work, way too many visible bugs and non-visible bugs you could spot the instant you launch the game. Remember though, gameplay is as important as graphics, but I recommend fixing non-graphical bugs first before you move on to the graphics since they affect more of the game. Also, I'd recommend keeping your forum post's content non-technical and short. I have not read all you wrote and probably no one will, so in the end you wasted your time on that, which is a shame.

As for the graphics, well, like I said, there are a lot of graphical bugs. But that being said, I do like the models. Low graphic quality is not necessarily bad or outdated, it fits computers which are a bit older. My laptop is not that old but it can run Skyrim just barely, so that being said, games with lower graphics quality are more than welcome. The only thing I do not like are the trees, I'd suggest using more random ones as well as more branches/leaves. I know the game could become terrific slow if you add too many, but perhaps using a different model or graphics style could solve that for the entire game. Cartoon graphics for example can be perfectly low poly and good looking.

Link to comment
Share on other sites

Whoops I got killed by a Raptor. I see that it is pre-alpha and some trees are just too big to fell them with your hands normally, but the world is cool. It has some modern retro (I mean.. like 2007 mc..) feel. I'm not sure I like being eaten by dinosaurs, but I guess I wanted just to help the big helpless saur and it was my fate.

About the trees... is it actually possible to get them not blurry but pixelated from near distance? Some of the blur would be the only thing that I don't like as retro effect, pixels and voxels look just nicer to me.

Cool game!!

(Interesting what you mention about WebRTC. I wonder if I myself could get any p2p to work between two mobile devices being behind a shared IP in t-mobile, which I use, and what the library for the hole punching would be. I have no idea how to approach anything except Websockets. So, the main point in WebRTC for you is saving traffic costs? I thought it can also be UDP (is it?) and could work snappier or something.

Among other things you ask yourself where the AI should be. I personally think, at first, just where the (solo) developer wants it. I'm going to build my hobby games as if everyone on earth was a happy player that just wants fun. Probably you can cheat a lot in it but the cheating mitigation never stops. I really think ... it's ok whatever it is.)

Link to comment
Share on other sites

9 hours ago, TheBoneJarmer said:

I played your game for 15 minutes and got some feedback for ya. I am a developer just like you but for the sake of reality I will provide feedback as a player, a casual one. I am, slightly disappointed.. For a game called 'Age of Reptiles' I don't see many reptiles, although the screenshots clearly show dinosaurs, I wandered for 15 minutes without spotting a single piece of life. Speaking of which, my movement jitters, the textures are at points too stretched or buggy, lots of cyan squares around the ocean. I hear jungle noises while I am clearly not in one and not to mention all the flying vertices that are not being buffered properly. I can see you are really motivated about this and I definitely am not here to take that away from you, but as a developer I need to be honest and keep this clear and straight by saying this needs lots and lots of work, way too many visible bugs and non-visible bugs you could spot the instant you launch the game. Remember though, gameplay is as important as graphics, but I recommend fixing non-graphical bugs first before you move on to the graphics since they affect more of the game. Also, I'd recommend keeping your forum post's content non-technical and short. I have not read all you wrote and probably no one will, so in the end you wasted your time on that, which is a shame.

As for the graphics, well, like I said, there are a lot of graphical bugs. But that being said, I do like the models. Low graphic quality is not necessarily bad or outdated, it fits computers which are a bit older. My laptop is not that old but it can run Skyrim just barely, so that being said, games with lower graphics quality are more than welcome. The only thing I do not like are the trees, I'd suggest using more random ones as well as more branches/leaves. I know the game could become terrific slow if you add too many, but perhaps using a different model or graphics style could solve that for the entire game. Cartoon graphics for example can be perfectly low poly and good looking.

Thanks TheBoneJarmer for taking the time, and for the feedback! I haven't seen the console log, but it sounds like the game stopped loading for some reason. That's why you haven't encountered any dinos and keep hearing the jungle. I've seen this happening once but I never encountered myself, so didn't get a chance to fix it. Please try to refresh, I know I know, you are a dev as well so you might have tried this already :)
And thanks for the insight on trees,  I will try to improve my models in terms of style and poly count.

Please don't hesitate to message me if anything new comes to mind if you gave the game a second chance later on. 

Link to comment
Share on other sites

5 hours ago, losthope said:

Whoops I got killed by a Raptor. I see that it is pre-alpha and some trees are just too big to fell them with your hands normally, but the world is cool. It has some modern retro (I mean.. like 2007 mc..) feel. I'm not sure I like being eaten by dinosaurs, but I guess I wanted just to help the big helpless saur and it was my fate.

About the trees... is it actually possible to get them not blurry but pixelated from near distance? Some of the blur would be the only thing that I don't like as retro effect, pixels and voxels look just nicer to me.

Cool game!!

(Interesting what you mention about WebRTC. I wonder if I myself could get any p2p to work between two mobile devices being behind a shared IP in t-mobile, which I use, and what the library for the hole punching would be. I have no idea how to approach anything except Websockets. So, the main point in WebRTC for you is saving traffic costs? I thought it can also be UDP (is it?) and could work snappier or something.

Among other things you ask yourself where the AI should be. I personally think, at first, just where the (solo) developer wants it. I'm going to build my hobby games as if everyone on earth was a happy player that just wants fun. Probably you can cheat a lot in it but the cheating mitigation never stops. I really think ... it's ok whatever it is.)

Hey losthope, I see you had some fun with the raptors :) 

You are the second person - out of two - who mentioned the trees. I'm starting to doubt that the CDN is doing a good job sending off the high-quality models fast enough...

I don't see any reason why p2p WebRTC connection wouldn't work behind shared IP. If you are interested to just mess around with WebRTC to figure out whether it's for you or not, I would recommend PeerJS as a start because establishing a connection between two people is a nightmare if you want to do it yourself. PeerJS have live demos as well so you can try the shared IP issue without committing yourself.

Please don't have second thoughts about contacting me if you have any other questions, and let me know if your hobby game is available for a spin :)

Link to comment
Share on other sites

On 7/9/2018 at 5:08 AM, Krisztian Varga said:

Hey losthope, I see you had some fun with the raptors :) 

You are the second person - out of two - who mentioned the trees. I'm starting to doubt that the CDN is doing a good job sending off the high-quality models fast enough...

I don't see any reason why p2p WebRTC connection wouldn't work behind shared IP. If you are interested to just mess around with WebRTC to figure out whether it's for you or not, I would recommend PeerJS as a start because establishing a connection between two people is a nightmare if you want to do it yourself. PeerJS have live demos as well so you can try the shared IP issue without committing yourself.

Please don't have second thoughts about contacting me if you have any other questions, and let me know if your hobby game is available for a spin :)

Oh, the textures are loaded in time? Maybe something didn't work, or maybe I was too picky.

Thanks for the PeerJS advice.

What's your AoR roadmap? (would be my question) Oh and.. can it be third person, more like "little things"? When I think about AoR (age of reptiles),  I feel reminded that I liked the look of Dragon Quest Builder. Not just the polishing, ... the 'non-first-person'. Irrelevant, just some thoughts.

My hobby game is rubies.live, I hope I get it to look like Turrican or Cdogs... I mean.. it should offer something. Could be fun.

Kind regards...

Link to comment
Share on other sites

23 hours ago, losthope said:

Oh, the textures are loaded in time? Maybe something didn't work, or maybe I was too picky.

Thanks for the PeerJS advice.

What's your AoR roadmap? (would be my question) Oh and.. can it be third person, more like "little things"? When I think about AoR (age of reptiles),  I feel reminded that I liked the look of Dragon Quest Builder. Not just the polishing, ... the 'non-first-person'. Irrelevant, just some thoughts.

My hobby game is rubies.live, I hope I get it to look like Turrican or Cdogs... I mean.. it should offer something. Could be fun.

Kind regards...

"Oh, the textures are loaded in time? Maybe something didn't work, or maybe I was too picky."

Everything is loaded in time :) I have two level of LOD. First one looks very low-poly when it comes to rocks and trees are almost like cardboard cutouts. Then the high-poly version will replace the low-poly models. There is a loading icon on the top right corner, which disappears when it's done loading.

"What's your AoR roadmap?"

Well, the basic survival aspects are working like chopping trees, fighting dinos, gathering meat from them, cooking meat on the fire, and crafting tools and your own base. As soon as I get rid of the bugs I go to beta. Then I will see what players want from me, what features they want me to push forward.
But I think about the game as a necessary first step towards 3D Internet as a platform. I would like other devs to design services on top. Like selling 3D models directly to the players to customize your base. In a sense, it will be more like Second Live in the end.

"Oh and.. can it be third person, more like "little things"? When I think about AoR (age of reptiles),  I feel reminded that I liked the look of Dragon Quest Builder. Not just the polishing, ... the 'non-first-person'. Irrelevant, just some thoughts."

Absolutely, the first-person view was a tactical decision until I develope the character customization. If you try multiplayer now, everybody looks the same :)

"My hobby game is rubies.live, I hope I get it to look like Turrican or Cdogs... I mean.. it should offer something. Could be fun."

Man, it's a solid shooter, I like it. The maze part is a bit like Packman but a unique take on it. Have you thought about purchasing graphic designs for different levels? I have purchased almost all the models for AoR on https://www.cgtrader.com/. I'm sure there is something similar for 2D designs.
I've tried it on my phone, works just fine! If you could add a fullscreen option that would be amazing. And just one more thing, when I hold my phone in my hand I use it in landscape mode. For me at least, to have navigation controls on the two sides of the screen would work better. And maybe automatic speed up, and one button to "break". Anyways, it's a fun game, I would love to play it on the go, that's all :)

I would love to hear your opinion on one concept - maybe I should post this on the forum as a separate question: Having links in these game to other games. Hear me I out, I really want the internet to be more than just websites. How cool that would be if you could just walk/fly through a portal and end up in a different game, and just go back through the same portal if you don't like it. It would be the next version of the "link" on websites. We could literally travel through the Internet. I think about this a lot, how to turn it into an adventure and not just promotion for other games. What do you think??

Link to comment
Share on other sites

15 hours ago, Krisztian Varga said:

If you could add a fullscreen option that would be amazing. And just one more thing, when I hold my phone in my hand I use it in landscape mode. For me at least, to have navigation controls on the two sides of the screen would work better. And maybe automatic speed up, and one button to "break". Anyways, it's a fun game, I would love to play it on the go, that's all :)

Thanks! If by fullscreen you mean it allows to hide the address bar (swipe up) in chrome on android, this is fixed now. Landscape mode buttons on two sides: Did that too, but I'm too clumsy to know where the ideal button positions would be for the thumbs. Automatic speed up, hmm, this would need some conditions maybe. "break": kind of done, there's a pause button now that also sets the speed to zero. You can write it in the rubies.live thread if you'd like to keep things AoR-related here.

15 hours ago, Krisztian Varga said:

I would love to hear your opinion on one concept - maybe I should post this on the forum as a separate question: Having links in these game to other games. Hear me I out, I really want the internet to be more than just websites. How cool that would be if you could just walk/fly through a portal and end up in a different game, and just go back through the same portal if you don't like it. It would be the next version of the "link" on websites. We could literally travel through the Internet. I think about this a lot, how to turn it into an adventure and not just promotion for other games. What do you think??

This is a good idea. Would the link be like plainsofvr.com?map_position_x=12345&map_position_y=12345, or plainsofvr.com?planet=123 or only plainsofvr.com? Maybe ... you should write how you think it would be done the best way. I'm a bad designer in some situations. Sometimes I prefer dead simple things that other people don't like. :unsure::)

Link to comment
Share on other sites

8 hours ago, losthope said:

This is a good idea. Would the link be like plainsofvr.com?map_position_x=12345&map_position_y=12345, or plainsofvr.com?planet=123 or only plainsofvr.com? Maybe ... you should write how you think it would be done the best way. I'm a bad designer in some situations. Sometimes I prefer dead simple things that other people don't like. :unsure::)

 

Anything would work, it would be literally a link. In AoR if you click on the invite icon - top right corner of the screen, mans head with the plus sign - you get this: d130m9ehg655ah.cloudfront.net/index.html#host=7760&location=801.4,9.2,533&rotation=9.2,273.2,0. This a link to a COOP session but I'm working on Official Servers at the moment, then this link could be pointing to a permanent server as well.

One main difference between a link and a portal would be that a portal is a two-way link, meaning you can go back to where you come from through the same portal.

We could also gamify the functionality. E.g.: put the portal on top of a hill at a bottom of a dungeon as part of the reward system.

I think it should be up to the Game Designer what the portal looks like, so It would match the style of the game.

What do you say, shall we give it a go? I could make a portal to your game once I'm done with the Official Server :)

Link to comment
Share on other sites

I'm not yet really sure if I can get my part good enough, but I want to try it. Here's what I came up with:

I think there should be an opaque part ("session", other game knows about internals) and, on the other hand, a transparent part with "shared" variables.

"session" means a portal session for linking two places together. So there can be several sessions. The reason is that I cannot really choose meaningful coordinates, and the coordinate range/validity could change or something could be added. So all things should be packed in a session that is opaque to my game, and your game gets nil and decides how to start the new place. That way, one portal (planet in rubies.live) always links to the same place in plainsofvr.com, but it's up to plainsofvr.com what the coordinates and internals are.

A field "similar" would indicate which variables are actually the same thing, but named differently in the games.

For example when a shuttle in rubies.live lands on a green planet, this would be a portal, and the game would do this:

let linking_data = '

"sender":
{
	"session": "abc123", // here: rubies.live session

	"shared":
	{
		"shield": 123,
		"laser": 234,
		"cash": 345
	}

	"similar": // sender thinks, vars are similar
	{
		"Energy": "shield"
	}
},

"receiver":
{
	"session": nil, // receiver (here: plainsofvr.com) will fill it

	"shared":
	{ 
		"Energy": nil,
		"Stone Picks": nil,
		"Trees felled": nil
	}
}';

Then it creates a form with action = "plainsofvr.com?game_linking.php", method = "post" (because "get" can get repeated and changed), and submits it.

The plainsofvr.com server has to set the Access-Control-Allow-Origin header to get the response through the cross site checking.

The page changes from rubies.live to the plainsofvr.com game.

When plainsofvr.com finds that "shield" is indeed "Energy" in plainsofvr.com, it uses 123, otherwise it uses it's own value. Since it is nil, it has to decide itself.

"session" in receiver is nil, that means plainsofvr.com should pick the state (coordinates, etc) it thinks are ok at first. 

Later, when the player wants to go back to the game he came from, "session" is set accordingly (to "abc123", nil if nil was received).

The (my) game stores the session per portal (e.g. planet.plainsofvrsession = plainsofvrsession), and it uses a global plainsofvr_vars to store the (inventary) variables, so they won't be different from planet to planet.

P.S: Two things I forgot to say:

1) My game (both games) would expect to get the variables sent back, meaning, your game keeps "shared" (with shield, laser, cash) and returns the values back. Each variable should be sent back the same value as it was received, because sending back new values should be handled via  "similar". E.g. your game thinks the shuttle got rammed by a dinosaur and lost shield, then your game would still send back 123 as received, but add "-50" "Shuttle Damage" and create a entry in "similar" ("shield": "Shuttle Damage" for the relative value, or maybe "shield": "New Shield Value" for the absolute value) so that my game can decide that this value should be consirered at the appropriate place.

One of the reasons is, our region is crazy on data protection now. I'm not yet (and probably will not) store sessions, ask for cookies consent. So, when your game sends back variables, this would be "temporary storage support" so to say. On the other hand, had I only a session, then I would have to start asking players for cookies (or login, server storage) consent.

2) When variables in "shared" are nil, they can actually be left out. There's probably no need to waste the space.

Link to comment
Share on other sites

8 hours ago, losthope said:

I'm not yet really sure if I can get my part good enough, but I want to try it. Here's what I came up with:

I think there should be an opaque part ("session", other game knows about internals) and, on the other hand, a transparent part with "shared" variables.

"session" means a portal session for linking two places together. So there can be several sessions. The reason is that I cannot really choose meaningful coordinates, and the coordinate range/validity could change or something could be added. So all things should be packed in a session that is opaque to my game, and your game gets nil and decides how to start the new place. That way, one portal (planet in rubies.live) always links to the same place in plainsofvr.com, but it's up to plainsofvr.com what the coordinates and internals are.

A field "similar" would indicate which variables are actually the same thing, but named differently in the games.

For example when a shuttle in rubies.live lands on a green planet, this would be a portal, and the game would do this:


let linking_data = '

"sender":
{
	"session": "abc123", // here: rubies.live session

	"shared":
	{
		"shield": 123,
		"laser": 234,
		"cash": 345
	}

	"similar": // sender thinks, vars are similar
	{
		"Energy": "shield"
	}
},

"receiver":
{
	"session": nil, // receiver (here: plainsofvr.com) will fill it

	"shared":
	{ 
		"Energy": nil,
		"Stone Picks": nil,
		"Trees felled": nil
	}
}';

Then it creates a form with action = "plainsofvr.com?game_linking.php", method = "post" (because "get" can get repeated and changed), and submits it.

The plainsofvr.com server has to set the Access-Control-Allow-Origin header to get the response through the cross site checking.

The page changes from rubies.live to the plainsofvr.com game.

When plainsofvr.com finds that "shield" is indeed "Energy" in plainsofvr.com, it uses 123, otherwise it uses it's own value. Since it is nil, it has to decide itself.

"session" in receiver is nil, that means plainsofvr.com should pick the state (coordinates, etc) it thinks are ok at first. 

Later, when the player wants to go back to the game he came from, "session" is set accordingly (to "abc123", nil if nil was received).

The (my) game stores the session per portal (e.g. planet.plainsofvrsession = plainsofvrsession), and it uses a global plainsofvr_vars to store the (inventary) variables, so they won't be different from planet to planet.

P.S: Two things I forgot to say:

1) My game (both games) would expect to get the variables sent back, meaning, your game keeps "shared" (with shield, laser, cash) and returns the values back. Each variable should be sent back the same value as it was received, because sending back new values should be handled via  "similar". E.g. your game thinks the shuttle got rammed by a dinosaur and lost shield, then your game would still send back 123 as received, but add "-50" "Shuttle Damage" and create a entry in "similar" ("shield": "Shuttle Damage" for the relative value, or maybe "shield": "New Shield Value" for the absolute value) so that my game can decide that this value should be consirered at the appropriate place.

One of the reasons is, our region is crazy on data protection now. I'm not yet (and probably will not) store sessions, ask for cookies consent. So, when your game sends back variables, this would be "temporary storage support" so to say. On the other hand, had I only a session, then I would have to start asking players for cookies (or login, server storage) consent.

2) When variables in "shared" are nil, they can actually be left out. There's probably no need to waste the space.

12

Well, I would lie if I said I understand every detail of the internals of your game, but you've raised a lot of good questions.

I have a link like this to a location in AoR: d130m9ehg655ah.cloudfront.net/index.html#host=7760&location=801.4,9.2,533&rotation=9.2,273.2,0
Whether you visit me the first time or you've been there before you will always shop up at the location defined in the link "location=801.4,9.2,533".
Whether that location is valid or not is up to AoR to evaluate :)

I thought I would keep it simple and don't receive or send the state of the AoR to another game, I would let the other game work out what to do with me when I show up in that world coming from AoR. This would allow me to use a simple link, with get parameters only. When someone returns to AoR, AoR recovers its state that is stored in IndexedDB in the browser, much like cookies, so AoR will work without the other game storing anything about AoR session.

I think it's important to keep thing simple in order to help the idea to spread, and also easy to manage in the long run. Plus any website could link to a location in AoR at the moment, which is very useful for sending people to different parts of the game world. E.g.: when there is a community on one of the AoR servers, they could have a base, and that base would have a simple link. That community can put that link on their forum, website, Discord etc.. it is compatible with current web standards. 

Let me know what you think and if there is anything that would make it incompatible with rubies.live. I'm sure we can pull this off in no time :)

Link to comment
Share on other sites

I think I understand. You want the portal system be at the same time an invitation system. Both ideas combined.

Recovering the game state from the browser local storage is actually good an no personal data protection problem. I don't really need that ping-pong-persistence I wrote about. So let's forget my text.

My (now invalid) concern with method=get was, that going through a portal is something that one player does at one time, and therefore a link that gets seen in the address bar and revisited would be a confusing thing when developing. But when that revisiting the link is on purpose, then it must be a link with get parameters, yes.

The locations are meant to be a different issue, ok. But I still don't know how to create two distinct (and valid) locations. How big is the map? How many hosts are there? I guess, there should still be a way that my game asks your game for a new and distinct location, when the player has found a new (and distinct, different from other portals) portal in my game. E.g. it looks doable to me to say there are about maximum 50 (or whatever you think ) portals (maybe planets in rubies) that the average player will go through, so rubies should be able to request plainsofvr.com/index.html#seed=x and seed should be in the range 0..49. When the player goes through the portal, rubies will do location.href = plainsofvr.com/index#seed=0..49, e.g. index.html#seed=15, and AoR makes a proper location (#host=1234&location=578,901) out of it and redirects to that on its own.

And there is still another little problem. I'm tempted to take planets as portals, because landing on a planet and then helping dinosaurs makes sense. But then it's an unbalanced thing overall. When there are 50 portals in rubies, there would have to be 50 AoR maps (planets) that have each only one portal (one space shuttle). So I guess "meaningful" portals are actually bad. The portals should just be generic "ring things" or whatever so that it can be balanced overall. It would also be necessary to look how much time is spend in each game, to get some balance between the games. So, when there is roughly the same amount of portals in each game (because the player should be able to go back through it), then the time needed for the way inside rubies from one portal to another should be the same as in AoR.

Link to comment
Share on other sites

On 7/13/2018 at 1:18 PM, losthope said:

I think I understand. You want the portal system be at the same time an invitation system. Both ideas combined.

Recovering the game state from the browser local storage is actually good an no personal data protection problem. I don't really need that ping-pong-persistence I wrote about. So let's forget my text.

My (now invalid) concern with method=get was, that going through a portal is something that one player does at one time, and therefore a link that gets seen in the address bar and revisited would be a confusing thing when developing. But when that revisiting the link is on purpose, then it must be a link with get parameters, yes.

The locations are meant to be a different issue, ok. But I still don't know how to create two distinct (and valid) locations. How big is the map? How many hosts are there? I guess, there should still be a way that my game asks your game for a new and distinct location, when the player has found a new (and distinct, different from other portals) portal in my game. E.g. it looks doable to me to say there are about maximum 50 (or whatever you think ) portals (maybe planets in rubies) that the average player will go through, so rubies should be able to request plainsofvr.com/index.html#seed=x and seed should be in the range 0..49. When the player goes through the portal, rubies will do location.href = plainsofvr.com/index#seed=0..49, e.g. index.html#seed=15, and AoR makes a proper location (#host=1234&location=578,901) out of it and redirects to that on its own.

And there is still another little problem. I'm tempted to take planets as portals, because landing on a planet and then helping dinosaurs makes sense. But then it's an unbalanced thing overall. When there are 50 portals in rubies, there would have to be 50 AoR maps (planets) that have each only one portal (one space shuttle). So I guess "meaningful" portals are actually bad. The portals should just be generic "ring things" or whatever so that it can be balanced overall. It would also be necessary to look how much time is spend in each game, to get some balance between the games. So, when there is roughly the same amount of portals in each game (because the player should be able to go back through it), then the time needed for the way inside rubies from one portal to another should be the same as in AoR.

I will create two AoR world and a portal between them and message you the details. I think it will be much easier to show you what I mean than accurately explaining it :)

Link to comment
Share on other sites

Hey - Got a few questions about this.

1. How big is the game world? How big can the game world get?
2. You mention a grid system. Can you go into detail about this? I am guessing that it is similar to the one that Bethesda Softworks uses in the creation kit.
3. In regards to rendering why don't you use an existing engine such as bablyon.JS?

Link to comment
Share on other sites

8 hours ago, HeadClot said:

Hey - Got a few questions about this.

1. How big is the game world? How big can the game world get?
2. You mention a grid system. Can you go into detail about this? I am guessing that it is similar to the one that Bethesda Softworks uses in the creation kit.
3. In regards to rendering why don't you use an existing engine such as bablyon.JS?

Hey HeadClot, I'm more than happy to address those questions: 

1. How big is the game world? How big can the game world get? 
Its 16km2 - 4km by 4km - at the moment but there is no limit how big it can get thanks to Recursive Search Grid System. I’ll address this below.

2. You mention a grid system. Can you go into detail about this? I am guessing that it is similar to the one that Bethesda Softworks uses in the creation kit.
I’ve never used creation kit, but I’ve heard about this technique a few times from different sources so its safe to assume that its a common technique - no credit there for me ?

The terrain is created with Blender, exported as .obj. The engine imports it in editor mode, split is with the resolution I choose. Then I end up with a lot of smaller terrain pieces saved as JSON files - I’ll refer to them as Cells from now on. Cells contain mesh data and other preprocessed info that makes rendering and Recursive Search faster.

Resolution of the Grid: Cells are loaded on demand. When a Player shows up somewhere in the Grid, the first Cell has to load really fast otherwise the Player just looking at a blank screen. Therefore the Cell has to be small enough to be loaded fast enough. But if we make the Cells too small, it's very fast to load but slow to process. Javascript is fast to iterate over a lot of Cells but not nearly as fast as C for example. In the end, its a balancing exercise, and I ended up with 32 by 32.

Recursive Search: Finding a Cell as fast as possible is crucial, the cost could grow exponentially when multiple processes involve searching for Cells. Therefore we don’t want to iterate over all of them, but keep track of the Cell that the Player/NPC is standing on and use that as a starting point. Then we can do a Recursive Search looking at the neighboring Cells and their neighbors. In order to speed up the process, we save the links to the neighboring Cells on every single Cell. I’ve done more optimization of Recursive Search because of extensive use but you might not be interested in that, let me know if you do.

Loading Cells on Demand: the first Cell and the ones around the player loaded as soon as the game starts. When the player starts moving around in the Open World environment mere Cells are loaded when they get in range. Cells drive the loading of every other asset. When a Cell gets processed, the engine collects the other assets - like trees, rock, etc.. - to put them on the loading queue. So we really only load the assets we need and no more, and we load them in a sorted order. Whatever asset is closest to the Player gets loaded first just like Cells.

Dynamically Generated Assets: Grass and clutter use the Grid System as well. The engine only generates dynamic assets for the loaded Cells. They are generated in a different thread to keep the rendering thread smooth and they are not saved in any shape or form.

NPC and AI: NPC needs to be aware of their environment to navigate obstacles and find their prey. Same problem here, we don’t want to iterate over all the NPC we use Recursive Search and Grid System to reduce the number of NPCs to be checked out.

Precomputed Scene Occlusion Culling using a Grid System: Most of the optimization is happening real-time or triggered on a regular basis while running the game with one exception: the Engine keeps an optimized list of all visible Cells recorded on every single Cell in the Grid. This Optimisation is done in the Editor once the terrain is split:
The Engine goes over every single Cell in the Grid and renders them from the point of view of a specific Cell, pick randomly. A Cell is either visible or occluded by some obstacle or just out of range, by looking at it from the randomly picked Cell. The Engine records the visible ones and moves on to the next Cell to do the same occlusion checking. This reduces the number of Cells to be rendered significantly, but it takes about 40 hours to run this optimization for the whole terrain.

Possible Improvements: The Engine only uses one resolution to create the Grid. I can see why multiple resolutions could make the engine run faster. Small Cell means less waste. We may only see a fraction of the Cell still precess the everything in it. The engine could use a small resolution to work out what Cell needs to be checked out then a higher resolution could work only with those few Cells to work out the labor-intensive details.

3. In regards to rendering why don't you use an existing engine such as bablyon.JS?
Before I’ve started the project, I've checked out the available games for the web, and I wasn’t impressed. I thought there must be a reason why they all look so simple. I’ve noticed that Unity can compile to JS, but it had to load all the game assets in advanced. It took to long to start up a game, and its an obvious limit on how many assets you can include in a game. I come from a strong JS background so I thought, I will investigate the performance of whats involved to make a game run in the Browser ..a year and a half later I’ve ended up with Age of Reptiles :)
Any off the shelf solution comes with tradeoffs. Fast to start, slow to finish when you start hitting those obstacles... I wouldn’t recommend writing an engine because it takes forever, but I ended up with one because I was curious and enjoyed the process. 
There is an upside though to write your own engine: you can optimize it for what is most important for you. My focus was to load assets progressively, to make Large Scale Open World environment possible in the Browser. 

If you guys have any other questions, I'm more than happy to go into details.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...