How hard is to move from Unity3d to custom built game/engine.

Why run physics for stuff not visible?

And if you just need collision and no physics, you can create a collision detection library without physics. If needed in C++.
It is hard. But simpler than creating your own game engine.
But you should really ask yourself if you cannot simulate the stuff without a physics/collision engine.

And why instantiate invisible bullets?

Your code example tells me you have no chance to create your own engine, sorry.

Dont listen to the guys here, do it! its an awesome learning experience! I dont care if you are ready for this or not. There is a lot of info out there…esp on Amazon. The info you seek isn’t gonna just manifest itself in your head by making more unity games. You have to get your hands dirty. You have to not be afraid to fail. You have to be willing to learn. This is why the experience is invaluable. Also note, you dont need to have a rendering engine that’s AAA worthy, getting an animated mesh on screen is all that’s needed. Even the old LaMothe books form the early 2000’s can help you achieve your own engine, (even tho the books are old and somewhat out of date) the basics dont change.

Even if you don’t finish, I bet you will learn more during that time than all of your time using Unity. IMO, its like making the jump from mechanic to engineer.

2 Likes

This is a design error, not something you solve by writing your own engine. Maybe you can achieve twice the number of objects through brute force with a super-efficient custom engine compared to Unity, but you still have the same problem in the end. What you should do is use various optimization techniques so that only the objects you actually need to be active, are active at any given time. Proper optimization would allow you to scale to pretty much any number, and still have a good framerate.

–Eric

5 Likes

Very hard. Writing collisions is a mess.

Theres a lot wrong here if you are doing similar to the video above and I’ll just mention few examples. Bullets should be pooled. Hmm polygon colliders for bullet hits…? you don’t probably even need physics for bullets or you can only use them on every n bullet or only with special ammunitions. Even then box or sphere collider would be enough at that scale. Does each ship have own scripts running or do you have one manager for hundreds of ships?

1 Like
  1. Pooled by: (Create turret → with it 30 bullets → get them to array → enable/disable them,add force and change position)?
  2. If I do not need physics on bullets, how do I move them? Will Translate be better? Ive heard this isnt that good either.
    3.Each ship has 2 scripts attached. Pretty complex + 500 lines, though highly optimized.(Even it doesn`t look like that). Since each ship is enterable, has own cargo storage with items, own fitting(modules,turrets) etc.
  3. So doing foreach loop through 300 gameobject and calling some customUpdate function would be better? (calling optimizeUpdate only every 5 frames when ship is too far away)

This is one of those threads that the op gets a real answer over and over but then insists they know better.

3 Likes

highly optimized and foreach loop cant be used in the same sentence.

5 Likes

I see where your coming from man, I would just personally recommend you use unity and just deactivate as many components as possible while the AI is offscreen.

And that would be only if AI is a HUGE factor in your game. If its just a cool little feature, its not worth it mate.

Heres an idea. Do some research of procedural universe generation and population within unity. That will probably yield some similar results.

1 Like

It’s not too bad, it’s just a lot of work. How do you make a button in unity? GUI.Button in the OnGUI function. How do you make a button in a basic engine you’ve made yourself? You need to link a graphics library, make a structure that holds the data you need in the button and then make an event system to handle button presses.

If they are not visible, just use math. Don’t create or instantiate anything. Just compute it for all bullets in one method in bullet manager class.

That seems like a problem if you want to have many of them. Create a ShipManager class that handles all of them at once (if they are not visible) , or even better has different pools depending on details level and update rate needed for the specific pool.

Are you trying to build a simulator or are you trying to build a game? When you decide you want to build a game, you use tricks to make it look like a lot more is happening than really is. For example, none of the space battles that are not currently zoomed in on are worth wasting CPU time on. If a space battle is not currently the center focus, just use simple routines to estimate damage and destruction as a function of time instead of doing real time bullet physics on them. Come up with an ultra simple math formula for estimating damage received per second (not even per frame) for each ship that is out of focus but in a fight. Only use bullet physics for the battle that the user is currently zoomed in on. If you made this design change, you could probably easily scale your game.

1 Like

O rly…“If you want stuff to be highly optimized, don’t use a foreach loop.” :wink:

–Eric

2 Likes

@OP, I hope the following sentence makes clear the main thing you have to realize:

At that scale, you need to run your simulations without GameObjects or Monobehaviours within Unity.

If you understand that, you can go to thousands upon thousands of units at varying levels of simulation.

1 Like

How would I then check other objects around ? :smile:

That’s not even 1% of 1 header file. It gets extremely worse from there. In 6-7 months, you’ll be able to draw things on the screen and maybe load models and stuff reliably if you work all day every day… just saying, you don’t look at a building and say “how hard would it be to build my own luxury highrise?” Kay, cause that takes lots of people and lots of money… well, game engines take lots o’ people and lots of money, too, right? There’s a reason for that. Just saying. :wink:

1 Like

Took me about three days to draw stuff on the screen, in two weeks I had shader / .OBJ compiler / rendering and object picking done and basic lighting / texturing, it’s not that hard and plenty of tutorials on it. It’s more like making a big budget AAA, it all starts out small and innocent enough but gets large and out of control quickly.

Engines for small teams only work if you’re doing it for one game / platform only and you don’t decide to sell it to anyone. So you’re not having 10 of your staff every day just doing nothing but fixing bugs. You don’t need to care about backwards compatibility, nothing needs to look fancy. You should see some AAA engines, they look like they were made in Delphi back in the 90’s.

If you want cutting edge multi-platform engine, then no chance. I’ve seen guys on here and gamedev with there own homebrew engines and they are sweet. Using Unity isn’t a pre-req for building your own, there is a huge gap in skills… Although you can dig pretty deep…

TL;DR? Meh, depends.

2 Likes

Same way you would do it with your own engine :stuck_out_tongue:

Anyway, try to do offscreen battles with just calculating end results with math. Start small, for example just like ten ships vs twenty ships, one with twenty wins and have ten ships left. This should help you to get the idea how to use different methods in large scale. Its pretty much impossible to do anything like that big with bullet physics and all (without few supercomputers) …no matter what engine you got.

You could use a standard for loop (or a while loop). Not foreach.

–Eric

I can get object reference from a HashSet only in foreach loop.
That`s how I store objects in certain databases for certain performance. And I add / remove them from hashSets on the fly.