Open Kryptos-FR opened 5 years ago
That would be awesome! Xenko is alread quite programmer friendly, so it would also be a good learning source to understand the basic parts of the engine.
Code-only sample = sample without assets/xkpkg?
The new Xenko as PackageReference approach should help a lot with that, since project can be created on VS. Note that few issues such as #58 or #12 might make code-only sample even easier/smoother to create.
@xen2 Yes that's exactly the idea.
It shows that the editor is optional, and that it is possible to build on top of Xenko's engine without the need to support the whole asset system.
For example use Xenko as a backend to a customized (eventually commercial) engine.
Hopefully that would widen our audience and bring more talents.
We managed to make some dirty resizable WinForms app which creates a Game instance and uses Xenko.Graphics to render a black triangle:
https://discourse.vvvv.org/t/link-topics-2-3d-engine/16544/23?u=microdee
here's the repo: https://github.com/microdee/xenko-window-from-code
I'd suggest adding xenko project template(s) to the nuget. So one could install it through dotnet new -i Xenko.Game.Template
and use through dotnet new xenkogame
Starting point if someone wants to investigate further to make sure it works for all platforms/configurations: Xnk.zip.
added a repo, the game is currently empty and only opens a black window. would be interesting to add some content in order to make it useful. but here it is for reference: https://github.com/tebjan/Xenko.CodeOnlyGame
Created https://github.com/xen2/Xenko.CodeOnlySample Just need to update the doc so people can find it (and possibly move it to xenko3d github)
great, made the other repo obsolete and linked the new one...
I've tried to build Xenko.CodeOnlySample from the console using dotnet and it failed:
Is it a bug? Or did I do something wrong? It builds in VS2017 without problems.
@rds1983 It is not a dotnet application, but .net framework.
@Kryptos-FR I have added a dotnet app too @rds1983 this is fixed, will be part of next Xenko beta. You can build from VS in the meantime
Thanks! The new Xenko release "3.1.0.1-beta01-0396" allows to build Xenko.CodeOnlySample from the command line using "dotnet build".
That's will be cool if we have such thing, build from familiar IDE is a better way to let programmer who has already 3d knowladges.
@Enzojz a xenko game is already a normal .NET solution that you can open with visual studio. just press the visual studio button in the game studio menu.
Now the only question is where to host and advertise it. I might move it to xenko3d org, and add it to the doc and/or wiki.
is it possible to add a code only example like this? is it even possible with xenco? if there are other ways to achieve something like this, how is it done?
`
public class PseucdoCodeExample
{
Game simulation = null;
struct UserData
{
Xenko.OS.OsWindow splashOsWindow;
}: userData;
void EntryPoint()
{
// simple use delegates
simulation.OnInit = OnInit;
simulation.OnStart = OnStart;
simulation.OnUpdate = OnUpdate;
simulation.OnPhysicsUpdate = OnPhysicsUpdate;
simulation.Run(); //or
simulation.RunAsync();
}
void OnInit()
{
// display splash
//create os window myself or use of xenko helper
userData.splashOsWindow = new Xenko.OS.Windows.CreateOsWindow(settings); // or
userData.splashOsWindow = new Xenko.OS.Windows.BindToExistingOsWindow(settings, hWnd);
// get a texture
Texture tex = Texture.CreateFromImageFile("file/location/splash.png", opts); // eventuell windows only (asset compiler?)
Texture tex = Texture.Load("file/location/splash.xTexture?"); // an already compiled? texture (done with gamestudio or batch-created)
Scene splashScene = new Scene();
splashScene.Entities.Add(new TexturePanel(..., tex) );
OsViewPort viewPort = new ViewPort(..., expand.all); // viewport os specific?
viewPort.RootScene = splashScene;
userData.splashOsWindow.Components.Add(viewPort);
userData.splashOsWindow.Show(); // display splash, while doin some work
hWnd = createOsWindow();
Xenko.OS.OsWindow mainOsWindow = new Xenko.OS.Windows.BindToExistingOsWindow(settings, hWnd);
// 2 viewports (for ease just top/bottom :) )
OsViewPort topViewport = new ViewPortComponent(name: "TopViewPort", ...); // resizeable if window is resized or toggle-fullscreen
OsViewPort bottomViewport = new ViewPortComponent(name: "BottomViewPort", ...);
mainOsWindow.Components.Add(topViewport);
mainOsWindow.Components.Add(bottomViewport);
// create main windows scene (mostly gui i think)
Scene mainViewTopScene = new Scene();
//....
topViewport.rootScene = mainViewTopScene;
// bottom Viewport displays results and stays empty for now
// setup mvvm or whatever
userData.splashOsWindow.Free(); // or hide ...
mainOsWindow.Show();
}`
Since https://github.com/stride3d/stride/issues/1295 is already finished, and the code only approach works fine, should this thread be closed?
Maybe, a console like template should be added to our example Stride projects to showcase this? It shouldn't reference the toolkit but use the same-ish code to demo how to do it and anyone could do whatever they want to do with that. Continue or switch to toolkit if desired.
What about a toolkit and non-toolkit samples?
If we are talking about this yes. Not sure if it should be under samples or templates?
Non-toolkit sample would be ok, because the code shouldn't change that frequently.
I would recommened a toolkit sample once the toolkit is stable so we don't have to keep updating the template 🤣.
If we are talking about this yes. Not sure if it should be under samples or templates?
Non-toolkit sample would be ok, because the code shouldn't change that frequently.
I would recommened a toolkit sample once the toolkit is stable so we don't have to keep updating the template 🤣.
yes as it may be possible we have to separate code only from the toolkit at some point for example with the skybox problem so the state is currently unknown of the toolkit
Also, wasn't there another PR (reversed) for another kind of code-only option?
All samples assume the use of the editor to make a game. We should provide at least one sample (let's call it code template) of a simple scene where everything is done programmatically.