thmsndk / screeps3d Goto Github PK
View Code? Open in Web Editor NEWThis project forked from bonzaiferroni/screeps3d
A 3D client for the MMORTS Screeps.com
This project forked from bonzaiferroni/screeps3d
A 3D client for the MMORTS Screeps.com
The token for official screeps server should be a password field so the token is not visible in case of streams and such.
Orlet on slack mentioned that creeps do not render tough parts after I sent this screenshot
I assume it it is the defender creep chilling in the back with attack parts (red).
it has 1 tough part and there is a white almost transparant "shield" circle around it.
Orlet also mentioned how it looks on official
TOUGH
parts in official client appear as a light halo around the creep
Just like in the official client, it should be easy to add a room ownership/reservation overlay. Perhaps some of the other overlays can be implemented as well.
This should be fairly straightforward to implement as a canvas object under RoomView
As a first implementation, room ownership could be implemented, but the idea is to get a foundation for map overlays in place
https://docs.screeps.com/api/#StructurePowerBank
https://docs.screeps.com/power.html#Power-Banks
Has the following description in the side panel
This structure emits bright light and splashes of sparks.
Write more detailed tasklist
Resources have cilindric shape so they can be visible on roads and not hover over plains. It's ugly, so the idea is to have roads closer to the ground level.
The current console generates a lot of lag when the console is verbose. the text scrolls by rather fast aswell. This issue exists to collect ideas on HOW we want the console to function in the 3D client.
Feel free to post suggestions and ideas on this in this issue
Hexcede on slack suggested ramparts should look like forcefields and linked a tutorial video
https://www.youtube.com/watch?v=NiOGWZXBg4Y
ramparts should be "connected" together aswell so it is only the "true" edges that are rendered as an edge.
The tutorial appears to require unity 2019 though, but it would be pretty awesome if we could accomplish this one day.
i'll write a more detailed task list later, I assume we can be inspired a lot by the existing creep, perhaps enhance it in some way
https://docs.screeps.com/api/#PowerCreep
https://docs.screeps.com/power.html#Power-Creeps
https://support.screeps.com/hc/en-us/articles/115001254709-Discussion-Power-Creeps
https://github.com/screeps/renderer/blob/master/metadata/src/objects/powerCreep.metadata.js#L43
https://github.com/screeps/renderer/tree/master/metadata/images
We appear to be loosing the cache of a roomObject, or missing the initial data stream containing type atleast.
Exception: type data was not found for new roomObject, there may be a caching problem
Screeps3D.RoomObjects.ObjectManager.GetInstance (System.String id, .JSONObject data) (at Assets/Scripts/Screeps3D/RoomObjects/ObjectManager.cs:29)
Screeps3D.Rooms.RoomUnpacker.UnpackObjects (.JSONObject roomData) (at Assets/Scripts/Screeps3D/Rooms/RoomUnpacker.cs:48)
Screeps3D.Rooms.RoomUnpacker.Unpack (.JSONObject roomData) (at Assets/Scripts/Screeps3D/Rooms/RoomUnpacker.cs:29)
Screeps3D.Rooms.RoomObjectStream.ReceiveData (.JSONObject Data) (at Assets/Scripts/Screeps3D/Rooms/RoomObjectStream.cs:54)
Screeps_API.ScreepsSocket.FindSubscription (.JSONObject json) (at Assets/Scripts/Screeps_API/ScreepsSocket.cs:127)
Screeps_API.ScreepsSocket.ProcessMessage (WebSocketSharp.MessageEventArgs e) (at Assets/Scripts/Screeps_API/ScreepsSocket.cs:115)
Screeps_API.ScreepsSocket.Update () (at Assets/Scripts/Screeps_API/ScreepsSocket.cs:90)
When trying to select something, the following exception occurs
ArgumentException: Could not create sprite (0, 0, 250, 250) from a 100x100 texture.
UnityEngine.Sprite.Create (UnityEngine.Texture2D texture, UnityEngine.Rect rect, UnityEngine.Vector2 pivot, System.Single pixelsPerUnit, System.UInt32 extrude, UnityEngine.SpriteMeshType meshType, UnityEngine.Vector4 border, System.Boolean generateFallbackPhysicsShape) (at C:/buildslave/unity/build/Runtime/2D/Common/ScriptBindings/Sprites.bindings.cs:264)
UnityEngine.Sprite.Create (UnityEngine.Texture2D texture, UnityEngine.Rect rect, UnityEngine.Vector2 pivot, System.Single pixelsPerUnit, System.UInt32 extrude, UnityEngine.SpriteMeshType meshType, UnityEngine.Vector4 border) (at C:/buildslave/unity/build/Runtime/2D/Common/ScriptBindings/Sprites.bindings.cs:275)
UnityEngine.Sprite.Create (UnityEngine.Texture2D texture, UnityEngine.Rect rect, UnityEngine.Vector2 pivot, System.Single pixelsPerUnit, System.UInt32 extrude, UnityEngine.SpriteMeshType meshType) (at C:/buildslave/unity/build/Runtime/2D/Common/ScriptBindings/Sprites.bindings.cs:280)
UnityEngine.Sprite.Create (UnityEngine.Texture2D texture, UnityEngine.Rect rect, UnityEngine.Vector2 pivot, System.Single pixelsPerUnit, System.UInt32 extrude) (at C:/buildslave/unity/build/Runtime/2D/Common/ScriptBindings/Sprites.bindings.cs:285)
UnityEngine.Sprite.Create (UnityEngine.Texture2D texture, UnityEngine.Rect rect, UnityEngine.Vector2 pivot, System.Single pixelsPerUnit) (at C:/buildslave/unity/build/Runtime/2D/Common/ScriptBindings/Sprites.bindings.cs:290)
UnityEngine.Sprite.Create (UnityEngine.Texture2D texture, UnityEngine.Rect rect, UnityEngine.Vector2 pivot) (at C:/buildslave/unity/build/Runtime/2D/Common/ScriptBindings/Sprites.bindings.cs:295)
Screeps3D.Tools.Selection.Subpanels.OwnerPanel.Load (Screeps3D.RoomObjects.RoomObject roomObject) (at Assets/Scripts/Screeps3D/Tools/Selection/Subpanels/OwnerPanel.cs:34)
Screeps3D.Tools.Selection.SubpanelFactory.AddSubpanels (Screeps3D.RoomObjects.RoomObject selected, System.Collections.Generic.List`1[T] subpanels) (at Assets/Scripts/Screeps3D/Tools/Selection/SubpanelFactory.cs:55)
Screeps3D.Tools.Selection.SelectionPanel.Load (Screeps3D.RoomObjects.RoomObject obj) (at Assets/Scripts/Screeps3D/Tools/Selection/SelectionPanel.cs:28)
Screeps3D.Tools.Selection.SelectionUI+<>c__DisplayClass3_0.<OnSelect>b__0 () (at Assets/Scripts/Screeps3D/Tools/Selection/SelectionUI.cs:32)
Common.Scheduler.Update () (at Assets/Scripts/Common/Scheduler.cs:35)
Perhaps also a hotkey, besides a button
There was talk on slack about visualizing when a nuke hits a target, rendering a mushroom cloud. this got me thinking it would also be cool to render an in air missile flying in an arc from launch room to target room and destination (x,y)
Need to get some screenshots of the official client to see how it looks while the nuke is in air, and what it looks like on impact.
https://youtu.be/Adhp0epshfg?t=65
https://www.youtube.com/watch?v=7hTPTiAHZxk
Rendering a Launch Arc in Unity
30m https://www.youtube.com/watch?v=iLlWirdxass
https://en.wikipedia.org/wiki/Projectile_motion
Moving Object Along A Parabola | Unity Tutorial
https://www.youtube.com/watch?v=ddakS7BgHRI
Shader Forge - Particle Dissolver Shader
https://www.youtube.com/watch?v=IZryS_dsqdg
official experimental api for nukes
Support added by ags131 in screepsmod-admin-utils after we talked about this feature in slack
{
"ok": 1,
"nukes": {
"shard0": [],
"shard1": [],
"shard2": [{
"_id": "5d26127173fcd27b55a7ef39",
"type": "nuke",
"room": "W23S15",
"x": 12,
"y": 37,
"landTime": 17300541,
"launchRoomName": "W31S18"
}, {
"_id": "5d26aa11385277180e5c2187",
"type": "nuke",
"room": "W22S22",
"x": 23,
"y": 22,
"landTime": 17311981,
"launchRoomName": "W17S28"
}
],
"shard3": []
}
}
It is easy to get disoriented and forget which way is north. There should be a compass with a rotation that corresponds to the Y axis of the camera. Clicking on this compass will reorient the camera to face north.
I would love to see support for the SS1 Unified Credential File, most of my PCs already have the configs laying around since all my tools use them.
Could potentially use it to pre-populate a server list, and since it contains auth data, could skip the login.
this needs to be fletched out in regards to how it should work.
rendering "text" above creeps and such makes sense, what about rectangles and other stuff.
should it render as "sprites" is it a "hud"? like what OverMind does? how does it should it render relative to the position? is it a map overiview overlay?" all theese questions, needs to be refined :)
The current solution runs C#4
https://docs.unity3d.com/Manual/CSharpCompiler.html
https://docs.unity3d.com/Manual/PlatformDependentCompilation.html
I'd like to upgrade to C#7, not sure if we need to upgrade the editor to a newer version to accomplish that, for now i'd settle with an updated C# language.
Currently creep.say uses TMP to render a text, this text does not know how to render emojii, we need to supply a spritesheet as far as I understood for it to find emojii, or perhaps it is the chosen font that do not support emojii? Will have to investigate.
https://docs.screeps.com/api/#Creep.say
http://unicode.org/emoji/charts/emoji-style.txt
https://www.youtube.com/watch?v=srmg9EWpZ0E
https://www.youtube.com/watch?v=hlatyQC-xIg
https://www.unicode.org/emoji/charts/emoji-list.html#1f41b
https://forum.unity.com/threads/how-to-include-basic-unicode-symbols-like.512475/
https://github.com/Unity-Technologies/ScriptableRenderPipeline/wiki/Upgrading-to-HDRP
If the goal is to have fancy shaders for features like shields and textured swamps, it might be helpful to upgrade unity to lower the required learning period by using shader graph.
The project seems to work perfectly without the hdrp currently. It is mainly a solution to the other requests for 'fancy' graphics like that hexagonal shield look, as the videos for that use shader graph.
Done:
still to do :
KittyTack on slack suggested that minerals and power should render different colors than yellow in storage and terminals.
We should utilize the same colors for minerals as utilized to render the mineral that can be mined.
In fact, we should render the storage depending on the type of storage everywhere we can
Ops don't show up in storages/terminals, neither in the viewer nor when selecting.
Would people want the ability to bookmark a room?
Please vote on the issue with an emoticon (top of the issue) and feel free to talk about this suggestion in comments :)
Future:
It'd be cool to have extensions appear bigger just like in official client, when they have increased capacity at RCL7 and RCL8.
We should get some CI up and running for automation of builds, doing it manually kinda takes a long time to build and bundle correctly.
Azure Dev Ops
https://medium.com/medialesson/continuous-integration-for-unity-3d-projects-using-azure-pipelines-e61ddf64ad79
https://dinomite-studios.github.io/unity-azure-pipelines-tasks/
jenkis
https://www.youtube.com/watch?v=4J3SmhGxO1Y
https://developer.github.com/v3/guides/managing-deploy-keys/#deploy-keys
The idea of this issue is to parse / sanitize the console output. stripping html etc.
We want to accomplish the following in the long run
Room Links
RoomPosition.prototype.link = function() {
return `<a href="#!/room/${Game.shard.name}/${this.roomName}">[${ this.roomName } ${ this.x },${ this.y }]</a>`;
};
Colored console output
console.log('<font color="#ff5555" type="highlight">' + someText + '</font>');
map links
/map/shard2?pos=0,0
When I log in it picks shard2, without really picking it (there is a dot next to shard2 when you open the dropdown), and my room from shard3, the end result is that i'm not seeing my room. I have to select shard3 in the dropdown go to room name and press enter.
I would expect it to just load my room in shard3.
Now if one has multiple rooms across shards, how would you expect it to work then?
KittyTack on slack reported the following
When exploring around on MMO the used memory on the system skyrockets, it never seems to unload /unsubscribe the rooms not visible from memory.
KittyTack suggested a button to "unload" all rooms except the ones around your current location.
We need to investigate the memory usage point.
Maybe some kind of yellow fog/glow thingy in room view, and something simpler for map view?
Currently the only way to check if room is being reserved is by selecting source and checking its energyCapacity
Rivaryn on slack reported having trouble selecting single objects when they are bunched together
My personal suggestion is an option at some point, but early on I think left click cycles and right click (without camera drag) does a pop-up menu...
As for cycling, I tend to want creeps first, then main structures (containers, storages, labs, etc), then ramps and finally roads.
We need to figure out minimum requirements for a pleasant experience.
Please comment on your experience with the client with the following information
We need to render Source Keeper lairs
https://docs.screeps.com/api/#StructureKeeperLair
Model
Info Panel
The official client hits
GET /api/version
on each server to check status
{
"ok": 1,
"protocol": 13,
"useNativeAuth": false,
"users": 33,
"serverData": {
"welcomeText": "<style>.screepsplus h1{ text-align: center; }</style>\n<div class=\"screepsplus\">\n <h1>ScreepsPlus</h1>\n Wecome to the ScreepsPlus private server.<br>\n Mods include screepsmod-auth and several custom mods to enable email notifications, control tickrate, power banks, portals, and other internal improvements.<br><br>\n <a href=\"https://server1.screepspl.us/authmod/password\">Click here to set your password</a>\n <br><br>\n <div style=\"text-align: center\">\n This server is funded by backers on Patreon. <br>\n <a target=\"_blank\" href=\"https://www.patreon.com/bePatron?u=6867142\" ><img src=\"https://c5.patreon.com/external/logo/become_a_patron_button.png\"></a>\n </div>\n</div>\n",
"customObjectTypes": {
"gift": {
"sidepanel": "\n \t<script>{\n \t\tconst roomEl = angular.element(document.querySelector('section.room'))\n \t\tconst { Game } = angular.element(document.querySelector('section.game')).scope()\n \t\tconst conn = roomEl.injector().get('Connection')\n \t\troomEl.scope().openGift = function (id) {\n\t \t\tconn.addObjectIntent(id, Game.player, 'open', {})\n\t \t}\n \t}</script>\n \t<div><label>Contents:</label>Unknown</div>\n \t<div><label>Status:</label>Potentially Dangerous</div>\n \t<div>A mysterious gift</div>\n \t<md-button class=\"md-primary md-hue-1 allwidth\"\n \t ng-click=\"openGift(Room.selectedObject._id)\" \n\t\t ng-if=\"true || !Game.readOnly && (Room.selectedObject.user == Game.player || Room.selectedObject.user == 0 && Game.player == Me()._id)\">\n\t\t Open\n\t\t</md-button>\n \t"
}
},
"historyChunkSize": 20,
"socketUpdateThrottle": 200,
"renderer": {
"resources": {
"my_gift_texture": "{ASSETS_URL}/gift.png"
},
"metadata": {
"gift": {
"texture": "rectangle",
"zIndex": 4,
"Zprocessors": [{
"id": "main",
"type": "circle",
"once": true,
"payload": {
"id": "static",
"radius": 100,
"color": 13421772
}
}
],
"processors": [{
"type": "sprite",
"once": true,
"payload": {
"texture": "my_gift_texture",
"width": 100,
"height": 100
},
"actions": [{
"action": "Repeat",
"params": [{
"action": "Sequence",
"params": [[{
"action": "ScaleTo",
"params": [1.5, 1.5, 0.3]
}, {
"action": "ScaleTo",
"params": [1, 1, 1]
}
]]
}
]
}
]
}, {
"type": "sprite",
"once": true,
"layer": "lighting",
"payload": {
"texture": "glow",
"width": 800,
"height": 800,
"tint": 16777215
},
"actions": [{
"action": "Repeat",
"params": [{
"action": "Sequence",
"params": [[{
"action": "TintTo",
"params": [16777215, 0.3]
}, {
"action": "TintTo",
"params": [3385907, 1]
}
]]
}
]
}
]
}
]
}
}
}
},
"packageVersion": "3.4.3"
}
POST /api/servers/list
Might want to cache that
{
"ok": 1,
"servers": [{
"_id": "5bc5a7a2698d0a2982d5abeb",
"settings": {
"host": "screeps.fordo.sk",
"port": "21025",
"pass": ""
},
"name": "Fordo",
"status": "active",
"likeCount": 32
}, {
"_id": "5bc63a9a698d0a2982d5abec",
"settings": {
"host": "server1.screepspl.us",
"port": "21025",
"pass": ""
},
"name": "ScreepsPlus",
"status": "active",
"likeCount": 178
}, {
"_id": "5bf6d5e6c434b462a66a8c87",
"settings": {
"host": "swc.screepspl.us",
"port": "21025",
"pass": ""
},
"name": "Screeps Warfare Championship",
"status": "active",
"likeCount": 47
}, {
"_id": "5bf6d62fc434b462a66a8c88",
"settings": {
"host": "botarena.screepspl.us",
"port": "21025",
"pass": ""
},
"name": "Botarena",
"status": "active",
"likeCount": 40
}, {
"_id": "5c9bd2a180cbdd12f4816e42",
"settings": {
"host": "screeps.cogd.io",
"port": "21025",
"pass": ""
},
"name": "cogd",
"status": "active",
"likeCount": 27
}, {
"_id": "5cd7ed2e8302df17a0101b19",
"settings": {
"host": "screeps.pacloud.online",
"port": "21025",
"pass": ""
},
"name": "The Animatrix",
"status": "active",
"likeCount": 12
}, {
"_id": "5ce23cf4a47e911f2070a410",
"settings": {
"host": "server2.screepspl.us",
"port": "21025",
"pass": ""
},
"name": "ScreepsPlus season server",
"status": "active",
"likeCount": 50
}
],
"likes": [{
"_id": "5cea55436e18610a7d4aa8db",
"steamid": "a steam id",
"server": "5bc63a9a698d0a2982d5abec"
}, {
"_id": "5d128b603182fc77c738c61d",
"steamid": "a steam id",
"server": "5bf6d62fc434b462a66a8c88"
}, {
"_id": "5d34c7996f19796e28809c1a",
"steamid": "a steam id",
"server": "5ce23cf4a47e911f2070a410"
}
]
}
The official client allows for connecting to private servers using an encrypted ticket obtained through internal steam api it hits the following api /api/auth/steam-ticket
it probably uses steamworks or steam overlay, wonder if we can integrate with it somehow? should probably be in a future iteration
ags131 mentioned the following
So, current steam login flow is goto
/api/auth/steam
(usually in a new window), it redirects to steam, user logs in, then returns with a page that just calls opener.postMessage with username, token, and steamid
As a note, this mimics the MMO auth api exactly, so works identically
Currently just a dump of info, will elaborate later, open for discussion :)
https://screeps.com/forum/category/7/private-servers is a pretty good reference
TorA from slack mentioned the following
I immediately try to drag the camera, either middle or left mouse buttons. I actually should have some unity code for doing that if you need it.
When selecting rooms, a new widget containing all your owned rooms should be presented, allowing your to select one of your existing rooms.
S+ is hosted with SSL
currently the client appears to only be able to connect to official with SSL
https://docs.screeps.com/api/#StructurePortal
A non-player structure. Instantly teleports your creeps to a distant room acting as a room exit tile. Portals appear randomly in the central room of each sector.
Destination
If this is an inter-room portal, then this property contains a RoomPosition object leading to the point in the destination room.
If this is an inter-shard portal, then this property contains an object with shard and room string properties. Exact coordinates are undetermined, the creep will appear at any free spot in the destination room.
Original issue:
bonzaiferroni#6
Would like a more advanced model of the portal that reminds a lot more of a portal, something that "shimmers" / animates, perhaps lightning coming out from it?
, perhaps like a "platform" and we can shoot a blue beam out of it? this will allow creeps to "crawl" into the platform?
perhaps an animation upon a creep leaving, / entering a portal.
Alternatives / ideas / tutorials
https://youtu.be/w0znZIuvQ2I
Add support for the new storage syntax / system
source
{
"_id": "5bbcae129099fc012e63861d",
"room": "E19S38",
"type": "source",
"x": 5,
"y": 20,
"energy": 2310,
"energyCapacity": 3000,
"ticksToRegeneration": 300,
"invaderHarvested": 41634,
"nextRegenerationTime": 1.043212E+07
}
container
{
"_id": "5d631296ac2d2d20dcf64875",
"type": "container",
"x": 6,
"y": 21,
"room": "E19S38",
"notifyWhenAttacked": true,
"hits": 250000,
"hitsMax": 250000,
"nextDecayTime": 1.043206E+07,
"store": {
"energy": 378,
"GO": 52
},
"storeCapacity": 2000
}
spawn
{
"_id": "5cf3b2f83dca297f761ca396",
"type": "spawn",
"room": "E19S38",
"x": 11,
"y": 32,
"name": "Spawn1",
"user": "5a44e109ac5a5f1d0146916e",
"hits": 5000,
"hitsMax": 5000,
"spawning": null,
"notifyWhenAttacked": true,
"off": false,
"store": {
"energy": 64
},
"storeCapacityResource": {
"energy": 300
}
}
You should be able to ctrl+click a creep or tower, in case of a creep, the camera starts tracking it, and in case of a tower, you get to see whatever it is pointing at through the barrel, maybe with a scope-like crosshair too.
So far we have roads and dots.
The room subscription has been (mostly) fixed. However after some time of client running there still appears an issue of room objects not showing up. This time it look like it's correlated to having lots of "Exception: type data was not found for new roomObject, there may be a caching problem" and "received null data from server" in a log
In Cinematic mode, the camera will cycle through rooms, zooming in on features like the spawn, sources, and controller. This will be a passive way to view what is happening in screeps, and will require no player interaction. It should also be controllable via console output.
#client-abuse
Ability to control cinematic mode by console output from your ai, perhaps an ability to control cinematic mode by creep.say
We should update the client to a newer Unity version, giving us access to ShaderGraph and other exciting things.
I've just updated to use the Unity 2019.1.7f1 editor
And I only had to remove the following using UnityEngine.Experimental.UIElements;
from InputMonitor.cs
to make it run
no idea if anything broke, but I could connect to botarena and it seemed to be fine
Sometimes creep that should die isn't removed from map and instead stands still with negative TTL.
Steps to reproduce: Let it run on spectator mode until you spot some should-be-dead creeps. Easiest to spot near sources.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.