Recent

Author Topic: Using the Castle Game Engine Without Any Prior Coding Experience  (Read 4854 times)

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
Re: Using the Castle Game Engine Without Any Prior Coding Experience
« Reply #15 on: February 22, 2024, 01:38:06 pm »
Okay, now it made sense - I figured out before you posted that it was because I didn't actually add the extra stuff from the other project like ScenePhong, but made sure to fix that.

As always this was another beginner mistake, but I know to always keep trying to learn.

After I fixed the error and made GameViewMain a seperate file, the game plays correctly with the character actually showing;

however, the raycast vector itself is still not drawn, which is what I wanted drawn in the first place so I can fine tune it more accurately.

I have a Github, so posting my project on a Github and updating it as necessary is a very wonderful suggestion so that everyone can see my project in full more easily, especially if it has multiple files working together like here. Thank you very much for that. :)
« Last Edit: February 22, 2024, 01:55:54 pm by JPF12141999 »

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
Re: Using the Castle Game Engine Without Any Prior Coding Experience
« Reply #16 on: February 22, 2024, 01:46:35 pm »
Here is the link to the github, making sure to add a README as the site suggests I do directly to explain what I need help with now:

https://github.com/JPF12141999/Toy-Story-2-Ripoff-Game/tree/main

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
Re: Using the Castle Game Engine Without Any Prior Coding Experience
« Reply #17 on: February 22, 2024, 01:51:43 pm »
Note that GameEnemy.pas, even though it's included, intentionally doesn't do anything right now and isn't connected to the other code in any way, because I want to save that for later but just have the basic enemy logic in place for later, then edit the details when the time actually comes to add enemies.

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
Re: Using the Castle Game Engine Without Any Prior Coding Experience
« Reply #18 on: February 22, 2024, 02:04:33 pm »
Okay, I made an educated guess that it was because I didn't have the correct amount of uses, so the files didn't know how to read and communicate with each other, like GameViewPlay wasn't actually using GameViewMain and vice versa, and went over fixing that, but unfortunately it didn't draw anything that wasn't there already.

I know as always though, when I make any kind of change I should upload it to Github no matter how small.

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
Re: Using the Castle Game Engine Without Any Prior Coding Experience
« Reply #19 on: February 22, 2024, 02:18:50 pm »
I also saw I didn't initialize the GameViewMain stuff in GameInitialize.Pas, which is probably exactly a big part of what the issue was - as always I uploaded my changes to my Github project that I linked above.

Unfortunately, even after I fixed that the raycast still isn't drawn - is there something else obvious I am missing, after I have made sure to include all the correct "uses" clauses in the correct files, and made sure to actually initialize the code to draw the raycast in the project initialization file?

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
Re: Using the Castle Game Engine Without Any Prior Coding Experience
« Reply #20 on: February 23, 2024, 10:37:15 am »
Note I didn't include "GameInitialize" in the Uses directory of the other files, because it wasn't like that in the original example I was copying from, so I assumed it was like that for a good reason.

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
Re: Using the Castle Game Engine Without Any Prior Coding Experience
« Reply #21 on: February 23, 2024, 02:54:56 pm »
That's not the problem anymore - in my most recent project I included the ScenePhong and so on, which is what you will see if you download it from the Github link - the TMyMesh and similar stuff was created in the code directly rather than being an object in the scene, so I was deliberate about keeping it not an object here.

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
Re: Using the Castle Game Engine Without Any Prior Coding Experience
« Reply #22 on: February 23, 2024, 04:02:16 pm »
So as mentioned above, the new problem after that one is, that the character is drawn correctly but the raycast isn't, not even very simple points - but the program doesn't crash anymore because I fixed that particular problem.

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
Re: Using the Castle Game Engine Without Any Prior Coding Experience
« Reply #23 on: February 28, 2024, 11:43:15 pm »
With everything I have posted, like the link to the Github project with all the uses clauses intact and all the objects initialized correctly to the best of my knowledge, both in the scene and the code, does anyone have any other ideas on what is wrong with my code?

I am assuming I did something wrong, but I just can't figure it out because I made sure to look at examples in the tutorials to see that, for example, it is correct to use the variable name (AvatarTransform.something in this case) in the way I did if you want to use it as an input to a vector, or that it is correct in Pascal to use parenthesis exactly like (this) in order to make it obvious that you have to do the things in parenthesis first, so I am not sure what else is wrong.

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
Re: Using the Castle Game Engine Without Any Prior Coding Experience
« Reply #24 on: February 28, 2024, 11:44:14 pm »
I have the link to the actual page ready for proof too, like I know I always should, so that way I'm not making things up randomly.

lainz

  • Hero Member
  • *****
  • Posts: 4599
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Using the Castle Game Engine Without Any Prior Coding Experience
« Reply #25 on: February 28, 2024, 11:47:18 pm »
Hi, seems that nobody knows how to use castle game engine (I don't know really) so better try yourself starting the project from scratch. Do progress, commit the sources. So you can see where you are failing.

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
Re: Using the Castle Game Engine Without Any Prior Coding Experience
« Reply #26 on: February 28, 2024, 11:54:49 pm »
I already tried that, but thank you for the reply anyway - I had to include all the additional stuff about AvatarTransforms and so on that wasn't in the initial project, because the way the initial project was set up wasn't able to do the thing I wanted - having a character with multiple body parts that worked independently from one another (like running and shooting at the same time).

However, cause you don't know Castle Game Engine I don't think you would have that kind of knowledge, but I know other people who post like michaelis do.

lainz

  • Hero Member
  • *****
  • Posts: 4599
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Using the Castle Game Engine Without Any Prior Coding Experience
« Reply #27 on: February 28, 2024, 11:59:06 pm »
See at the error message.

It points to the line 128 of your unit GameViewMain.

Look what field do you access there. Are you sure a component with this name is present in the design?

You don't show the design (data/gameviewmain.castle-user-interface) so we cannot debug it. But I guess you didn't add a component with such name to your design.

And I'd advise to learn how to put your project in a GitHub -- https://github.com/ . This way you will be able to easily link to a full code + data of your project and others will be able to try it.

That's what michalis said, give your full project by now, then you can delete it when it's solved.

lainz

  • Hero Member
  • *****
  • Posts: 4599
  • Web, Desktop & Android developer
    • https://lainz.github.io/
Re: Using the Castle Game Engine Without Any Prior Coding Experience
« Reply #28 on: February 29, 2024, 12:00:30 am »
OR at elast create a private repository and add michalis to it. But without compilable stuff you can't debug nothing...

JPF12141999

  • Jr. Member
  • **
  • Posts: 88
Re: Using the Castle Game Engine Without Any Prior Coding Experience
« Reply #29 on: February 29, 2024, 12:04:56 am »
And you will see that I did indeed do that when he suggested it, look at my link further up the page.

 

TinyPortal © 2005-2018