I-War 2, EOC, 2-D

Home Forums I-War Development Section Developer’s Corner I-War 2, EOC, 2-D

Viewing 15 posts - 1 through 15 (of 23 total)
  • Author
    Posts
  • #17337
    Chessking
    Participant

    I decided to make my own thread for the two dimensional version of Independence War. This will help me to keep working on it, and will be a place that I can ask for help from you guys.

    For those who did not read the first post about this project, here is a link to a program showing several assets that I am making: https://www.khanacademy.org/computer-programming/spin-off-of-project-ad-design/5492974005256192.
    It’s not much, but I am still working on it, and I have more in other places.

    Right now I have been learning Perlin noise, and would like to use it to make planets for the game. My prototype planets are here. However, Processing JS cannot process the noise fast enough for planets over forty pixels wide, or for many planets. I can scale them larger, but then they have jagged edges. Ideas for fixing this are storing the values of the pixels in arrays, but it would take as long to draw them from the array as normal, I think. The other idea is to make my own algorithm that Processing JS can process faster than the built in noise() function. Another possibility is that my computer is the problem. Any ideas?


    This is one tough navy, boy. They don’t give you time off, even for being dead. -Clay

    Storm Petrel

    #17367
    Chessking
    Participant

    The problem is drawing so many individual points. At max, I would require 422,500 individual points to be drawn if I were to generate backgrounds with noise. Apparently other applications use noise differently, because I hear that noise can handle jobs like this with less memory usage than if an image were used. Anyways, I think I will have to go with some boring, plain colored planets.


    This is one tough navy, boy. They don’t give you time off, even for being dead. -Clay

    Storm Petrel

    #18223
    Chessking
    Participant

    I have suddenly started working on this again, even though my first priority program isn’t done yet. Her’s why:

    I had been working on movement functions, but I was doing it all wrong. :blush: I was trying to calculate the movement vector (to be added to the players position, introducing motion) by testing if the angle of rotation was in a certain area and a certain key was being pressed, and then adding a value to the vector. For example:


    if(keyIsPressed && keyCode = RIGHT) {
    rotation+=1;
    if(rotation >= 0 && rotation < 45) { direction.x+=1/45; }else if(rotation >= 45 && rotation < 90) { direction.y-=1/45; }//and so on. }

    I never got this code to run correctly, so I set out to learn about PVectors, forces, and angular movement.

    Since I started my trigonometry class this year (the first section is review since I did it in Pre-Calculus last year) trigonometry has been at the front of my mind. I suddenly realized that the terminal ray on a unit circle is similar to a vector, and that the x and y distances of the new point are functions of the angle. Here's the new code:


    if(keyIsPressed && keyCode = right) {
    rotation+=1;
    direction.x = sin(rotation);
    direction.y = cos(rotation);
    }

    Even as I wrote the original code, I knew these trigonometric identities, but I was not able to associate the problem with its trigonometric solution, since I had done little work with trigonometry before. However, I had used the atan2() function to turn a vector into an angle measure, so I wasn't far away.

    There is another benefit to the new system also. Under the old system, the maximum magnitude of the direction vector was (1, 1) or sqrt(8 )/2. Using the correct form, the maximum magnitude is (sqrt(2)/2, sqrt(2)/2), or 1. This prevents the ship from covering more space at an angle to the axes then when it is going along an axis.

    Anyways, the point is, I have straitened out some simple mistakes that were preventing this update, and now have a working 2-d space flight simulator.

    Also, I just learned how to use createGraphics, which allows me to use the 3-d functionalities build into processing.js. Expect decent, low cost planets. B) :woohoo:


    This is one tough navy, boy. They don’t give you time off, even for being dead. -Clay

    Storm Petrel

    #18230
    admin
    Keymaster

    I don’t have any idea about what you’re doing there, but it feels like an old asteroids game. So I guess you got the mechanics just right 😛


    Space. The final frontier.

    #18235
    Chessking
    Participant

    The lessons I have been doing were preparing me for building an asteroids game. So far I would say it has Newtonian flight. I am working on collisions now.


    This is one tough navy, boy. They don’t give you time off, even for being dead. -Clay

    Storm Petrel

    #18315
    Chessking
    Participant

    I have been learning a lot more about rendering with Javascript, so I am certain I can make procedurally generated planets (and backgrounds, if I can find a working algorithm).


    This is one tough navy, boy. They don’t give you time off, even for being dead. -Clay

    Storm Petrel

    #18656
    Chessking
    Participant

    I have been making more progress on this. I have been working offline mostly, so all I can show you is the new procedurally generated background in the flight demo, as linked to before. Mostly I have been re-writing the flight demo to be more efficient, utilizing that efficiency with flight assist, prototyping the next stages, and working with them to make them more efficient. I have the foundation for most of the functionality laid out. The largest hurdle will be dynamic collisions, but my new thruster system should be able to create Newtonian results easily. Below is my release plan with other information.

    Stage 1: Flight demo. (completed)
    Stage 2: demo. (in progress)
    Stage 3: release.

    The demo and release will have several formats available:

    1. Khan Academy program: the game can be streamed through Khan Academy.
    2. Since the program is written in Javascript, it can be added to any website easily (although modding would be difficult)
    3. Offline
    4. Offline with an asset generator to reduce loading time
    5. Offline with assets downloaded with the program


    This is one tough navy, boy. They don’t give you time off, even for being dead. -Clay

    Storm Petrel

    #18933
    Chessking
    Participant

    This was my programming project for the month of April. What I accomplished:

    Rewriting the program after It was deleted along with the rest of my operating system.

    That is pretty much all. In the process, I did improve some things:
    Flight assist is better than ever, using dot product.
    Fullscreen looks better, and automatically adjusts to the users screen size.
    I have worked more on the shooting mechanics.
    If I need the keyCode of a key, I can find out with the press of a button. Much better then editing the code and restarting the program.
    I can zoom in and out.

    My progress thus far in May is coming right up in a different thread, titled “Dynamic Keybinder”.


    This is one tough navy, boy. They don’t give you time off, even for being dead. -Clay

    Storm Petrel

    #19007
    Chessking
    Participant

    I have made advancements in a number of different areas.

    First, I have added the first bit of UI, the contact list. I added the ability to toggle between ships, and have added indicators around the ships on the screen.

    I have also made the first station: a biobomber, and it looks pretty good. A technical explanation is below.

    [spoiler]The OOP code and other functionality are not in place, but I have the model made. In order to make it look as realistic as possible without creating an image, I needed metal plates and lines placed “randomly” around the ship. To do this I modified my star generating algorithm to produce x and y locations instead of intensities given x and y. The result isn’t as random as the starfield, but after 90 iterations it is hard to notice. The outputs repeat after a while, but by changing the seed (or one of the four seeds, to be exact) I can change the appearance and reduce noticeable patterns. It is easy to specify the width and height of the area.

    I could modify this new system to generate stars. Since they would be separate objects instead of peaks in the algorithm, each one could have its own properties. In a 3-D world, it would be possible to fly to each one. This is probably how it was done in Space Engine. It might generate faster as well, since each iteration of the algorithm produces a star, rather than iterating for every pixel to find the stars.[/spoiler]
    I have also imported the other ships I have made into the game, scaled them all down to the correct size, and got it so that the engines and thrusters scaled properly as well. Now that I have the biobomber, a need for information has become apparent. I used the descriptions on this site to scale the ships to the correct length, but some of the information is “classified”. In addition, I need to know the lengths of stations, the speed and power of different weapons, etc. At the moment I am not sure where to find the information.

    Now that I had created the contact list and targeting system, I was able to add the first autopilot: autopilot approach. It will need some more work, since it assumes zero speed at start and a still target, but it works.

    Is anyone interested in screenshots of this?

    I am starting a job next week, so I won’t have as much time to work on this.


    This is one tough navy, boy. They don’t give you time off, even for being dead. -Clay

    Storm Petrel

    #19009
    Chessking
    Participant

    I forgot to mention something, and I do not have edit permissions. I have created a field that works similarly to an LDSI field, except anything outside of it will be killed after a period of time. I have also added remote link ability, as I wrote the code with it in mind, so it was easy to add. Now, I can remote link all of the other ships and fly them out of the ring.


    This is one tough navy, boy. They don’t give you time off, even for being dead. -Clay

    Storm Petrel

    #19011
    IronDuke
    Participant

    [quote=”Chessking” post=20231]
    I have also imported the other ships I have made into the game, scaled them all down to the correct size, and got it so that the engines and thrusters scaled properly as well. Now that I have the biobomber, a need for information has become apparent. I used the descriptions on this site to scale the ships to the correct length, but some of the information is “classified”. In addition, I need to know the lengths of stations, the speed and power of different weapons, etc. At the moment I am not sure where to find the information.
    [/quote]
    Übermodder to the rescue! :cheer:

    You can find all the game files in resource.zip. For example, in resource.zip/sims/weapons, you will find the actual weapon projectile objects. These contain properties like speed damage. sims/ships/player/heavy_corvette would have the acceleration and top throttle values, and hitpoints and hardpoints and the paths to the .lws file that sets up the graphics for the ship. You can use the reverse-engineered .pso converter to convert the ship’s model from .pso to .lwo, then open it in blender, and you have the untextured 3D model. You can simply measure then.

    Also, subsims/systems/player has all the player systems, from A-M PBCs to LDS drives to countermeasures. To tell you what to expect there, the pbc file would have weapon fire rate, a path to the weapon sim (in this case ini:/sims/weapons/pbc_bolt or something like that), max energy, energy used per shot, heat per shot, power consumption, hit points, all kinds of good stuff.

    Now for stations, which is what you actually asked about, that’s a little different. They are entirely modular, so you’d be getting the dimensions of the various modules. But it’s simple math to put them together, so it shouldn’t be hard.

    Yay, I actually rattled all this right off the top of my head! Seems I truly know a lot about the game from the many hours spent sifting through the files. :mrgreen:

    [quote=”Chessking” post=20231]
    Is anyone interested in screenshots of this?
    [/quote]
    Me. :whistle:

    –IronDuke


    I-War 2 Discord: https://discord.gg/RWaabWB
    Very little about the game is not known to me. Any questions you got, throw them at me. 🙂

    #19014
    Chessking
    Participant

    Thanks for the reply! I will definitely use this in the future.

    Screenshot incoming!

    Attachments:
    • EOC2-D.png

    This is one tough navy, boy. They don’t give you time off, even for being dead. -Clay

    Storm Petrel

    #19017
    7upMan
    Participant

    Interesting. It’s not my kind of game, but I see these top-down space games regularly on Space Game Junkie, so there is definitely interest and a market for this.

    #19019
    Chessking
    Participant

    @7upMan I couldn’t market this, unless I changed the ships and story to something else. THat is something to think about. 😉


    @IronDuke
    It is actually a bit easier than you described. The dimensions of the ships and stations are also in the .ini files. It is possible that the models are not exactly to scale, so the dimensions in the .ini file are used to scale it correctly. This is exactly what I am doing in my game as well. It is interesting that you described the .ini file as object files. That is exactly what they are! I have similar objects in my code that do all the same things.


    This is one tough navy, boy. They don’t give you time off, even for being dead. -Clay

    Storm Petrel

    #19020
    IronDuke
    Participant

    The dimensions in the ini file do nothing right now! They are probably collider dimensions for if there is no collisionhull specified in the file, except that they got ripped out for some reason, and in the vast majority of cases, do absolutely nothing. At that point, I think they just left them in for reference. They are not even accurate; don’t use them!
    Example: in the sims/ships/navy folder, the advanced_patcom_mk1 and heavy_corvette_mk1 both have these dimensions:
    ; Dimensions
    width=80
    height=70
    length=120
    Seriously, I tried setting them all to 1 on a ship, and it did absolutely nothing at all. They’re kinda pointless really; I never did figure out what they were for for sure.

    –IronDuke


    I-War 2 Discord: https://discord.gg/RWaabWB
    Very little about the game is not known to me. Any questions you got, throw them at me. 🙂

Viewing 15 posts - 1 through 15 (of 23 total)
  • You must be logged in to reply to this topic.